|
[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
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








