XPath/XQuery head function

Summary

Returns the first member of an array, that is $array(1).

Signature

array:head(
$array as array(*)
) as item()*

Properties

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

Rules

The function returns first member of $array, that is the value of $array(1).

Examples

The expression array:head([5, 6, 7, 8]) returns 5.

The expression array:head([["a", "b"], ["c", "d"]]) returns ["a", "b"].

The expression array:head([("a", "b"), ("c", "d")]) returns "a", "b".

Error Conditions

A dynamic error occurs if $array is empty.