fn:count
Returns the number of items in a sequence.
Signature
fn:count($arg as item()*) as xs:integer
Properties
This function is deterministic, context-independent, and focus-independent.
Rules
The function returns the number of items in the value of $arg
.
Notes
Returns 0 if $arg
is the empty sequence.
Examples
let $seq1 := ($item1, $item2)
let $seq2 := (98.5, 98.3, 98.9)
let $seq3 := ()
The expression fn:count($seq1)
returns 2
.
The expression fn:count($seq3)
returns 0
.
The expression fn:count($seq2)
returns 3
.
The expression fn:count($seq2[. > 100])
returns 0
.
The expression fn:count([])
returns 1
.
The expression fn:count([1,2,3])
returns 1
.