Hi Sam,
One way is to check if there are missing elements and add a td for each
missing image.
<tr>
<xsl:for-each select=".|following-sibling::image[position() < 5]">
<td><xsl:value-of select="concat(@name,':',.)"/></td>
</xsl:for-each>
<xsl:if test="not(following-sibling::image[4])">
<td> </td>
<xsl:if test="not(following-sibling::image[3])">
<td> </td>
<xsl:if test="not(following-sibling::image[2])">
<td> </td>
<xsl:if test="not(following-sibling::image[1])">
<td> </td>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</tr>
Regards,
George
---------------------------------------------------------------------
George Cristian Bina - http://aboutxml.blogspot.com/
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Sam Carleton wrote:
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> </xsl:text>
<tr>
<xsl:for-each select=".|following-sibling::image[position()
< 5]">
<td><xsl:value-of select="concat(@name,':',.)"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
<xsl:text> </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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--