[xsl] Group-By and nested tables

Subject: [xsl] Group-By and nested tables
From: "Ernesto Chirinos" <ernesto_ch@xxxxxxxxxxx>
Date: Tue, 05 Dec 2006 23:35:02 +0000
Hi,
I'm just starting with XSL and I need some help with this transformation:

The XML data is quite simple:

<ROWS>
<ROW quarter="20" desc="azul"/>
<ROW quarter="21" desc="blanco"/>
<ROW quarter="21" desc="rojo"/>
<ROW quarter="22" desc="verde"/>
<ROW quarter="22" desc="blanco"/>
<ROW quarter="22" desc="rojo"/>
</ROWS>

I need to organize this data into a table, grouping it by quarter and then putting the detail into a nested table. Like this:

 Quarter 21
    Azul
 Quarter 22
    Blanco
    Rojo
 Quarter 23
    Verde
    Blanco
    Rojo

and the html result would be like this:

<table>
<tr>
 <td>20</td>
</tr>
<tr>
 <td>
     <table>
     <tr>
       <td>azul</td>
     <tr>
     </table>
 </td>
</tr>
<tr>
 <td>21</td>
</tr>
<tr>
 <td>
     <table>
     <tr>
       <td>blanco</td>
     <tr>
     <tr>
       <td>rojo</td>
     <tr>
     </table>
 </td>
</tr>
<tr>
 <td>22</td>
</tr>
<tr>
 <td>
     <table>
     <tr>
       <td>verde</td>
     <tr>
     <tr>
       <td>blanco</td>
     <tr>
     <tr>
       <td>rojo</td>
     <tr>
     </table>
 </td>
</tr>
</table>

Probably there is more than one way to achieve this, but anyone would be good.
Thanks in advance!


Ernesto.

_________________________________________________________________
MSN Hotmail : criez votre adresse e-mail gratuite & ` vie ! http://www.msn.fr/newhotmail/Default.asp?Ath=f


Current Thread