|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] recursive passing parameter
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








