Name
[2.0] distinct-values()
Given a sequence, returns a new sequence containing one copy of each unique value in the original sequence.
Syntax
xs:anyAtomicType*distinct-values(xs:anyAtomicType*)xs:anyAtomicType*distinct-values(xs:anyAtomicType*,$collation as xs:string)
Inputs
A sequence of atomic values. distinct-values() also has an
optional argument specifying a collation algorithm. If present,
the collation algorithm is used to determine whether two values
are different from each other.
Output
A sequence containing only one copy of each atomic value in the original sequence. Some minor complications are as follows:
When
distinct-values()returns its result sequence, the order in which the unique values are returned is implementation-defined. Also, within a group of values that have the same value, which value is returned is implementation-defined.If the input sequence is the empty sequence, the empty sequence is returned. Passing the empty sequence to
distinct-values()does not raise an error.When comparing
xs:floatandxs:doublevalues, positive zero and negative zero are considered equal. Also, if there are numbers with the valueNaN(not a number), only one of those values will be in the result sequence.When comparing
xs:date,xs:dateTime, andxs:timevalues, if those values don’t have a timezone component, their timezone is considered to be the timezone returned by theimplicit-timezone()function. Also be aware thatxs:date,xs:dateTime, andxs:timevalues can be equal even ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access