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 <table> <xsl:variable name="r" select="ceiling(count(MyElement) div 3)"/> <xsl:for-each select="MyElement[position() < $r"> <tr> <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> </tr> </xsl:for-each> </table> 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> </xsl:for-each> david -- http://www.dcarlisle.demon.co.uk/matthew ________________________________________________________________________ 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: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XML List to Multi-column HTML, Chris Ward | Thread | RE: [xsl] XML List to Multi-column , David . Pawson |
Re: [xsl] Build hierarchies, Ivan Churkin | Date | [xsl] AndExpression, SHEIKH Sajjad |
Month |