[xsl] different crosstables from xml data

Subject: [xsl] different crosstables from xml data
From: friepoertner <friepoertner@xxxxxxxxxxxxx>
Date: Tue, 23 Oct 2001 12:40:08 +0200
Hi list,

I have to generate html crosstables with different headers
from xml-files using xsl stylesheets.

I generate XML Data like this:

<crosstab title="area" sum_col="1" sum_row="1" absolute="1" relative="1">
<row title="north">
 <column title="gender">
   <column title="male">
     <column title="abs." type="absolute">20</column>
     <column title="rel." type="relative">40</column>
   </column>
   <column title="female">
     <column title="abs." type="absolute">30</column>
     <column title="rel." type="relative">60</column>
   </column>
 </column>
 <column title="foo">
   [...]
</row>
<row title="east">
 <column title="gender">
   <column title="male">
   [...]

</crosstab>

the output should create tables with the right col- and
rowspan as well as optional sum-column / sum-row. When
there is only one option absolute/relative selected, the
header row 'abs' or 'rel' should be ignored.

Example Output:

<table>
<tr>
<td rowspan="3">area</td><td colspan="4">gender</td><td colspan="2">foo ... </tr>
<tr><td colspan="2">male</td><td colspan="2">female</td> ... </tr>
<tr><td>abs.</td><td>rel.</td><td>abs.</td> ... </tr>
<tr><td>north</td><td>20</td><td>40 %</td> ... </tr>
<tr><td>east</td><td>10</td><td>20 %</td> ... </tr>
[...]
<tr><td>sum</td><td>30</td><td>60 %</td> ... </tr>


or the same without relative values:

<table>
<tr>
<td rowspan="2">area</td><td colspan="2">gender</td><td colspan="1">foo ... </tr>
<tr><td colspan="1">male</td><td colspan="1">female</td> ... </tr>
<tr><td>north</td><td>20</td><td>30</td> ... </tr>
<tr><td>east</td><td>10</td><td>25</td> ... </tr>


How can I get the colspan / rowspan information? Has someone done this
before? Or should I generate different XML-Source for a better xslt
processing?

Thanks in advance!

IFR

--
Ingo Friepoertner
friepoertner@xxxxxxxxxxxxx


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



Current Thread