Hi,
I have one great problem, for me.
During 2 weeks i have one great problem and i don't know how
to solve it.
y have the bellow xml file and i want to put the data, the
paginas_titulo
node in 3 columns:
<tr><td>paginas_titulo 1</td><td>paginas_titulo
2</td><td>paginas_titulo
3</td></tr>
<tr><td>paginas_titulo 4</td><td>paginas_titulo
5</td><td>paginas_titulo
6</td></tr>
......
if there are 5 nodes (paginas_titulo nodes) apears one row
with 3 columns
with data and other row with 2 columns with data and the other without
data.
<xsl:template match="sn_servicioproyecto">
<xsl:variable name="cols" select="3"/>
<table>
<tbody>
<xsl:for-each select="informacion/sn_masterinformacion[position() mod
$cols = 1]">
<tr>
<xsl:for-each select=". |
following-sibling::sn_masterinformacion[position() <= 2]">
<td>
<xsl:value-of select="paginas/sn_paginas/paginas_titulo"/>
</td>
</xsl:for-each>
<!-- filler -->
<xsl:for-each select="(document('')//node())[position() < ($cols
- count(current()/following-sibling::sn_masterinformacion))]">
<td/>
</xsl:for-each>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:template>
The filler bit above isn't really that efficient, e.g.
<xsl:if test="not(following-sibling::sn_masterinformacion[1])">
<td/>
<xsl:if test="not(following-sibling::sn_masterinformacion[2])">
<td/>
</xsl:if>
</xsl:if>
is faster and more readable.
Cheers,
Jarno - The Cure: To Wish Impossible Things
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list