This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Transform XML to HTML table with multiple columns and lines.
- To: <XSL-List at lists dot mulberrytech dot com>
- Subject: [xsl] Transform XML to HTML table with multiple columns and lines.
- From: "Johan Andersson" <johan dot andersson at affectus dot se>
- Date: Tue, 6 Nov 2001 19:10:37 +0100
- Organization: Affectus AB
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi all!
I use XP/SAX and Java to produce XML and XT to transform it to HTML.
Lets say I have this XML put out from my Java application:
<Sales>
<Occasion>
<Salesperson>Mr Nisse</Name>
<Time>1999-12-23 18:37:00</Time>
<Amount>369</Amount>
</Occasion>
<Occasion>
<Salesperson>Nils Holgersson</Name>
<Time>1999-12-23 18:39:33</Time>
<Amount>750</Amount>
</Occasion>
<Occasion>
<Salesperson>Sven Lindberg</Name>
<Time>1999-12-23 18:45:03</Time>
<Amount>1500</Amount>
</Occasion>
<Occasion>
<Salesperson>Mr Nisse</Name>
<Time>1999-12-23 19:58:57</Time>
<Amount>900</Amount>
</Occasion>
<Occasion>
<Salesperson>Sven Lindberg</Name>
<Time>1999-12-23 19:58:57</Time>
<Amount>3000</Amount>
</Occasion>
</Sales>
And this is my desired HTML output:
<html>
...
<body>
<table border="1">
<tr>
<th>Time</th>
<th>Mr Nisse</th>
<th>Nils Holgersson</th>
<th>Sven Lindberg</th>
</tr>
<tr>
<th>1999-12-23 18:37:21</th>
<td>369</td>
<td></td>
<td></td>
</tr>
<tr>
<th>1999-12-23 18:39:33</th>
<td></td>
<td>750</td>
<td></td>
</tr>
<tr>
<th>1999-12-23 18:45:03</th>
<td></td>
<td></td>
<td>1500</td>
</tr>
<tr>
<th>1999-12-23 19:58:57</th>
<td>900</td>
<td></td>
<td>3000</td>
</tr>
</table>
</body>
</html>
Is there anyone who can give me a hint about what to put
in the xsl stylesheet to get this HTML output? Can this be done?
I am grateful for any suggestion or hint.
Thanks in advance.
___________________________
Johan Andersson
Affectus AB
Therese Svenssons gata 10
417 55 Göteborg, Sweden
http://www.affectus.se
+46(0)31-744 50 72
johan.andersson@affectus.se
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list