This page was generated
January  28,  2016
4:08  AM
XQuery & XSLT Built-In & Modules Function Reference

Built-In: Higher-Order

The Higher-Order built-in functions are XQuery functions to support higher-order functions, and are part of the XQuery 3.0 working draft. They are defined in XPath and XQuery Functions and Operators 3.0.
Function Summary
fn:filter Returns those items from the sequence $seq for which the supplied function $function returns true.
fn:fold-left Processes the supplied sequence from left to right, applying the supplied function repeatedly to each item in turn, together with an accumulated result value.
fn:fold-right Processes the supplied sequence from right to left, applying the supplied function repeatedly to each item in turn, together with an accumulated result value.
fn:function-arity Returns the arity of the function(s) that the argument refers to.
fn:function-lookup Returns a function with the given name and arity, or the empty sequence if none exists.
fn:function-name Returns the QName of the function(s) that the argument refers to.
fn:head Returns the first item in a sequence.
fn:map Applies the function item $function to every item from the sequence $seq in turn, returning the concatenation of the resulting sequences in order.
fn:map-pairs Applies the function item $function to successive pairs of items taken one from $seq1 and one from $seq2, returning the concatenation of the resulting sequences in order.
fn:tail Returns all but the first item in a sequence.
Function Detail
fn:filter(
$function as function(item()) as xs:boolean,
$seq as item()*
)  as   item()*
Summary:

Returns those items from the sequence $seq for which the supplied function $function returns true. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$function : The function value.
$seq : The function value.

Example:

            

fn:fold-left(
$function as function(item()*, item()) as item()*,
$zero as item()*,
$seq as item()*
)  as   item()*
Summary:

Processes the supplied sequence from left to right, applying the supplied function repeatedly to each item in turn, together with an accumulated result value. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$function : The fold function value.
$zero : The zero argument.
$seq : The sequence to fold

Example:

            

fn:fold-right(
$function as function(item(), item()*) as item()*,
$zero as item()*,
$seq as item()*
)  as   item()*
Summary:

Processes the supplied sequence from right to left, applying the supplied function repeatedly to each item in turn, together with an accumulated result value. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$function : The fold function value.
$zero : The zero argument.
$seq : The sequence to fold

Example:

            

fn:function-arity(
$function as function(*)
)  as   xs:integer
Summary:

Returns the arity of the function(s) that the argument refers to. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$function : The function value.

Example:

            

fn:function-lookup(
$name as xs:QName,
$arity as xs:integer
)  as   function(*)?
Summary:

Returns a function with the given name and arity, or the empty sequence if none exists. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$name : The QName of the function.
$arity : The number of arguments the function takes.

Example:

            

fn:function-name(
$function as function(*)
)  as   xs:QName?
Summary:

Returns the QName of the function(s) that the argument refers to. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$function : The function value.

Example:

            

fn:head(
$seq as item()*
)  as   item()*
Summary:

Returns the first item in a sequence. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$seq : The function value.

Example:

            

fn:map(
$function as function(item()) as item()*,
$seq as item()*
)  as   item()*
Summary:

Applies the function item $function to every item from the sequence $seq in turn, returning the concatenation of the resulting sequences in order. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$function : The function value.
$seq : The function value.

Example:

            

fn:map-pairs(
$function as function(item(), item()) as item()*,
$seq1 as item()*,
$seq2 as item()*
)  as   item()*
Summary:

Applies the function item $function to successive pairs of items taken one from $seq1 and one from $seq2, returning the concatenation of the resulting sequences in order. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$function : The map function value.
$seq1 : The first sequence argument.
$seq2 : The second sequence argument.

Example:

            

fn:tail(
$seq as item()*
)  as   item()*
Summary:

Returns all but the first item in a sequence. For more details, see XPath 3.0 Functions and Operators.

Parameters:
$seq : The function value.

Example: