Applies the function item $f to every item from the sequence $seq in turn, returning the concatenation of the resulting sequences in order.

for-each($seq as item()*, $f as function(item()) as item()*) ➔ item()*





The input sequence: the supplied function will be applied to each item in this sequence



function(item()) as item()*

The function item to be invoked on each member of the supplied sequence



Links to W3C specifications


Applies to: XPath 3.0, XSLT 3.0, XQuery 3.0 (if enabled in Saxon: requires Saxon-PE or Saxon-EE)

XPath 3.0 Functions and Operators

Notes on the Saxon implementation

Available since Saxon 9.3 under the name fn:map. Requires XPath 3.0 to be enabled. In 9.5.1, in response to W3C spec changes, the function was renamed fn:for-each and the argument order was changed.