## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## 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:float` and `xs:double` values, positive zero and negative zero are considered equal. Also, if there are numbers with the value `NaN` (not a number), only one of those values will be in the result sequence.

• When comparing `xs:date`, `xs:dateTime`, and `xs:time` values, if those values don’t have a timezone component, their timezone is considered to be the timezone returned by the `implicit-timezone()` function. Also be aware that `xs:date`, `xs:dateTime`, and `xs:time` values can be equal even ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required