G
GR33DY
Hi every-one,
(Deleted and reposted to avoid sp@m)
I have an XML file that looks like this:
_____________________________XML_________________________________
<root>
<nextlevel>
<init>
<element1>
Content
</element1>
<element2>
More content
</element2>
...etc
<message>
<element1>
Content
</element1>
<element2>
More content
</element2>
...etc
<message>
<element1>
Content
</element1>
<element2>
More content
</element2>
...etc
</message>
</message>
</init>
</nextlevel>
</root>
_________________________________________________________________
The <message> nodes may well contain other <message> nodes which could
contain other <message> nodes etc. etc. ad infinitum(well, almost!)
My problem is that when it comes to the XSL, I want to nest these nodes
and indent them and this is what I have so far:
_____________________________XSL_________________________________
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="init">
<xsl:value-of select="element1"/>
<xsl:value-of select="element2"/><br />
</xsl:template>
<xsl:template name ="message" match="message">
<blockquote>
<xsl:value-of select="element1"/>
<xsl:value-of select="element2"/>
<xsl:for-each select="message[count(descendant::message)!='0']">
<xsl:call-template name="message"/>
</xsl:for-each>
</blockquote>
</xsl:template>
_________________________________________________________________
However, this only nests up to and including the second <message> node
and no further. Any help appreciated
Tom.
(Deleted and reposted to avoid sp@m)
I have an XML file that looks like this:
_____________________________XML_________________________________
<root>
<nextlevel>
<init>
<element1>
Content
</element1>
<element2>
More content
</element2>
...etc
<message>
<element1>
Content
</element1>
<element2>
More content
</element2>
...etc
<message>
<element1>
Content
</element1>
<element2>
More content
</element2>
...etc
</message>
</message>
</init>
</nextlevel>
</root>
_________________________________________________________________
The <message> nodes may well contain other <message> nodes which could
contain other <message> nodes etc. etc. ad infinitum(well, almost!)
My problem is that when it comes to the XSL, I want to nest these nodes
and indent them and this is what I have so far:
_____________________________XSL_________________________________
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="init">
<xsl:value-of select="element1"/>
<xsl:value-of select="element2"/><br />
</xsl:template>
<xsl:template name ="message" match="message">
<blockquote>
<xsl:value-of select="element1"/>
<xsl:value-of select="element2"/>
<xsl:for-each select="message[count(descendant::message)!='0']">
<xsl:call-template name="message"/>
</xsl:for-each>
</blockquote>
</xsl:template>
_________________________________________________________________
However, this only nests up to and including the second <message> node
and no further. Any help appreciated
Tom.