[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Converting xml data to html using xsl/xslt

Subject: RE: Converting xml data to html using xsl/xslt
From: "Todd Baker" <lists@xxxxxxxxxxxxxxxxx>
Date: Thu, 12 Feb 2004 11:21:29 +1100
html select using xml
> Your template is matching the <slide> element. You have two 
> slide elements in the slideshow, so you are getting two full 
> copies of the html from your template. You probably want to 
> start your match closer to the root


I find that when rendering an entire HTML page from XML source that matching
the root is the easiest and less prone to getting lost within the XML :)
 

<xsl:template match="/">
  <table>
    <tr><th>data1</th><th>data2</th></tr>
    <xsl:for-each select="slideshow/slide">
      <tr>
        <td><xsl:value-of select="data1"/></td>
        <td><xsl:value-of select="data2"/></td>
      </tr>
    </xsl:for-each>
  </table>
<xsl:template>


But either should work fine.





> Here is a start for the xsl...
> 
> <xsl:template match="/slideshow">
>   <table>
>     <tr><th>data1</th><th>data2</th></tr>
>     <xsl:for-each select="slide">
>       <tr>
>         <td><xsl:value-of select="data1"/></td>
>         <td><xsl:value-of select="data2"/></td>
>       </tr>
>     </xsl:for-each>
>   </table>
> <xsl:template>
> 
> Hope this helps,
> Josh



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.