xsl:fork

The result of the xsl:fork instruction is the sequence formed by concatenating the results of evaluating each of its contained instructions, in order.

Category: instruction
Content: ( xsl:fallback* , ( ( xsl:sequence , xsl:fallback* )* | ( xsl:for-each-group , xsl:fallback* ) ) )
Permitted parent elements: any XSLT element whose content model is sequence-constructor; any literal result element
Element has no attributes

Notes on the Saxon implementation

The instruction is pointless when not streaming, but it is still supported.

Fully implemented since Saxon 9.7. Streaming of xsl:for-each-group, as a child of xsl:fork, with a group-by attribute was introduced in 9.7 maintenance releases and is fully supported in Saxon 9.8.

In Saxon 9.6, the instruction was implemented with restrictions: specifically, the content of xsl:fork must consist of a sequence of xsl:sequence instructions, and can not include xsl:for-each-group elements.

The Saxon 9.6 implementation of xsl:fork in streaming mode does not actually use multiple threads: rather, the events notified by the XML parser (such as startElement and endElement) are notified to each prong of the xsl:fork in turn. Each prong accumulates its result in a temporary tree held in memory, and these temporary trees are combined on completion. The instruction is most effective when each prong consists of a call to xsl:result-document; in this case the output can immediately be serialized, leaving no temporary data in memory.

Links to W3C specifications

XSLT 3.0 Specification

See also

xsl:fallback