|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Variable scope
Hi,
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,
Oleg.
Here is a snippet:
<xsl:template name="get-min">
<xsl:param name="product"/>
<xsl:choose>
<xsl:when test="something">
........ 30 lines, few auxiliary variables..[set to a value
here, lets say 1]..
1
</xsl:when>
<xsl:otherwise>
0
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="template1">
.....
<xsl:variable name="min">
<xsl:choose>
<xsl:when test="something">
<xsl:call-template name="get-min">
<xsl:with-param name="product" select="$product"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
0
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
......
<xsl:call-template name="template2">
<xsl:with-param name="product" select="$product"/>
<xsl:with-param name="min-column" select="$min"/>
</xsl:call-template>
....
</xsl:template>
<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
here]
</xsl:if>
</xsl:template>
|
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








