|
Subject: [xsl] Variable scope From: Oleg Konovalov <olegkon@xxxxxxxxx> Date: Mon, 16 May 2005 19:44:08 -0400 |
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>
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Variable Scope, Karl Stubsjoen | Thread | RE: [xsl] Variable scope, Aron Bock |
| [xsl] word (not string) wrap, jpk | Date | RE: [xsl] Variable scope, Aron Bock |
| Month |