This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2998 - fs:eq for string arguments ill-defined
Summary: fs:eq for string arguments ill-defined
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Jerome Simeon
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-10 17:30 UTC by Jens Teubner
Modified: 2006-04-03 21:24 UTC (History)
0 users

See Also:


Attachments

Description Jens Teubner 2006-03-10 17:30:46 UTC
The semantics for equality testing of strings (fs:eq(string,string)) appears to be wrong (http://www.w3.org/TR/2005/CR-xquery-semantics-20051103/#sec_operators):

 fs:eq(A as xs:string, B as xs:string) --> op:numeric-equal(fn:compare(A, B), 1)

fn:compare(string,string), however, is supposed to return 0 (not 1) if both arguments are equal.

fs:ne() has the analogous problem.
Comment 1 Jerome Simeon 2006-03-14 17:07:20 UTC
I agree this is a bug, and a good catch at that. The following two lines in the operators mapping table:

fs:eq(A, B) | xs:string | xs:string | op:numeric-equal(fn:compare(A, B), 1) ...
and
fs:ne(A, B) | xs:string | xs:string | fn:not(op:numeric-equal(fn:compare(A, B), 1)) ...

should be changed to:

fs:eq(A, B) | xs:string | xs:string | op:numeric-equal(fn:compare(A, B), 0) ...
and
fs:ne(A, B) | xs:string | xs:string | fn:not(op:numeric-equal(fn:compare(A, B), 0) ...

respectively.

Thanks for the comment.
- Jerome
Comment 2 Jim Melton 2006-04-03 21:00:01 UTC
This is the official response from the XML Query WG and the XSL WG.  The solution proposed in comment #1 was agreed and will be made to the Formal Semantics document.  Consequently, this bug is marked as FIXED. 

If this meets with your approval, you should mark the bug CLOSED.  If the bug is not marked CLOSED and we do not receive a response from you within two weeks, then we will assume that you do not object and we will mark the bug CLOSED. 
Comment 3 Jens Teubner 2006-04-03 21:24:37 UTC
Thanks for fixing this.  The solution seems ok to me.