array:get

Returns the value at the specified position in the supplied array (counting from 1).

Signature

array:get(
    $array as array(*), 
    $position as xs:integer
) as item()*

Properties

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

Rules

The result is the value of $array($position).

Error Conditions

A dynamic error occurs [ERRFOAY0001] if $position is not in the range 1 to array:size($array) inclusive.

Examples

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

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