On Sun, Mar 17, 2002, Sreedhar Chintalapaty wrote: > Tom, > > It's not clear what how you want to differentiate between when and > otherwise, so my answer may be way off; however, if you want to > differentiate at the cell (<td>) level, then try with the <tr> tags outside
Sorry I wasnt clear. the "position() mod 2" will ring true for odd numbers, and false for even numbers....or the other way around (I always get confused about that).. Point is, given a list of X elements, I want to render them as such: X1 X2 X3 X4 X5 X6 X7 X8 X... So, if position() is odd (left column) render this part: <tr> <td>Some odd X</td> And since the next one will be even, it will close the row: <td>Some even X</td> </tr> Basically, the only difference is the <tr> on the odd side, and the </tr> on the even side. I do not just want this for 2 column rows though, I'd like to be able to use "position() mod 4" (for example) to give each row 4 columns.....so basically at some point I need something like: <xsl:if test="some condition"> </tr> </xsl:if> and the same with <tr>, the problem is that cause the <tr> </tr> tags to be in strange places and it fouls up the nesting, which causes XSLT errors.... Does that make any more sense? I could explain it in 30 seconds if I had a napkin and a pen. :) -Tom > the test: > > <tr> > <xsl:when test="position() mod 2"> > <td> > <xsl:value-of select="@name"/> > </td> > </xsl:when> > <xsl:otherwise> > <td> > <xsl:value-of select="@name"/> > </td> > </xsl:otherwise> > </tr> > > HTH, > > Sreedhar > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Sunday, March 31, 2002 11:16 AM > To: [EMAIL PROTECTED] > Subject: [OT] uneven tags inside XSLT conditionals > > > Hey, > > I've done some googling and I cant find the answer to this. > > I basically want to do: > > <xsl:choose> > <xsl:when test="position() mod 2"> > <tr> > <td> > <xsl:value-of select="@name"/> > </td> > </xsl:when> > <xsl:otherwise> > <td> > <xsl:value-of select="@name"/> > </td> > </tr> > </xsl:otherwise> > </xsl:choose> > > > So basically there will be two columns of @name printed. The problem with > this setup is that the <tr> and </td> make the whole thing > malformed/invalid due to the broken nesting. Is there a way to get around > this, or maybe a more "proper" way of achieving the same end? > > -Tom > > > > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > > > > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > > -- -- --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>