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/13/2008 1:28:00 PM
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 | |||
|
