Thanks very much. Since i need to put icons for every child, i was thinking
it would be better for me to process each node separately and not to use a
*. Here is the XSL code i wrote to take care of recursion. Is there a way to
indent each child based on depth? I can get the depth with
"count(ancestor::*)". The output would still be:
DataContainer_1
integerField_1
decimalField_1
dateField_1
DataContainer_1_1
textField_1_1
integerField_1_1
DataContainer_1_1_1
textField_1_1_1
integerField_1_1_1
XSL:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="HSDataContainerType">
<xsl:for-each select="//HSDataContainerType">
<div><b><xsl:value-of select="@name"/></b></div>
<xsl:value-of select="count(ancestor::*)"/>
<xsl:for-each select="./HSString">
<div style="margin-left: 4em;"><xsl:value-of
select="@name"/></div>
</xsl:for-each>
<xsl:for-each select="./HSDouble">
<div style="margin-left: 4em;"><xsl:value-of
select="@name"/></div>
</xsl:for-each>
<xsl:for-each select="./HSBoolean">
<div style="margin-left: 4em;"><xsl:value-of
select="@name"/></div>
</xsl:for-each>
<xsl:for-each select="./HSBinary">
<div style="margin-left: 4em;"><xsl:value-of
select="@name"/></div>
</xsl:for-each>
<xsl:for-each select="./HSInteger">
<div style="margin-left: 4em;"><xsl:value-of
select="@name"/></div>
</xsl:for-each>
<xsl:for-each select="./HSDate">
<div style="margin-left: 4em;"><xsl:value-of
select="@name"/></div>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of
Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com
Sent: Tuesday, June 24, 2003 10:38 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Re: Maintaining Heirarchy and using Recursion to
write an XSL
Hi,
I don't know the number of <HSDataContainerType> tags i could
inside one
another. I am trying to display the output (HTML) thru my XSL like:
DataContainer_1
integerField_1
decimalField_1
dateField_1
DataContainer_1_1
textField_1_1
integerField_1_1
DataContainer_1_1_1
textField_1_1_1
integerField_1_1_1
<xsl:template match="HSContract">
<html>
<head>
<title/>
</head>
<body>
<xsl:apply-templates select="*"/>
</body>
</html>
</xsl:template>
<xsl:template match="HSDataContainerType">
<div>
<xsl:value-of select="@name"/>
</div>
<div style="margin-left: 4em;">
<xsl:apply-templates select="*"/>
</div>
</xsl:template>
<xsl:template match="*">
<div>
<xsl:value-of select="@name"/>
</div>
</xsl:template>
Cheers,
Jarno - SITD: Laughingstock
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list