[Bug 5290] Unclear meaning of "collation" in order-by clause

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

           Summary: Unclear meaning of "collation" in order-by clause
           Product: XPath / XQuery / XSLFO / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: chamberl@almaden.ibm.com
         QAContact: public-qt-comments@w3.org


In XQuery Section 3.8.3 (Order By and Return clauses), the "greater-than"
relationship between two ordering keys V and W, when a collation C is
specified, is defined by fn:compare(V, W, C). The document does not specify
that this definition applies only if the keys are strings. Consider the
following case:

order by $salary collation "fr-ca" 

If the type of $salary is xs:decimal, an error will result because fn:compare()
requires strings for its first two parameters, and xs:decimal is not promotable
to xs:string.

If this is really the behavior we want, we should add a note that says this
explicitly and designates the error code (XPST0017, No Such Function). If we
think this is a confusing and unhelpful error code, we should invent a new code
for this case. Alternatively, we could say that the collation applies only if
the ordering keys are valid operands of fn:compare (strings or promotable to
strings); otherwise the keys are compared using gt and the collation clause is
ignored.

Received on Tuesday, 27 November 2007 18:38:56 UTC