Subject: Re: [xsl] XML structure to HTML unordered list From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Sun, 09 Sep 2007 14:06:08 +0200 |
And here's my index.xsl file
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:template match="root_element"> <html> <body> <xsl:call-template name="unordered-list"> <xsl:with-param name="items" select="item"/> </xsl:call-template> </body> </html> </xsl:template>
<xsl:template name="unordered-list"> <xsl:param name="items" select="/.."/> <ul> <xsl:for-each select="$items"> <li> <xsl:value-of select="text()"/> <xsl:if test="item"> <xsl:call-template name="unordered-list"> <xsl:with-param name="items" select="item"/> </xsl:call-template> </xsl:if> </li> </xsl:for-each> </ul> </xsl:template>
</xsl:stylesheet>
The above produces what I want, and it seems quite solid. But is there perhaps another (better?) way to solve this task? I'm limited to XSLT 1.0.
Cheers, -- Abel Braaksma
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XML structure to HTML unorder, Kaz | Thread | Re: [xsl] XML structure to HTML uno, Kaz |
[xsl] number of particular sub elem, John Smith | Date | RE: [xsl] number of particular sub , Michael Kay |
Month |