XPath/XQuery append function

Summary

Returns an array containing all the members of a supplied array, plus one additional member at the end.

Signature

array:append(
$array as array(*),
$appendage as item()*
) as array(*)

Properties

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

Rules

The result is an array whose size is array:size($array) + 1, in which all members in positions 1 to array:size($array) are the same as the members in the corresponding position of $array, and the member in position array:size($array) + 1 is $appendage.

The result is equivalent to the result of the expression op:array-concat( $array, [$appendage] ).

Examples

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

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

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