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

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5445

           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
incompatibility.

[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