fn:collection

collection() ➔ item()*

Returns a sequence of items making up the default collection.

There are no arguments

Result

item()*

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

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

Arguments

 

$arg

xs:string?

The supplied collection URI

Result

item()*

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 3.1 Functions and Operators

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.