Streaming Maps and Windows

xsl:fork feeds one streamed pass to several computations, and maps (xsl:map, xsl:map-entry) collect the results, since streamed nodes cannot be kept. A window is a run of adjacent items: group-adjacent and group-starting-with stream, as each group ends before the next begins. Run xslt3 -it -xsl:fork.xsl:

fork.xsl: two computations in one pass, collected in a mapXML
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xsl:output method="json" indent="yes"/>
  <xsl:template name="xsl:initial-template">
    <xsl:source-document href="../s2-15/orders.xml" streamable="yes">
      <xsl:map>
        <xsl:fork>
          <xsl:sequence><xsl:map-entry key="'copies'" select="sum(//@qty)"/></xsl:sequence>
          <xsl:sequence>
            <xsl:map-entry key="'per-day'">
              <xsl:map>
                <xsl:for-each-group select="orders/order" group-adjacent="@date">
                  <xsl:map-entry key="current-grouping-key()" select="count(current-group())"/>
                </xsl:for-each-group>
              </xsl:map>
            </xsl:map-entry>
          </xsl:sequence>
        </xsl:fork>
      </xsl:map>
    </xsl:source-document>
  </xsl:template>
</xsl:stylesheet>
Output
{
  "per-day": { "2026-09-29":3, "2026-10-01":1, "2026-09-30":2, "2026-09-28":2 },
  "copies": 13
}

Saxon-HE 726,956 printed its SXST0068 warning (hidden here). The JSON output loses key order. group-by cannot stream.

What Saxon-HE and Saxon-EE do with XSLT 3.0's advanced features
Feature Saxon-HE 12 Saxon-EE 12
streamable="yes" Ignored with SXST0068 Streams
Schema-aware XSLT, package export No Yes