collection() ➔ item()*

Returns a sequence of items making up the default collection.

There are no arguments



collection($arg as xs:string?) ➔ item()*

Returns a sequence of items making up the collection whose URI is supplied.





The supplied collection URI





Links to W3C specifications

XPath 3.1 Functions and Operators

Saxon availability

Available in XPath 2.0, XSLT 2.0, XQuery 1.0, and later versions. Available in all Saxon editions.

Notes on the Saxon implementation

Saxon implements the zero-argument function by passing a null URI to the registered CollectionFinder. The default StandardCollectionFinder implementation supplied with the product handles this by returning an empty sequence, but a user-supplied CollectionFinder is free to handle this case any way it wishes.

If a user-defined CollectionFinder has been registered, the action of this function is entirely user-defined. A collection finder may be registered using the setCollectionFinder() method on the Configuration object, or (in XSLT) using setAttribute() on the TransformerFactory. The CollectionFinder may also be nominated using the -cf option on the command line.

For details of the behavior of the standard collection finder, and more information on supplying your own, see Collections.

The collection() function is multi-threaded in Saxon-EE (since 9.5). Each document in the collection is parsed in a separate thread, and the documents are processed in the order in which parsing completes. This makes the order of the documents unpredictable.