This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
These tests compare () with a non-node item, and expect the error XPTY0004; but the specs say: 3.5.3 Node Comparisons ... If either operand is an empty sequence, the result of the comparison is an empty sequence, and the implementation need not evaluate the other operand or apply the operator. However, an implementation may choose to evaluate the other operand in order to determine whether it raises an error. So an implementation may not see the "1" as the second operand, and report () as the result. The queries should be rewritten as "(() is 1) eq ()" in order to avoid an empty file as result, and expect either XPTY0004 as an error or "true" as result
Hi Alberto, I believe you are correct in that these tests are wrong, that they can evaluate successfully as well. Actually, K-NodeSame-1, K-NodeBefore-1 and K-NodeAfter-1 have the same error, they just have their operands in the opposite order. However, I doubt the proposed solution, (() is 1) eq (), would work because, '() eq ()' doesn't evaluate to "true", but to the empty sequence. See 3.5.1 Value Comparisons, the second bullet point. I think a correct fix is: empty(() is 1) Nevertheless, I could of course very well be wrong on this, so feel free to comment. Frans
Hi Frans, you are right on the behavior of 'eq'; you can choose to use empty(), or you can choose to do 'instance of empty-sequence()'. Either way should work fine. Thanks, Alberto
Fixed in CVS. Thanks for reporting this. Frans
Since this report was resolved as suggested, I am changing status to CLOSED. Feel free to reopen if the resolution was incorrectly implemented, for example. Frans