XSL stylesheet 1

<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/">
<TABLE border='1'>
<xsl:variable name="inRow" select='3'/>
<xsl:apply-templates select="//item[position() mod $inRow = 1]">
<xsl:with-param name='inRow' select='$inRow'/>
</xsl:apply-templates>
</TABLE>
<TABLE border='1'>
<xsl:variable name="inRow" select='4'/>
<xsl:apply-templates select="//item[position() mod $inRow = 1]">
<xsl:with-param name='inRow' select='$inRow'/>
</xsl:apply-templates>
</TABLE>
<TABLE border='1'>
<xsl:variable name="inRow" select='5'/>
<xsl:apply-templates select="//item[position() mod $inRow = 1]">
<xsl:with-param name='inRow' select='$inRow'/>
</xsl:apply-templates>
</TABLE>
</xsl:template>
<xsl:template match="item">
<xsl:param name="inRow"/>
<TR>
<TD><xsl:value-of select="."/></TD>
<xsl:apply-templates select="following::item[position() &lt; $inRow]" mode='cell'/>
</TR>
</xsl:template>
<xsl:template match="item" mode='cell'>
<xsl:param name="inRow"/>
<TD><xsl:value-of select="."/></TD>
</xsl:template>
</xsl:stylesheet>