Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Help? - xsl if statement >Thread Next - Re: Help? - xsl if statement Re: Help? - xsl if statementTo: NULL Date: 4/14/2008 7:23:00 PM Thank you soooo much! I go it to work. But i have another question. What if i have a second level in the xml data? As in, //Animals/People? I tried: select="//Animals/People[position() mod $columns = 0]"> But that didn't work. Any ideas? Thank you again, Julie. "Martin Honnen" <mahotrash@y...> wrote in message news:%23UxXtlVnIHA.3780@T...... > Julie Smith wrote: >> I'm trying to iterate through a collection and list them in a table going >> horizontally, not vertically. >> Example of what i've currently got, but not working: >> >> <xsl:variable name="columns" select="5"/> >> <table> >> <xsl:for-each select="//People"> >> <xsl:if test="(position() mod $columns) = 0"><tr></xsl:if> >> <td> >> <xsl:value-of select="@name"/> >> </td> >> <xsl:if test="(position() mod $columns) = 0"></tr></xsl:if> >> </xsl:for-each> >> </table> > > > You need to use a different approach, like this: > <table> > <xsl:for-each select="//People[position() mod $columns = 0]"> > <tr> > <xsl:for-each select=". | following-sibling::People[position() < > $colums]"> > <td> > <xsl:value-of select="@name"/> > </td> > </xsl:for-each> > </tr> > </xsl:for-each> > </table> > > -- > > Martin Honnen --- MVP XML > http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
