Functions that operate on arrays
array:append($array as array(*), $appendage as item()*) as array(*)
Returns an array containing all the members of the supplied array, plus one additionalmember at the end.
$array | The array |
$appendage* | The items to append |
array:filter($array as array(*), $function as function(*)) as array(*)
Returns an array containing those members of the $array for which $function returns true.
$array | The array to process |
$function | The function called on each member of the array |
array:flatten($input as item()*) as item()*
Replaces an array appearing in a supplied sequence with the members of the array, recursively.
$input* | The sequence to flatten |
array:fold-left($array as array(*), $zero as item()*, $function as function(*)) as item()*
Evaluates the supplied function cumulatively on successive values of the supplied array.
$array | The array to process |
$zero* | Start value |
$function | The function to call |
array:fold-right($array as array(*), $zero as item()*, $function as function(*)) as item()*
Evaluates the supplied function cumulatively on successive values of the supplied array.
$array | The array to process |
$zero* | Start value |
$function | The function to call |
array:for-each($array as array(*), $function as function(*)) as array(*)
Returns an array whose size is the same as array:size($array), in which each member is computed by applying $function to the corresponding member of $array.
$array | The array to process |
$function | The function called on each member of the array |
array:for-each-pair($array1 as array(*), $array2 as array(*), $function as function(*)) as array(*)
Returns an array obtained by evaluating the supplied function once for each pair of members at the same position in the two supplied arrays.
$array1 | The first array to process |
$array2 | The second array to process |
$function | The function to call for each pair |
array:get($array as array(*), $index as xs:integer) as item()*
Gets the value at the specified position in the supplied array (counting from 1). This is the same as calling $array($index).
$array | The array |
$index | The index |
array:head($array as array(*)) as item()*
Returns the first member of an array, i.e. $array(1)
$array | The array |
array:insert-before($array as array(*), $position as xs:integer, $member as item()*) as array(*)
Returns an array containing all the members of the supplied array, with one additional member at a specified position.
$array | The array |
$position | Position at which the new member is inserted |
$member* | The member to insert |
array:join($arrays as array(*)*) as array(*)
Concatenates the contents of several arrays into a single array
$arrays* | The arrays to join |
array:put($array as array(*), $position as xs:integer, $member as item()*) as array(*)
Returns an array containing all the members of the supplied array, with one additional member at the specified position.
$array | The array |
$position | Position at which the new member is inserted |
$member* | The member to insert |
array:remove($array as array(*), $positions as xs:integer*) as array(*)
Returns an array containing all the members of the supplied array, except for the members at specified positions.
$array | The array |
$positions* | Positions of the members to remove |
array:reverse($array as array(*)) as array(*)
Returns an array containing all the members of the supplied array, but in reverse order.
$array | The array |
array:size($array as array(*)) as xs:integer
Returns the number of members in the supplied array.
$array | The array |
array:sort($array as array(*)) as array(*)
Returns an array containing all the members of the supplied array, sorted according to their typed value
$array | The array to process |
array:sort($array as array(*), $collation as xs:string?) as array(*)
Returns an array containing all the members of the supplied array, sorted according to the value of a sort key supplied as a function.
$array | The array to process |
$collation? | The collation to use for sorting |
array:sort($array as array(*), $collation as xs:string?, $key as function(*)) as array(*)
Returns an array containing all the members of the supplied array, sorted according to the value of a sort key supplied as a function.
$array | The array to process |
$collation? | The collation to use for sorting |
$key | A function called for each array member which produces a sort key |
array:subarray($array as array(*), $start as xs:integer) as array(*)
Gets an array containing all members from a supplied array starting at a supplied position, up to the end of the array
$array | The array |
$start | The start index |
array:subarray($array as array(*), $start as xs:integer, $length as xs:integer) as array(*)
Gets an array containing all members from a supplied array starting at a supplied position, up to a specified length.
$array | The array |
$start | The start index |
$length | Length of the subarray |
array:tail($array as array(*)) as array(*)
Returns an array containing all members except the first from a supplied array.
$array | The array |