XPath/XQuery size function

Summary

Returns the number of members in the supplied array.

Signature

array:size(
$array as array(*)
) as xs:integer

Properties

This function is deterministic, context-independent, and focus-independent.

Rules

If $array is empty the function returns zero.

Otherwise, the function returns the number of members in $array.

Examples

The expression array:size(["a", "b", "c"]) returns 3.

The expression array:size(["a", ["b", "c"]]) returns 2.

The expression array:size([ ]) returns 0.

The expression array:size([[ ]]) returns 1.

Notes

Note that because an array is an item, the fn:count function when applied to an array always returns 1 (one).