RE: [xslt] equality expression bug?
- From: "Bauman, Carl" <Carl Bauman valero com>
- To: "The Gnome XSLT library mailing-list" <xslt gnome org>
- Subject: RE: [xslt] equality expression bug?
- Date: Mon, 11 Jul 2005 07:56:18 -0500
I'm not sure who you're thinking of submitting the bug report to but I
felt that I should mention that Altova's XMLSpy (version 2004, rel 4)
yields the same results.
I don't know the answer but the fact that both products yield the same
output would seem to require that we ask whether the issue is that
there's a bug in xsltproc or that maybe XSLT works differently than you
supposed. I suppose Altova could be using libxslt code in their product
and the same bug exists in both products?
Carl
-----Original Message-----
From: xslt-bounces gnome org [mailto:xslt-bounces gnome org] On Behalf
Of Bob Stayton
Sent: Saturday, July 09, 2005 1:14 AM
To: xslt gnome org
Subject: [xslt] equality expression bug?
Consider this stylesheet that tests three != 0 expressions. You can run
it
against any XML file, as all it does it output messages to indicate
expression results.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
version="1.0">
<xsl:template match="/">
<xsl:variable name="text" select="'A'"/>
<xsl:variable name="node">B</xsl:variable>
<xsl:choose>
<xsl:when test="$text != 0">
<xsl:message>text value A is not equal to zero</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:message>text value A is *not* not equal to
zero!</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$node != 0">
<xsl:message>node value B is not equal to zero</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:message>node value B is *not* not equal to
zero!</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="string($node) != 0">
<xsl:message>node string value B is not equal to
zero</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:message>node string value B is *not* not equal to
zero!</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
When I run it with xsltproc from libxslt version 10114CVS1011 on Windows
XP,
I get:
text value A is not equal to zero
node value B is *not* not equal to zero!
node string value B is not equal to zero
Does anyone else think the middle test produces the wrong result? My
understanding is that in equality expressions, if one operand is a
number
then the other is converted to a number. Converting a node means first
converting it to a string and then converting that string to a number.
So
that node conversion should yield NaN, which should not be equal to
zero. Am
I missing something, or should I file a bug report?
Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs sagehill net
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt gnome org
http://mail.gnome.org/mailman/listinfo/xslt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]