[Bug 4855] [XPath] Undocumented incompatibility

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





------- Comment #3 from zongaro@ca.ibm.com  2007-11-13 17:04 -------
According to comment #0, "-@x|@y in XPath 1.0 returns -3, but in XPath 2.0
(without static type checking) returns 3."  However, I believe that in XPath
2.0, if compatibility mode is true, evaluating the expression -@x|@y, given the
indicated context node, results in a type error.  According to section 3.4,[1]
in compatibility mode, "If the atomized operand is an empty sequence, the
result of the arithmetic expression is the xs:double value NaN."  So the result
of -@x is NaN in this case.  According to 3.3.3,[2] "If an operand of union, 
intersect, or except contains an item that is not a node, a type error is 
raised [err:XPTY0004]," so -@x|@y results in a type error.

If compatibility mode is false, -@x will result in an empty sequence, so I 
believe the result of -@x|@y will be a sequence containing the attribute 
node "y", rather than the value 3.

Received on Tuesday, 13 November 2007 17:04:52 UTC