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

Variable scope

Subject: Variable scope
From: Oleg Konovalov <olegkon@xxxxxxxxx>
Date: Mon, 16 May 2005 19:44:08 -0400
xsl variable scope

I am trying to define a local variable in the template template1,
calculate it in another template get-var [about 30 lines]
and pass in to another template template2.

It seems that this variable somehow gets reset to 0 in template2
and doesn't function correctly.

Is that how it supposed to be (that it gets out of scope) ?

Would you recommend me to make that variable global
(but still calculate it in template get-var),
should that help ?
Or should I get rid of template and put all calculation there as well?

Thank you,

Here is a snippet:

<xsl:template name="get-min">
  <xsl:param name="product"/>
    <xsl:when test="something">
      ........   30 lines, few auxiliary variables..[set to a value
here, lets say 1]..

<xsl:template  name="template1">
<xsl:variable name="min">
      <xsl:when test="something">
         <xsl:call-template name="get-min">
	<xsl:with-param name="product" select="$product"/>

<xsl:call-template name="template2">
  <xsl:with-param name="product" select="$product"/>
   <xsl:with-param name="min-column" select="$min"/>

<xsl:template name="current-estimated-table">
  <xsl:param name="product"/>
   <xsl:param name="min-column"/>
......  .....

<xsl:if test="min-column">  ...do something ...      [min-column becomes 0


Current Thread


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.
First Name
Last Name
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.