[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

recursive passing parameter

Subject: recursive passing parameter
From: Honglin Su <hosu@xxxxxxxxxxx>
Date: Tue, 07 Sep 1999 11:50:06 -0400
xsl value before
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.