[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
All,
I read through the faq and tried to find an answer to the scope issue. I found that the faq mentions that a variable within a choose statement has a scope confined to that xsl element. However, it does not mention the scope of the variables external to the xsl element.
Is there a better way for me to tackle this problem other than creating three separate templates for my choose statement? Please look specifically at the 'w' and 'h' variables and their updates based on 'k' and 'i'. To help clarify my problem, I have provided my xsl script:
N = <xsl:value-of select="$N" /><br />
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
[xsl] is the variable really out of scope??
Subject: [xsl] is the variable really out of scope?? From: "bix xslt" <bix_xslt@xxxxxxxxxxx> Date: Thu, 05 Dec 2002 22:53:14 +0000 |
All,
I have the following problem defined by microsoft IE: the variable 'i' is undefined and may be out of scope
I read through the faq and tried to find an answer to the scope issue. I found that the faq mentions that a variable within a choose statement has a scope confined to that xsl element. However, it does not mention the scope of the variables external to the xsl element.
Is there a better way for me to tackle this problem other than creating three separate templates for my choose statement? Please look specifically at the 'w' and 'h' variables and their updates based on 'k' and 'i'. To help clarify my problem, I have provided my xsl script:
<xsl:template match="/"> <xsl:call-template name="calcOpt" /> </xsl:template>
<xsl:template name="calcOpt"> <xsl:param name="N" select="23" />
<!-- pseudo-code N = value in s = sqrt(N) k = s mod 1 // fractional portion of square root i = s - k
if 0 < k < 0.5 w = i h = i+1 else if k >= 0.5 w = i+1 h = i+1 else w = i h = i -->
N = <xsl:value-of select="$N" /><br />
<xsl:variable name="s">4.79</xsl:variable> s = <xsl:value-of select="$s" /><br />
<xsl:variable name="k" select="$s mod 1" /> k = <xsl:value-of select="$i" /><br />
<xsl:variable name="i" select="$s - $k" /> i = <xsl:value-of select="$k" /><br />
<xsl:variable name="w"> <xsl:choose> <xsl:when test="($k > 0.5) and ($k < 0.5)"> <xsl:value-of select="$i+1" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="$i" /> </xsl:otherwise> </xsl:choose> </xsl:variable> w = <xsl:value-of select="$w" /><br />
<xsl:variable name="h"> <xsl:choose> <xsl:when test="($k = 0)"> <xsl:value-of select="$i" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="$i+1" /> </xsl:otherwise> </xsl:choose> </xsl:variable> h = <xsl:value-of select="$h" /><br /> </xsl:template>
Thanks in advance, Bix
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] please help with date for, David Carlisle | Thread | Re: [xsl] is the variable really ou, Gunther Schadow |
Re: [xsl] Locating Things Relative , David Carlisle | Date | [xsl] XSL Help!!, Chandra - |
Month |
Keywords