John, I eliminated the need for the do/while duplicate check in
WalkingIterator#nextNode(). From the commit message:
Eliminate do/while check for duplicates in AxesWalker#nextNode()
by using WalkingIteratorSorted for cases where both the preceding[-sibling]
and following[-sibling] axes are being walked, and for "@*/foo" patterns
("@attr/foo" patterns still use WalkingIterator).
Hmm... come to think of it, I think we have a rather nasty problem with the
UnionPathIterator. What the UnionPathIterator does is maintain multiple
iterators, on start advance each one to the next node, and then compare the
nodes to see which one should be returned in next document order.
Obviously this will not work when you are reusing nodes.
An optimization that I've badly wanted to do for a while is make a
UnionPathIteratorSimple that will take expressions such as select="foo |
baz | bar" that are on the same axes and are simple simple node tests, to
treat them as a series of match patterns on a single iteration. (Actually
I can probably make this work with more complex patterns, but first things
first.)
However, I probably can't get this done before I go on vacation next week,
as I have some XSL WG work that I have to get to, so for now at least you
might try throwing an exception (with good explanation message) if
isNodeAfter is called. I think UnionPathIterator will be the only place
you should run into as long as sorting isn't involved.
-scott