xsl-list
[Top] [All Lists]

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

2008-01-25 07:37:00


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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--