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

RE: creating html tables from cells

Subject: RE: creating html tables from cells
From: Americo Albuquerque <melinor@xxxxxxxx>
Date: Wed, 15 Oct 2003 22:22:22 +0100
beautiful html tables

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Whitney, Dan (CanWest Interactive)
> Sent: Wednesday, October 15, 2003 4:06 PM
> To: 'mulberry - xsl'
> Subject:  creating html tables from cells
> 2 questions.
> I'm wondering if there's an effecient way with xsl to 
> transform it to: <table>
>   <tr>
>     <td>Row 1 - Column 1</td>
>     <td>Row 1 - Column 2</td>
>     <td>Row 1 - Column 3</td>
>     <td>Row 1 - Column 4</td>
>   </tr>
>   <tr>
>     <td>Row 2 - Column 1</td>
>     <td>Row 2 - Column 2</td>
>     <td>Row 2 - Column 3</td>
>     <td>Row 2 - Column 4</td>
>   </tr>
> </table>
> I know I have to somehow create the tr's on the RS element 
> but I'm not at all sure how.
You can use keys to do this, though it might not be the best solution
for big files.
Check the comments in the code

  <!-- set the key to look for the closest previous RI with @col=1 -->
  <xsl:key match="RI" name="RI" use="generate-id((preceding-sibling::RI
| self::RI)[@col=1][last()])"/>

  <xsl:template match="RS">
      <!-- start only with RI the belong to the first column -->
      <xsl:apply-templates mode="start" select="RI[@col=1]"/>

  <xsl:template match="RI" mode="start">
    <!-- for each one create a row -->
      <!-- then select the nodes until the next RI[@col=1] -->
      <xsl:apply-templates select="key('RI',generate-id())"/>

  <xsl:template match="RI">
    <!-- here you do whatever you want with the columns -->

Americo Albuquerque

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.