In Saxon-SA, when an index is used to support a path expression such as doc('a.xml')/a/b/c[@d=$x], the results may be returned without sorting into document order and removing duplicates. This happens if the path expression is one that is not "naturally sorted", that is, where an explicit sort would normally be required.
This will be fixed in a patch release.
There are also cases where such expressions are not indexed when they could be. This will also be fixed.
(OptimizerSA methods tryToConvertFilterExpressionToKey and convertFilterExpressionToKey respectively).