This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Transform XML to HTML table with multiple columns and lines.
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Transform XML to HTML table with multiple columns and lines.
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- Date: Tue, 6 Nov 2001 21:33:37 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
Yes, it can be done. It's a grouping problem, so read
http://www.jenitennison.com/xslt/grouping. If you want to use Muenchian
grouping you'll have to move off xt, which doesn't support keys.
Mike Kay
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Johan
> Andersson
> Sent: 06 November 2001 18:11
> To: XSL-List@lists.mulberrytech.com
> Subject: [xsl] Transform XML to HTML table with multiple columns and
> lines.
>
>
> 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
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list