ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
RE: [xsl] Transform XML to HTML table with multiple columns and lines.
by Michael Kay other posts by this author
Nov 6 2001 9:33PM messages near this date
Re: [xsl] Can you embed a filter test ahead of the format-number function in the xsl:value-of method | [xsl] Re: lookup-table thoughts (was Re: matching multiple times, outputting once?
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@[...].com
>  [mailto:owner-xsl-list@[...].com]On Behalf Of Johan
>  Andersson
>  Sent: 06 November 2001 18:11
>  To: XSL-List@[...].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@[...].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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved