item 1 | item 4 | item 7 |
item 2 | item 5 | |
item 3 | item 6 |
The XSLT code:
<xsl:variable name="n-rows" select="3"/>
<xsl:template name="recurse-rows">
<xsl:param name="index" select="1"/>
<xsl:param name="modrow" select="1" />
<tr>
<xsl:for-each select="/root/item[position() mod $n-rows = $modrow]">
<td>
<xsl:value-of select="value" />
</td>
</xsl:for-each>
</tr>
<xsl:if test="$index < $n-rows">
<xsl:call-template name="recurse-rows">
<xsl:with-param name="index" select="$index + 1"/>
<xsl:with-param name="modrow" select="($index + 1) mod $n-rows"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
sources for ideas:
http://www.stylusstudio.com/xsllist/200407/post30810.html
http://www.perlmonks.org/?node_id=518095
No comments:
Post a Comment