Re: [xsl] XML List to Multi-column HTML transformation

Subject: Re: [xsl] XML List to Multi-column HTML transformation
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 26 Nov 2003 14:54:48 GMT
> I imagine I need to do something clever involving the use of 
> 	/MyElement[ position() mod X ] 
> where X is the no. of columns I require.

Columns not rows.
But since you know it's three you don't really need that at all, just
something like

<xsl:variable name="r" select="ceiling(count(MyElement) div 3)"/>
<xsl:for-each select="MyElement[position() &lt; $r">
<td><xsl:apply-templates select="."/></td>
<td><xsl:apply-templates select="following-sibling::MyElement[$r]"/></td>
<td><xsl:apply-templates select="following-sibling::MyElement[2*$r]"/></td>

If you don't know in advance it's three (or even if you do) then 
you could replace the three td elements above with

<xsl:for-each select=".|following-sibling::MyElement[position() mod $r = 0]">
<td><xsl:apply-templates select="."/></td>



This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

 XSL-List info and archive:

Current Thread