XSLT and XPath function reference in alphabetical order
(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)
Association and localisation of resources at runtime
A node sequence which is determined from the collections available in the dynamic context by means of the URI strings passed on.
Optional. The argument is a xs:string string which must lexically correspond to the xs:anyURI type. If an evaluation as URI is not possible, the error message »Invalid argument to fn:collection.« (err:FODC0004) is outputted. If no argument is passed on, the default collection is returned.
Purpose of use:
Firstly, the input value is, according to the appropriate casting function, cast from xs:string to the xs:anyURI type. If the conversion results in a relative URI, it is evaluated by means of the base URI valid for the context. The empty string as input value is also evaluated as a relative (in this case empty) URI – thus the resulting absolute URI corresponds to the base URI.
The resulting URI selects one of the collections available in the dynamic context (available collections). The function returns the node sequence assingned to it per mapping. If no collection is addressable via the URI, the error message »Invalid argument to fn:collection.« (err:FODC0004) is outputted. If the resulting URI points within the availabe collections to a collection which is mapped to an empty sequence, the function returns the empty sequence.
If no argument is passed on to the function or an argument which results in the empty sequence, it returns the default collection of the current dynamic context. Where no such default collection is defined, the call results in the error message »Error retrieving resource.« (err:FODC0002).
Regarding the XPath specification, the function is stable, which means, for the runtime of the stylesheet and when having the same argument, it always returns the same collection.
The function is not available.
fn:collection() as node()*
fn:collection($arg as xs:string?) as node()*
|<< back||next >>|
Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany