use the position() mod 3 syntax with an <xsl:choose> block.
thus:
<xsl:when test="posion() mod 3 = 0">, then output the start tag, and
<xsl:when test="position mod 3 = 2">, then output the end tag.
G
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of Dan
Vint
Sent: Monday, July 21, 2003 11:51 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Ho do you format arbitrary data into tables?
I have a list of data, that might be 3 items long or 100. Instead of a list
I want to put this into an HTML or FO table where I have 3 columns and as
many rows as is needed. I have a for-each that selects all the items that I
want and I know what the markup is to generate, but I'm having troubles
coming up with a solution for inserting the row start and end tags.
This is an example of what I'm doing:
<table>
<xsl::for-each select="item">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
</table>
How do I get a counter inside that allows me to insert the appropriate
start or end tag? Is there an easy way to force for-each to work with X
number of items at a time (give me a nodeset of X items) that I could then
process?
I've got an HTML hack that allows me to enter just an empty <tr/> element,
but that is relying on bad HTML to make this work, also my ultimate goal is
to generate FO tables for PDF output.
Any ideas appreciated.
..dan
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list