http://onionworks.net/2004/renderengine/utility

createIterationBlocks (itemCount : int, blockSize : int) : nodeset

A number of itemCount elements can be divided into units with the method “createIterationBlocks”. These units each contain blockSize items.

<xsl:stylesheet version="1.0">
<xsl:template match="/">
<xsl:variable name="items" c.as="Node">
<item>Nummer 1</item>
<item>Nummer 2</item>
<item>Nummer 3</item>
<item>Nummer 4</item>
<item>Nummer 5</item>
<item>Nummer 6</item>
<item>Nummer 7</item>
</xsl:variable>
<table>
<xsl:for-each select="util:createIterationBlocks(count($items/item), 3)">
<tr>
<xsl:for-each select="item">
<td>
<xsl:variable name="index" select="number(@index)" />
<xsl:value-of select="@index" />
:
<xsl:value-of select="$items/item[$index]" />
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Output of elements in a table

Output:

1: Number 1 2: Number 2 3: Number 3
4: Number 4 5: Number 5 6: Number 6
7: Number 7


In the example, seven elements are written into a table where it is stipulated for each column to contain a unit of three elements.