fn:count

fn:count(
   $arg as item()*,
   [$maximum as xs:double?]
) as xs:integer

Summary

Returns the number of items in the value of $arg.

Returns 0 if $arg is the empty sequence.

Parameters
arg The sequence of items to count.
maximum The maximum value of the count to return. MarkLogic Server will stop count when the $maximum value is reached and return the $maximum value. This is an extension to the W3C standard fn:count function.

Example

Assume:
$seq1 = ($item1, $item2)
$seq3 = (), the empty sequence

Then:

fn:count($seq1) returns 2.

fn:count($seq3) returns 0.

Assume $seq2 = (98.5, 98.3, 98.9).

Then:

fn:count($seq2) returns 3.
fn:count($seq2[. > 100]) returns 0.
Powered by MarkLogic Server | Terms of Use | Privacy Policy