Sequence Functions
boolean
boolean($arg as item()*) as xs:boolean
Computes the effective boolean value of the argument.
count
count($arg as item()*) as xs:integer
Returns the number of items in a sequence.
count(('a', 'b', 'c')) → 3data
data($arg as item()*) as xs:anyAtomicType*
Returns the typed values of the items in $arg.
deep-equal
deep-equal($arg1 as item()*, $arg2 as item()*) as xs:boolean
Returns true if the two sequences are deep-equal.
distinct-values
distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType*
Returns the distinct values from a sequence, removing duplicates.
distinct-values((1, 2, 1, 3, 2)) → (1, 2, 3)empty
empty($arg as item()*) as xs:boolean
Returns true if the sequence is empty.
empty(()) → trueexactly-one
exactly-one($arg as item()*) as item()
Returns the argument if it contains exactly one item, otherwise raises an error.
exists
exists($arg as item()*) as xs:boolean
Returns true if the sequence is not empty.
index-of
index-of($seq as xs:anyAtomicType*, $search as xs:anyAtomicType) as xs:integer*
Returns the positions of $search in $seq.
index-of(('a', 'b', 'c', 'b'), 'b') → (2, 4)insert-before
insert-before($target as item()*, $position as xs:integer, $inserts as item()*) as item()*
Inserts items into a sequence at the given position.
last
last() as xs:integer
Returns the context size (number of items being processed).
one-or-more
one-or-more($arg as item()*) as item()+
Returns the argument if it contains one or more items, otherwise raises an error.
position
position() as xs:integer
Returns the context position.
remove
remove($target as item()*, $position as xs:integer) as item()*
Removes the item at $position from the sequence.
reverse
reverse($arg as item()*) as item()*
Returns the sequence in reverse order.
reverse((1, 2, 3)) → (3, 2, 1)sort
sort($input as item()*) as item()*
Returns the sequence sorted by value.
subsequence
subsequence($source as item()*, $start as xs:double) as item()*
subsequence($source as item()*, $start as xs:double, $length as xs:double) as item()*
Returns a contiguous subsequence starting at $start (1-based).
subsequence(('a', 'b', 'c', 'd'), 2, 2) → ("b", "c")unordered
unordered($source as item()*) as item()*
Returns the items in an implementation-dependent order (identity in goxpath).
zero-or-one
zero-or-one($arg as item()*) as item()?
Returns the argument if it contains zero or one items, otherwise raises an error.
true
true() as xs:boolean
Returns the boolean value true.
false
false() as xs:boolean
Returns the boolean value false.
not
not($arg as item()*) as xs:boolean
Returns the negation of the effective boolean value.