[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: output in table

Subject: Re: output in table
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Mon, 20 Jun 2005 22:08:39 +0200
three column table
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.