saxon:compose

Returns a function item that combines the effect of several supplied functions.

compose($stylesheet as (function(item()*) as item()*)+) ➔ function(item()*) as item()*

Arguments

 

$stylesheet

(function(item()*) as item()*)+

A sequence of arity-one function items

Result

function(item()*) as item()*

Namespace

http://saxon.sf.net/

Saxon availability

Requires Saxon-PE or Saxon-EE. Available for all platforms.

Notes on the Saxon implementation

Available since Saxon 13.

Details

This function combines a number of arity-one functions into a single arity-one function. The effect of the composed functions is to evaluate the first function with the supplied argument value, then to evaluate the second function applied to the result of the first, and so on.

For example, let $f := saxon:compose((is-NaN#1, not#1)) binds $f to a function such that $f($x) is true if $x is not NaN. It is logically equivalent to fn($x){ is-NaN($x) => not() }.

Similarly, let $f := saxon:compose((1 to 3) ! fn{..}) binds $f to a function that selects the great-grandparent of a node (that is, it applies the parent axis three times).