[Bug 3433] Comparing xs:anyURI values

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

           Summary: Comparing xs:anyURI values
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XPath
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


Is the following expression permitted?

xs:anyURI("http://a.com/") lt xs:anyURI("http://b.com/")

The rules for ValueComparison say: 

"Next, if possible, the two operands are converted to their least common type
by a combination of type promotion and subtype substitution. ... Finally, if
the types of the operands are a valid combination for the given operator, the
operator is applied to the operands."

Type promotion has no effect because the least common type is xs:anyURI. There
is no entry in the operator mapping table for appling the "lt" operator to two
xs:anyURI values.  So the above expression appears to be illegal.

This is unfortunate. It blows a hole in transitivity, since it is legal to
compare an xs:anyURI with a string. It means that max((Uri1, Uri2)) is an
error, whereas max((Uri1, Uri2, "")) might or might not succeed depending on
the sequence of evaluation. 

Proposed change: value comparisons should promote xs:anyURI arguments
unconditionally to strings, regardless of the type of the other operand.

Alternative (equivalent): add entries in the operator mapping table to do order
comparison on xs:anyURI values.

XSLT test case sort144 applies.

Received on Thursday, 6 July 2006 08:54:48 UTC