[Bug 7630] New: [FO] There is no formal definition of the Unicode codepoint collation

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

           Summary: [FO] There is no formal definition of the Unicode
                    codepoint collation
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators
        AssignedTo: mike@saxonica.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


The specification contains no formal definition of the Unicode codepoint
collation http://www.w3.org/2005/xpath-functions/collation/codepoint

A suitable definition might be:

declare function compare-seq($x as xs:integer*, $y as xs:integer*) as
xs:integer {
   if (count($x) eq 0 or count($y) eq 0) 
   then if (count($x) eq 0 and count($y) eq 0)
        then 0
        else if (count($x) eq 0) then -1 else +1
   else if ($x[1] eq $y[1])
        then compare-seq(remove($x, 1), remove($y, 1))
        else if ($x[1] lt $y[1]) then -1 else +1
}

and then compare($X as xs:string, $Y as xs:string) under the Unicode codepoint
collation is defined to have the result compare-seq(string-to-codepoints($X),
string-to-codepoints($Y)).

Problem raised by Patrick Durusau (patrick at durusau dot net) on
public-qt-comments, 2 Sept 2009.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 15 September 2009 14:09:03 UTC