This document describes the namespace
http://www.w3.org/2005/xpath-functions/array
defined by the
[XPath and XQuery Functions and Operators 3.1]
specification.
This namespace is conventionally identified by the namespace prefix array
.
This prefix is not pre-declared in XQuery 3.1.
For updated information, please refer to the latest version of the
[XPath and XQuery Functions and Operators 3.1] specification.
This document describes the names that are defined in this namespace at the time of publication. The W3C reserves the right to define additional names in this namespace in the future. [XPath and XQuery Functions and Operators 3.1] is the only specification that may amend this namespace.
This document contains a directory of links to related resources, using RDDL (as defined in [Resource Directory Description Language (RDDL)]).
It is GRDDL-enabled (as defined in [Gleaning Resource Descriptions from Dialects of Languages (GRDDL)]), that is to say that a GRDDL-compliant processor can extract useful RDF (as defined in [Resource Description Framework (RDF): Concepts and Abstract Syntax]) representations of the information contained herein.
This section lists all of the functions defined by the [XPath and XQuery Functions and Operators 3.1] specification to be in the namespace reserved for certain array-related functions.
Functions are uniquely identified by the combination of namespace URI, local name,
and arity (number of arguments). For the
purpose of this document, functions having a common namespace URI and local name can
be considered to
form a function family. A
function family can be uniquely identified with a URI of the form:
“http://www.w3.org/2005/xpath-functions/array#
name”
where name is the local name of a function, such as
“sort”: http://www.w3.org/2005/xpath-functions/array#sort
.
The normative definitions of these functions are in the [XPath and XQuery Functions and Operators 3.1] specification. For convenience, a very brief, non-normative summary of each function is provided. For details, follow the link on the “Summary:” introductory text below each function.
append(array(*), item()*) as array(*)
Returns an array containing all the members of a supplied array, plus one additional member at the end.
filter(array(*), function(item()*) as xs:boolean) as array(*)
Returns an array containing those members of the $array
for which
$function
returns true.
flatten(item()*) as item()*
Replaces any array appearing in a supplied sequence with the members of the array, recursively.
fold-left(array(*), item()*, function(item()*, item()*) as item()*) as item()*
Evaluates the supplied function cumulatively on successive members of the supplied array.
fold-right(array(*), item()*, function(item()*, item()*) as item()*) as item()*
Evaluates the supplied function cumulatively on successive values of the supplied array.
for-each(array(*), function(item()*) as item()*) 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
.
for-each-pair(array(*), array(*), function(item()*, item()*) as item()*) 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.
get(array(*), xs:integer) as item()*
Returns the value at the specified position in the supplied array (counting from 1).
head(array(*)) as item()*
Returns the first member of an array, that is $array(1)
.
insert-before(array(*), xs:integer, item()*) as array(*)
Returns an array containing all the members of the supplied array, with one additional member at a specified position.
join(array(*)*) as array(*)
Concatenates the contents of several arrays into a single array.
put(array(*), xs:integer, item()*) as array(*)
Returns an array containing all the members of a supplied array, except for one member which is replaced with a new value.
remove(array(*), xs:integer*) as array(*)
Returns an array containing all the members of the supplied array, except for the members at specified positions.
reverse(array(*)) as array(*)
Returns an array containing all the members of a supplied array, but in reverse order.
size(array(*)) as xs:integer
Returns the number of members in the supplied array.
sort(array(*)) as array(*)
sort(array(*), xs:string?) as array(*)
sort(array(*), xs:string?, function(item()*) as xs:anyAtomicType*) 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.
subarray(array(*), xs:integer) as array(*)
subarray(array(*), xs:integer, xs:integer) as array(*)
Returns an array containing all members from a supplied array starting at a supplied position, up to a specified length.
tail(array(*)) as array(*)
Returns an array containing all members except the first from a supplied array.
These documents describe the names that are defined in this namespace at the time of publication. The W3C reserves the right to define additional names in this namespace in the future.
XQuery and XPath Functions and Operators 3.1 (21 March 2017 version)
Resource Directory Description Language (RDDL) (4 July 2007)
Gleaning Resource Descriptions from Dialects of Languages (GRDDL) (Recommendation of 11 September 2007)
Resource Description Framework (RDF): Concepts and Abstract Syntax (Recommendation of 10 February 2004)