Re: [xsl] Need help with XSLT tokenize

Subject: Re: [xsl] Need help with XSLT tokenize
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Aug 2020 10:55:40 -0000
> What about XSLT 3's xsl:iterate? Isn't that, with its parameters that
> can change on each iteration step, close to a procedural, sequential loop?

I prefer to think of it as syntactic sugar for a functional fold operation, or
for a tail-recursive function. It means that processing the Nth item has a
functional dependency on processing the (N-1)th, but a functional dependency
is not quite the same as a defined order of execution.

For example, if the code did

<xsl:when test="self::H1">
  <xsl:next-iteration>
    <xsl:with-param name="pos" select="1"/>
  </xsl:next-iteration>
</xsl:when>

then a smart optimizer could work out that processing the item following an H1
doesn't depend on anything that went before, and could therefore be done in
parallel with processing of previous items. Unlike a loop, the functional
depenendency is explicit and it's therefore still possible in principle to
rearrange the order of execution.

Michael Kay
Saxonica

Current Thread