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

Re: Variable scope when using imported stylesheets

Subject: Re: Variable scope when using imported stylesheets
From: Ralph Holz <ralph.holz@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Aug 2004 16:47:20 +0200
xsl variable scope
Hi,

The idea was to use variables to access a sub-nodeset relative to the current node at the time of calling (remember, a for-each calling imported templates). I wanted to declare these variables only once, but I think now that that is impossible as they get evaluated at the time of declaration. I'll have to refer you to my source in the other mail...

I think what I can do is to declare the variables within the imported template and thus get my abbreviation:

<xsl:template>
 <xsl:for-each select="baseDboFileReference">
   <xsl:call-template name="calledOne" />
 </xsl:for-each>
</xsl:template>

<xsl:template name="calledOne">
  <xsl:variable name="runOutOfIdeas" select="FileRefEval" />
  [siblings]
</xsl:template>

Since templates can get re-evaluated if called in this way, and variable scope is limited to this template and call, this does work (just tested). Of course, this means I have to insert the variables declaration in every template that is called in this way.

Do you see any caveats here?

Thanks for your input!

Ralph

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.