xsl-list
[Top] [All Lists]

Re: output in table

2005-06-20 13:08:39
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

--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>