collection() ➔ node()*

Returns the nodes making up the default collection

There are no arguments



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

Returns the nodes making up the collection whose URI is supplied





The supplied collection URI



Links to W3C specifications


Applies to: XPath 2.0, XSLT 2.0, XQuery 1.0 and later versions

XPath 2.0 Functions and Operators

XPath 3.0 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.