Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 280555

Summary: [xpath2] fn:compare returns XPST0017
Product: [WebTools] WTP Source Editing Reporter: David Carver <d_a_carver>
Component: wst.xpathAssignee: Jesper Moller <jesper>
Status: RESOLVED FIXED QA Contact: David Carver <d_a_carver>
Severity: normal    
Priority: P2    
Version: 3.1   
Target Milestone: 3.2 M2   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 287369    
Attachments:
Description Flags
Patch which adds collation support for fn:compare
none
Finished patch none

Description David Carver CLA 2009-06-16 22:29:06 EDT
Psychopath currently does not implement collation argument.

http://www.w3.org/TR/xpath-functions/#func-compare
Comment 1 Jesper Moller CLA 2009-08-24 17:24:48 EDT
Created attachment 145487 [details]
Patch which adds collation support for fn:compare

This adds the collation for use in fn:compare, but...

To be compliant with the XPath2 spec, we need to make the lt, gt and eq operators, etc. use the current/default collation, and to do that we need to push the dynamic context through the CmpEq etc. interfaces. Ugly, yes, but the alternative would be ThreadLocal which I think is worse. Please comment!
Comment 2 David Carver CLA 2009-08-24 18:42:35 EDT
(In reply to comment #1)
> Created an attachment (id=145487) [details]
> Patch which adds collation support for fn:compare
> 
> This adds the collation for use in fn:compare, but...
> 
> To be compliant with the XPath2 spec, we need to make the lt, gt and eq
> operators, etc. use the current/default collation, and to do that we need to
> push the dynamic context through the CmpEq etc. interfaces. Ugly, yes, but the
> alternative would be ThreadLocal which I think is worse. Please comment!
> 

My first goal is compliance to the spec.  So, feel free to iterate on a clean implementation that makes lt, gt, and eq for strings behave as they should.   All of that code it is touching I believe is in internal packages so should be fairly safe to refactor as needed.
Comment 3 Jesper Moller CLA 2009-09-02 16:16:44 EDT
Created attachment 146320 [details]
Finished patch

Patch provides:
- Collation support in the dynamic context
- Added collation argument to compare
- Collation sensitivity in string operators
Comment 4 Jesper Moller CLA 2009-09-02 16:24:08 EDT
Committed to HEAD