[xsl] Ho do you format arbitrary data into tables?

Subject: [xsl] Ho do you format arbitrary data into tables?
From: Dan Vint <dvint@xxxxxxxxxxxxxx>
Date: Mon, 21 Jul 2003 08:51:00 -0700
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


Current Thread