On Tue, Jun 22, 2010 at 2:03 PM, Adrian Herscu <adrian.her...@gmail.com> wrote: > 1. xsl variables: > > <xsl:variable name="sections" select="descendant::section" /> > > and then use this XPath expression instead > > xalan:nodeset($sections)[utils:dummy(true())][1] > > then the dummy() function will be called 4 times (while the output xml will > remain the same) !
I'm tempted to imagine, that Xalan might be trying to do as following (written as pseudo-code), for the above case: $node-set := xalan:nodeset($sections) for each node in $node-set do apply the filter [utils:dummy(true())][1] to the node in the node-set done Which I think will likely cause the expression, utils:dummy(true()) to be evaluated as many times as the number of nodes in the node-set. I think, to be able to evaluate utils:dummy(true()) only once, the processor needs to do some hard static analysis of the expression, which could an implementation constraint. -- Regards, Mukul Gandhi