xsl-list
[Top] [All Lists]

RE: [xsl] Variables have no value

2007-02-15 13:53:53
Yes - That was the problem - the debugger did not show a value, so I assumed 
the error was caused by that.  And we know what happens when one assumes...

A variable that performed a calculation based on the values of the other 
variables was failing.  Rearranging my code to print out the variables pointed 
me to a missing dollar sign deep in the expression.

Thanks!

-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Thursday, February 15, 2007 2:22 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Variables have no value

What do you mean by saying that a variable has no value? How did you examine
the variable?

Variables in Saxon are often evaluated lazily (on first reference). If
you're using a debugger then it may be visible that a variable hasn't (yet)
been evaluated. But if you reference it from your code, it should always
have a value.

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Angela Williams 
[mailto:Angela(_dot_)Williams(_at_)the401kcompany(_dot_)com] 
Sent: 15 February 2007 19:14
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Variables have no value

Good afternoon -
I'm using XSLT 2.0, Saxon8b, XEP4.4...

Some of my variables are initializing and some are not. I've 
reordered them, overlaid non-working ones with working ones, 
added new ones, renamed them and revalued them and the same 
ones still won't initialize. I've googled and searched 
through the 6 or 7 books on my desk and can't find a reason 
why. What am I missing?

<xsl:template match="something">
    <xsl:variable name="A11" select="number(10)" />    <!-- 
NO VALUE -->
    <xsl:variable name="A21" select="number(4.5)"/>    <!-- 
NO VALUE -->
    <xsl:variable name="A12" select="number(313.6)" /> <!-- OK -->
    <xsl:variable name="A22" select="number(208.1)"/>  <!-- OK -->
    <xsl:variable name="A32" select="number(6)"/>      <!-- OK -->
    <xsl:variable name="A42" select="number(6)"/>      <!-- 
NO VALUE -->
    <xsl:variable name="A52" select="number(6)"/>      <!-- OK -->
    <xsl:variable name="A62" select="number(6)"/>      <!-- 
NO VALUE -->
    
    <xsl:variable name="B32" select="number(43)"/>   <!-- OK -->
    <xsl:variable name="B42" select="number(22)"/>   <!-- OK -->
    <xsl:variable name="B52" select="number(3)"/>    <!-- OK -->
    <xsl:variable name="B62" select="number(3)"/>    <!-- OK -->

    <!-- Do something with the variables here. Fails with 
Attribute 'x' cannot have a value of NaN error.--> </xsl:template>


Thanks!
Angela Williams
Channel Developer
The 401k Company
Austin, Texas, USA
512-344-1547
  



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>