Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
Document Order and Duplicates
There are three kinds of expression in XPath 2.0 whose result is always guaranteed to be a sequence of nodes in document order, with no duplicates. They are all covered in this chapter. Specifically, they are:
The elimination of duplicates is always based on node identity, not value.
Many simple path expressions naturally return results in document order anyway and would never select duplicates. In these cases, the system doesn't have to do any extra work to satisfy this rule. For example, any path expression that does downward selection using the child axis will naturally retrieve the nodes in document order. But it's easy to come up with path expressions that don't have this property; for example,
following-sibling::*/..
selects the parents of all the following siblings, and of course they all have the same parent, so after eliminating duplicates this expression returns at most a single node.