Subject: RE: [xsl] Converting xml data to html using xsl/xslt From: "Todd Baker" <lists@xxxxxxxxxxxxxxxxx> Date: Thu, 12 Feb 2004 11:21:29 +1100 |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Converting xml data to ht, Josh Canfield | Thread | RE: [xsl] Dynamic building of HTML , Arulraj |
Re: [xsl] xhtml -> xsl:fo transform, Kobayashi | Date | Re: [xsl] xhtml -> xsl:fo transform, scott gabelhart |
Month |