count function

The fn:count function returns the number of values in a sequence.

Syntax

Read syntax diagramSkip visual syntax diagramfn:count( sequence-expression)
sequence-expression
A sequence that contains items of any type, or an empty sequence.

Returned value

If sequence-expression is not the empty sequence, the number of values in sequence-expression is returned. If sequence-expression is the empty sequence, 0 is returned.

Example

The following function returns the number of items in the sequence (5, 1.0E2, 40.5):

fn:count((5, 1.0E2, 40.5))

The returned value is 3.