W3C home > Mailing lists > Public > public-qt-comments@w3.org > January 2008

[Bug 5445] [XPath] Undocumented incompatibility with compatibility mode "true" for general comparison involving boolean

From: <bugzilla@wiggum.w3.org>
Date: Thu, 31 Jan 2008 20:25:20 +0000
To: public-qt-comments@w3.org
Message-Id: <E1JKfyK-0006Yi-MA@wiggum.w3.org>


           Summary: [XPath] Undocumented incompatibility with compatibility
                    mode "true" for general comparison involving boolean
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
               URL: http://www.w3.org/TR/xpath20/#id-general-comparisons
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P5
         Component: XPath
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: zongaro@ca.ibm.com
         QAContact: public-qt-comments@w3.org

According to section 3.5.2 of XPath 2.0,[1] if "XPath 1.0 compatibility mode is
true and... either operand is a single atomic value that is an instance of
xs:boolean, then the other operand is converted to xs:boolean by taking its
effective boolean value."

Thus, with compatibility mode true, the result of evaluating the expression
"true() > number('0.5')" is false, while the result of "true() = number('0.5')"
would be true.

According to section 3.4 of XPath 1.0,[2] if one operand of an = or != operator
is xs:boolean and the other is not a node-set, the other operand is converted
to xs:boolean; if the operator is <, <=, > or >=, and neither operand is a
node-set, both are converted to numbers.  Thus, in XPath 1.0 the result of
evaluating "true() > number('0.5')" is true, and the result of "true() =
number('0.5')" is also true.

The list of incompatibilities with compatibility mode true in section I.1 of
XPath 2.0,[3] as modified by erratum XP.E2,[4] does not mention this

[1] http://www.w3.org/TR/xpath20/#id-general-comparisons
[2] http://www.w3.org/TR/xpath#booleans
[3] http://www.w3.org/TR/xpath20/#id-incompat-in-true-mode
[4] http://www.w3.org/XML/2007/qt-errata/xpath20-errata.html#E2
Received on Thursday, 31 January 2008 20:25:32 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:35 UTC