[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to take a node set and convert it into a table
On 12/12/06, David Carlisle <davidc@xxxxxxxxx> wrote:
The following will handle any number of rows: David, I took your code and modified it just a little to what I am really doing and it is only giving me one column tables: XML: <detailNVPSet> <detailNVP name="a">1</detailNVP> <detailNVP name="b">2</detailNVP> <detailNVP name="c">3</detailNVP> <detailNVP name="d">4</detailNVP> <detailNVP name="e">5</detailNVP> <detailNVP name="f">6</detailNVP> <detailNVP name="g">7</detailNVP> <detailNVP name="h">8</detailNVP> <detailNVP name="i">9</detailNVP> <detailNVP name="j">10</detailNVP> </detailNVPSet> XSLT: <xsl:template match="detailNVPSet"> <table> <xsl:for-each select="detailNVP[position() mod 5 =1]"> <xsl:text> </xsl:text> <tr> <xsl:for-each select=".|following-sibling::node[position() < 5]"> <td><xsl:value-of select="concat(@name,':',.)"/></td> </xsl:for-each> </tr> </xsl:for-each> <xsl:text> </xsl:text> </table> </xsl:template> Output: <table> <tr> <td>a:1</td> </tr> <tr> <td>f:6</td> </tr> </table>
|
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
|