Re: [xsl] output in table

Subject: Re: [xsl] output in table
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Mon, 20 Jun 2005 22:08:39 +0200
Charles Ohana wrote:
I need the following output. But I need it generic since I don't know how many element I'm going to have ...

It looks like you want to create a three column table (or N column table) from a flat list. This is also known as a "grouping by position" class problem.

Roughly:
 <table border="1">
   <xsl:for-each select="carrier[position() mod 3 = 1]">
     <tr>
       <xsl:for-each select=".|following-sibling::carrier[
               position() &lt; 3]">
         <td>
            <xsl:value-of select="."/>
         </td>
       </xsl:for-each>
     </tr>
   </xsl:for-each>
 </table>


For a N column table, replace the 3 by $N. Beware: code is completely untested, may even contain syntax errors.

J.Pietschmann

Current Thread