RE: [xsl] Saxon and HashMap/Hashtable

Subject: RE: [xsl] Saxon and HashMap/Hashtable
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Fri, 13 Jul 2001 15:27:33 +0100
> Are there any other alternative so you can evaluate
> the Java and not output it to the result document?

I think that if an external function produces no result, or if the result is
not used in any way in the subsequent computation, then it's very hard to
find a way of calling it that is guaranteed not to be "optimized out".

A mechanism that should be fairly foolproof is to wrap the call inside a
call of another extension function that always returns an empty string, and
then output that string:

<xsl:value-of select="my:call(hashtable:put($a, $b))"/>

There's no way the XSLT processor can know that my:call() always returns an
empty string, so it can't really avoid doing the inner function call.
There's still no guarantee of when it does the function call, but most
processors in practice are going to execute a sequence of output
instructions sequentially.

I'm not sure if this would work for a function whose return type is void,
but fortunately that isn't the case here.

Mike Kay

 XSL-List info and archive:

Current Thread