Subject: Re: null call of document function
From: Steve <subsume@xxxxxxxxx>
Date: Mon, 9 Apr 2007 09:49:44 -0400
|
Ah-ha. Wow, what a nightmare debugging session you have saved me. Thanks.
-S
On 4/9/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>
> Could you elaborate on the phrase "optimize away"? I
> understood it all up until there.
If you write an expression and the result isn't used, the XSLT processor is
likely to generate code that doesn't actually evaluate the expression:
that's what I mean by optimizing it away. The same effect can occur at
run-time. For example, if you write
<xsl:if test="doc('a.xml') | doc('b.xml')">
then the xsl:if is testing whether the union of the two calls on doc() is
non-empty. There's a very good chance that the XSLT processor will evaluate
the first call, and if the result is non-empty it will decide that the test
is true and won't bother evaluating the second call on doc(). Which means
that if you're relying on side-effects caused by this call, you're going to
be disappointed.
Michael Kay
http://www.saxonica.com/
|