[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Filling out a table row

Subject: Filling out a table row
From: "Sam Carleton" <scarleton@xxxxxxxxxxxxxxxx>
Date: Tue, 3 Jul 2007 20:53:54 -0400
 Filling out a table row
I have a node set that I need to get into a table with 5 columns and
how ever many rows there needs to be.  I have the basic code working.
The problem I have is the table is not finished when the node set is
not a multiple of 5.  Here is a same dataset:

<images>
  <image name="a">1</image>
  <image name="b">2</image>
  <image name="c">3</image>
  <image name="d">4</image>
  <image name="e">5</image>
  <image name="f">6</image>
  <image name="g">7</image>
  <image name="h">8</image>
</images>

And the XSLT:

<xsl:template match="images">
<table border="3">
	<xsl:for-each select="image[position() mod 5 = 1]">
		<xsl:text>&#10;</xsl:text>
		<tr>
			<xsl:for-each select=".|following-sibling::image[position() &lt; 5]">
				<td><xsl:value-of select="concat(@name,':',.)"/></td>
			</xsl:for-each>
		</tr>
	</xsl:for-each>
	<xsl:text>&#10;</xsl:text>
</table>
</xsl:template>

I would simply like to finish off the table with the correct number of
<td>&NBSP;</td>, now do I do that?

Sam

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.