RE: [xsl] displaying a list in a multi-column table

Subject: RE: [xsl] displaying a list in a multi-column table
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 25 Jan 2008 14:36:30 -0000
> You've got a grouping problem - which is easier to solve in XSLT 2.0. 
> You can use something like this:
> 
> <table>
>    <xsl:for-each-group select="word" group-by="position() mod 4">
>      <tr>
>        <xsl:for-each select="current-group()">
>          <td><xsl:value-of select="."/></td>
>        </xsl:for-each>
>      </tr>
>    </xsl:for-each-group>
> </table>
> 

If the data is to be in columns, then I think it needs to be

<xsl:for-each-group select="word" group-by="position() mod (last() idiv 4)">

At least that's what the example on page 300 of XSLT Prog Ref 3rd ed says...

Michael Kay
http://www.saxonica.com/

Current Thread