This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The summary of this function does not describe how to compare values of type xs:untypedAtomic. In contrast, fn:distinct-values says "Values of type xs:untypedAtomic are compared as if they were of type xs:string." There are similar phrases covering fn:sum, fn:min, fn:max and fn:avg. Should this phrase be added to fn:index-of?
I think the phrase: The items in the sequence $seqParam are compared with $srchParam under the rules for the eq operator makes it unambiguous. Michael Kay (personal response)
Fair point. The reason we came across this was because under the Formal Semantics normalization for function calls, we get: fn:index-of($seqParam as xs:anyAtomicType*, $srchParam as xs:anyAtomicType) fn:index-of( fs:convert-simple-operand( fs:data($seqParam as xs:anyAtomicType*), PrototypicalValue(xs:anyAtomicType)) fs:convert-simple-operand( fs:data($srchParam as xs:anyAtomicType*)), PrototypicalValue(xs:anyAtomicType))) I haven't found a definition for the PrototypicalValue for xs:anyAtomicType. (The spec does define it as an xs:double for numeric arguments). Our resolution has been to choose the PrototypicalValue based on whether we are dealing with avg, min, max, sum (treat as xs:double) or index-of, distinct-values (treat as xs:string).
I think I agree with both Tim and Michael, if they allow me. The fact that the definition relies on eq makes it unambiguous. i.e., xs:untypedAtomic gets cast to xs:string. It would be worth spelling it out explicitely as all other functions do (fn:index-of seems to be quite similar to fn:distinct-values to that respect). So using xs:string for the PrototypicalValue as Tim suggests in his last comment is the right thing to do here. - Jerome
Closing bug because commenter has not objected to the resolution posted and more than two weeks have passed.