This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
numbering the result tree
- To: <xsl-list at mulberrytech dot com>
- Subject: numbering the result tree
- From: "Shlomi Sarfati" <shlomi at navixo dot com>
- Date: Sun, 26 Nov 2000 15:24:05 +0200
- Reply-To: xsl-list at mulberrytech dot com
hi
I have a simple xml tree like this :
<main>
<list>
<objects> </objects>
<objects> </objects>
<objects> </objects>
<objects> </objects>
<list>
<objects> </objects>
<objects> </objects>
<objects> </objects>
<objects> </objects>
<list>
<objects> </objects>
<objects> </objects>
<objects> </objects>
<objects> </objects>
</list>
</list>
</list>
</main>
each list have its objects and other lists that can have lists that can have
lists .......
I built a simple xsl that transfer this xml to another xml but I need to
give the result tree numbers that will define the tree ! .
I need that the first list will be 1, 2, 3... N and all the nodes under a
certain list will be X_1, X_2, X_3 ... X_N
(where x is the father number) etc.
my result tree should be unlimited in his depth (as deep as the source tree)
this is my xsl :
----------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="main">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="list">
<!-- this is where i need to put the number that represent the node -->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="object">
<!-- irrelevant -->
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
hope I made my self clear, and thanks for the help
shlomi
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list