Project

Profile

Help

Bug #3450

closed

Sorting a heterogeneous sequence

Added by Michael Kay over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2017-09-18
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.8
Fix Committed on Branch:
9.8
Fixed in Maintenance Release:
Platforms:

Description

The spec says (in both XSLT 2.0 and 3.0)

[ERR XTDE1030] It is a dynamic error if, for any sort key component, the set of sort key values evaluated for all the items in the initial sequence, after any type conversion requested, contains a pair of ordinary values for which the result of the XPath lt operator is an error. If the processor is able to detect the error statically, it may optionally signal it as a static error.

So, for example, sorting a sequence that contains a mix of xs:untypedAtomic and xs:date values should be a type error.

This should also be an error under the rules of XQuery "order by" (where it raises XPTY0004), and under the rules of the fn:sort() function.

It seems that Saxon has never raised an error in this situation: instead the comparison it uses to compare items in the sequence uses the rules of the "general comparison" operators, by converting xs:untypedAtomic to the type of the other value.

Fixing this problem may cause existing applications to fail. I have therefore decided not to fix it until the next major release after 9.8.

Please register to edit this issue

Also available in: Atom PDF