functx:open-ref-document

Resolves a relative URI and references it, returning an XML document

Description

The functx:open-ref-document function takes the value of $refNode, which is a relative URI reference, resolves it to the base URI to form an absolute URI, then calls the fn:doc function to retrieve the document at that URI.

It uses the base URI of the node itself if available (usually the URI the document was retrieved from). If the node doesn’t have a base URI, the base URI of the static context is used (which is defined in the prolog or outside the scope of the query by the processor.

Parameters

Description

refNode:node()

a node whose value is a relative URI reference

Examples

XPath

Results

Explanation

functx:open-ref-document($in-xml/@href)

The document node of the document at the relative URI temp/other.html.

If the base URI of the $in-xml node is http://datypic.com, it would return http://datypic.com/temp/other.html, assuming it’s well-formed XML.

XPath

Results

functx:open-ref-document($in-xml/@href)

The document node of the document at the relative URI temp/other.html.

See Also