exactly-one function
The fn:exactly-one function returns its argument if the argument contains exactly one item.
Syntax
- sequence-expression
- Any sequence, including the empty sequence.
Returned value
If sequence-expression contains exactly one item, sequence-expression is returned. Otherwise, an error is returned.
Example
The following example uses the exactly-one function to determine whether the sequence in variable $seq contains exactly one item.
let $seq := 5
return fn:exactly-one($seq)
The value 5 is returned.