XPath/XQuery get function

Summary

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).

Examples

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

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

Error Conditions

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