Subject: Re: [xsl] How to take a node set and convert it into a table view From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 12 Dec 2006 16:31:40 GMT |
> how do I make a table that looks like this: > > a:1 b:2 c:3 d:4 e:5 > f:6 g:7 h:8 i:9 j:10 > > In other words, a 5x2 table. > > I am thinking that if I can get all the name/values in the first > example into a node set like in the second, then all I would have to > do is get the second node set into a table of 5 columns with X number > of rows. > I'm not sure I understand your description, which makes it seem rather more complicated than it is. The following will handle any number of rows, there are examples of this in the faq im sure. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="nodes"> <table> <xsl:for-each select="node[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> </xsl:stylesheet> $ saxon node.xml node.xsl <?xml version="1.0" encoding="utf-8"?><table> <tr><td>a:1</td><td>b:2</td><td>c:3</td><td>d:4</td><td>e:5</td></tr> <tr><td>f:6</td><td>g:7</td><td>h:8</td><td>i:9</td><td>j:10</td></tr> </table> David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to take a node set an, Sam Carleton | Thread | Re: [xsl] How to take a node set an, Sam Carleton |
Re: [xsl] how search end of line in, Florent Georges | Date | [xsl] xmlns:local="#local-functions, dave heyer |
Month |