recursive passing parameter

Subject: recursive passing parameter
From: Honglin Su <hosu@xxxxxxxxxxx>
Date: Tue, 07 Sep 1999 11:50:06 -0400
Hi, there,

For this xml file:

<?xml version="1.0"?>
<A1>
    <B1>
        <C1/>
        <C2/>
    </B1>
    <B2/>
    <B3/>
</A1>

I want the following stylesheet to produce an output like this:

 The variable value before passing is:: init value ...
 The variable value after passing is :: A1
 The variable value before passing is:: A1
 The variable value after passing is :: B1
 The variable value before passing is:: B1
 The variable value after passing is :: C1
 The variable value before passing is:: B1
 The variable value after passing is :: C2
 The variable value before passing is:: A1
 The variable value after passing is :: B2
 The variable value before passing is:: A1
 The variable value after passing is :: B3

xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>
<xsl:variable name="var" select="'init value ...'" />
<!-- process the children recursively -->
<xsl:template match="*">
 The variable value before passing is:: <xsl:value-of select="$var"/>
 <xsl:param name="var" select="name(.)"/>
 The variable value after passing is :: <xsl:value-of select="$var"/>
 <xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>

But the actually output is that every before passing value is 'init
value ...". What's wrong with my stylesheet?

Thank you!

Honglin


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread