Manually increment XPath indexes.

This ensures that the index is only incremented for elements that match a node
test.