Page 1 of 1

XSLT debugger doesn't display numerical variable values

Posted: Sun Dec 10, 2006 5:24 am
by jokester01au
Another bug in the XSLT debugger. Numerical variables don't seem to display correctly.

For example, a new stylesheet with a template

<xsl:template match="/">
<xsl:variable name="la">
56
</xsl:variable>
<xsl:apply-templates/>
</xsl:template>

will display "N/A" in the value column of the variables view for the variable la when at a breakpoint on the "apply-templates" element.

This is a problem in both the eclipse plugin and the standalone version of oxygen 8.0

Regards,
Joe.

Posted: Mon Dec 11, 2006 4:12 pm
by sorin_ristache
Hello,

I think you use Saxon 8B and the variable "la" is declared but is never used by the stylesheet. This is the only situation when I could get the N/A value. Saxon 8B evaluates the variable only if you use it, for example with

Code: Select all

<xsl:value-of select="$la"/>

Regards,
Sorin

Incorrect display of variables in XSLT debug

Posted: Wed Dec 13, 2006 5:47 am
by jokester01au
Hi,

I can give a better example of this problem. With the stylesheet attached below, when paused at the value-of tag, the variables pane displays $meBitCount with a "?" in the type column and nothing in the value column. Selecting the variable does nothing.

However, if I type $meBitCount into the xwatch pane, it tells me that I have a node set containing an empty document fragment. This information is very useful to me and it would be great if I could see it directly in the variables pane without having to enter the expression in xwatch.

This is using Oxygen 8.0, Windows Vista and JDK1.6.0RC.

Regards,
Joe.

<xsl:stylesheet xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://exslt.org/math"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
<xsl:variable name="baseBitCount">
32
</xsl:variable>
<xsl:variable name="meBitCount">
<xsl:apply-templates select="xsd:maxExclusive"/>
</xsl:variable>
<xsl:variable name="thisBitCount" select="if ($meBitCount='') then 9999 else $meBitCount"/>

<xsl:variable name="bitCount" select="min(($baseBitCount,xsd:integer($thisBitCount)))"/>
<xsl:value-of select="$bitCount"/>
</xsl:template>
<xsl:template match="xsd:bin">
fxgh
</xsl:template>
</xsl:stylesheet>

Posted: Wed Dec 13, 2006 11:25 am
by george
Hi,

The issue is with the lazy evaluation of variables. oXygen presents what it is in the XSLT processors and in that case the variable is evaluated when it is used, not when it is declared, if you enter an expression in the XWatch view then you force the evaluation of that variable.

Hope that helps,
George

Variables displaying N/A

Posted: Thu Dec 14, 2006 7:16 am
by jokester01au
Hi,

Thanks for the explanation. From a users perspective I feel it would be better for debug mode to always force evaluation of in-scope variables and always display their value in the variables pane.

If one is stepping through the code then the extra time required to evaluate the variables is very unlikely to be a problem.

Regards,
Joe.

Posted: Thu Dec 14, 2006 5:31 pm
by sorin_ristache
Sorry, the XSLT processors do not offer that option. They do not send notifications about variable declarations if the variable is not used. The value of the variable is known only when the processor evaluates it.


Regards,
Sorin