Sheryld
Ну скажем вот решение для n=4:
Код HTML:
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<head>
<title>Four columns layout</title>
</head>
<body>
<xsl:variable name="maxperrow" select="ceiling(count(//item) div 4)"/>
<xsl:variable name="col" select="//item[position() <= $maxperrow]"/>
<table border="1" cellpadding="5">
<xsl:for-each select="$col">
<xsl:variable name="current" select="position()"/>
<tr>
<td><xsl:value-of select="//item[$current+$maxperrow*0]/title"/></td>
<td><xsl:value-of select="//item[$current+$maxperrow*1]/title"/></td>
<td><xsl:value-of select="//item[$current+$maxperrow*2]/title"/></td>
<td><xsl:value-of select="//item[$current+$maxperrow*3]/title"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
Может шокировать конечно количество XSL кода (можно было бы обойтись без переменных, но так нагляднее и удобнее), на практике HTML намного больше конечно. В любом случае не вижу особенных слжностей, на Smarty решение было бы похожим.