XPath/XQuery unordered function

Summary

Returns the items of $sourceSeq in an implementation-dependent order.

Signature

fn:unordered(
$sourceSeq as item()*
) as item()*

Properties

This function is nondeterministic-wrt-ordering, context-independent, and focus-independent.

Rules

The function returns the items of $sourceSeq in an implementation-dependent order.

Examples

The expression fn:unordered((1, 2, 3, 4, 5)) returns (1, 2, 3, 4, 5).

Notes

Query optimizers may be able to do a better job if the order of the output sequence is not specified. For example, when retrieving prices from a purchase order, if an index exists on prices, it may be more efficient to return the prices in index order rather than in document order.