XSLT debugger doesn't display numerical variable values

Having trouble installing Oxygen? Got a bug to report? Post it all here.
jokester01au
Posts: 64
Joined: Tue May 17, 2005 9:16 am

XSLT debugger doesn't display numerical variable values

Post 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.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
jokester01au
Posts: 64
Joined: Tue May 17, 2005 9:16 am

Incorrect display of variables in XSLT debug

Post 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>
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post 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
George Cristian Bina
jokester01au
Posts: 64
Joined: Tue May 17, 2005 9:16 am

Variables displaying N/A

Post 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.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
Post Reply