Recently we've seen a code like this:
<xsl:variable name="a" as="element()?" select="..."/> <xsl:variable name="b" as="element()?" select="..."/> <xsl:apply-templates select="$a"> <xsl:with-param name="b" tunnel="yes" as="element()" select="$b"/> </xsl:apply-templates>
It fails with an error: "An empty sequence is not allowed as the value of parameter $b".
What is interesting is that the value of $a is an empty sequence, so the code could potentially work, provided processor evaluated $a first, and decided not to evaluate xsl:with-param.
Whether the order of evaluation of @select and xsl:with-param is specified by the standard or it's an implementation defined?
We asked this question on xslt forum, and got the following answer:
The specification leaves this implementation-defined. Since the values of the parameters are the same for every node processed, it's a reasonably strategy for the processor to evaluate the parameters before knowing how many selected nodes there are, though I guess an even better strategy would be to do it lazily when the first selected node is found.
Well, that's an expected answer. This question will probably induce Michael Kay to introduce a small optimization into the Saxon.
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u