Dimitry Voytenko wrote:
>It looks like [is-last() optimization] could be advantageous for many
>queries (especially for sql extension in streaming mode). XPath
>expressions (sub-expressions) of view:
> position() ? last(), where "?" is =, !=, <, >, etc,
>can be easily optimized (org.apache.xpath.compiler.Compiler class) into
>the call to the internal "is-last()" function. Simpliest (or caching)
>iterators can implement this call just as "position() ? last()". And
>more complicated implementations would require (in the worst
>case) caching of only one (next) node.
Simplest of all is position() > last(), which is always false.
Therefore, position() <= last() is always true. :}
And position() >= last() reduces to position() = last().
And position() < last() is the same as position() != last().
We're on a roll!
.................David Marston