Bug #2151

Dynamic type of the result of min()/max()

Added by Michael Kay over 5 years ago. Updated about 4 years ago.

XPath conformance
Start date:
Due date:
% Done:


Legacy ID:
Applies to branch:
9.5, 9.6
Fix Committed on Branch:
Fixed in Maintenance Release:


The rules for the dynamic type of the result of min()/max() are rather strange, and not correctly implemented by Saxon, in 9.5 and all earlier releases.

The rules say that numeric and xs:anyURI values should be converted to the "least common type" present in the sequence. But Saxon is applying this rule to all types, for example to strings. So if the input contains a mix of xs:NCName and xs:ID values, the result according to the spec should be either an NCName or an ID, but Saxon actually returns a value belonging to the common supertype.

It doesn't help that the rule has been changed a number of times: it's written differently in XPath 2.0, 3.0, and 3.1, and there is also an erratum in this area. However, it's dealing with an edge case that will affect few users.

The function has been reimplemented in 9.6 to follow the rules correctly, and also to follow the stricter rules of the 3.1 draft specification. The change could/should be retrofitted, but it is not urgent.


#1 Updated by Michael Kay over 5 years ago

  • Status changed from New to Resolved

Closing this. It's fixed in 9.6 and we're not planning to fix it in 9.5. Note that the spec changes (slightly) in XPath 3.1.

#2 Updated by O'Neil Delpratt over 5 years ago

  • Status changed from Resolved to Closed
  • Fixed in version changed from 9.6 to

Bug fix applied in the Saxon maintenance release

#3 Updated by O'Neil Delpratt about 4 years ago

  • Sprint/Milestone set to
  • Applies to branch 9.5, 9.6 added
  • Fix Committed on Branch 9.6 added
  • Fixed in Maintenance Release added

Please register to edit this issue

Also available in: Atom PDF