# Extensions

A new extension is introduced to allow maps to be maintained. A map is a dictionary data structure that maps atomic values to arbitrary XDM sequences. The map can be built incrementally, but it is immutable (as with operations on sequences, adding an entry to a map creates a new map, leaving the existing map unchanged). The implementation optimizes this behind the scenes to avoid rebuilding the map from scratch each time an entry is added, and to allow memory to be shared. For details see The map extension.

This facility is particularly useful in streaming transformations in conjunction with `xsl:iterate`, as it allows arbitrary information to be "remembered" for later use during the course of a streaming pass through the source document.

A new extension function `current-mode-name()` is introduced for use in XSLT, returning the name of the current mode as a QName.

In XSLT, the extension attribute `saxon:threads` is introduced on `xsl:for-each` to allow items in the input sequence to be processed in parallel, using the specified number of threads. Multithreading will be used only when requested; it can also be suppressed at the Configuration level, and it is disabled when a stylesheet is compiled with tracing enabled, because the trace output would otherwise be unintelligible.

Next