6.6.4.2 Document Order

The results returned by an XPath query may reflect the document order of the elements returned if no order by clause is specified (see 6.6.3.5 Ordering Specifier, above).

Support for this is optional, since some implementations (notably, database-backed ones) will not have a notion of document order.

If document order searching is supported, then the context functions related to document order, last() and position(), must also be supported.

Repository.getDescriptor(QUERY_XPATH_DOC_ORDER) returning “true” indicates that document order searching is supported.