| Subject: [xsl] is the variable really out of scope?? From: "bix xslt" <bix_xslt@xxxxxxxxxxx> Date: Thu, 05 Dec 2002 22:53:14 +0000 | 
I have the following problem defined by microsoft IE: the variable 'i' is undefined and may be out of scope
   <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
       -->       <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
| 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 |