Dynamic type of the result of min()/max()
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.
Please register to edit this issue