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 2.0 Functions and Operators

XPath 3.0 Functions and Operators

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 CollectionURIResolver. The default CollectionURIResolver implementation supplied with the product handles this by returning an empty sequence, but a user-supplied CollectionURIResolver is free to handle this case any way it wishes.

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

For details of the behavior of the standard CollectionURIResolver, 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.