[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML List to Multi-column HTML transformation
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|