Processes every key/value pair in a map by applying the given function, returning the results as a sequence in unpredictable order.

for-each($map as map(*), $action as function($key as xs:anyAtomicType, $value as item()*)) ➔ item()*





The input map



function($key as xs:anyAtomicType, $value as item()*)

The function to be applied




Links to W3C specifications

XPath 3.1 Functions and Operators

XSLT 3.0 Specification

Saxon availability

Available in XPath 3.1, XSLT 3.0, and XQuery 3.1. Requires Saxon-PE or Saxon-EE. Implemented since Saxon 9.6.

Notes on the Saxon implementation

Available as defined in XSLT 3.0 since Saxon 9.6, replacing the previously available function map:for-each-entry (which was available since Saxon 9.4). Available in XSLT, XPath, and XQuery, whether or not 3.0 is available.

XPath 3.1 version implemented since Saxon 9.7.