XPath/XQuery doc-available function

Summary

The function returns true if and only if the function call fn:doc($uri) would return a document node.

Signature

fn:doc-available(
$uri as xs:string?
) as xs:boolean

Properties

This function is deterministic, context-dependent, and focus-independent. It depends on available-documents static-base-uri.

Rules

If $uri is an empty sequence, this function returns false.

If a call on fn:doc($uri) would return a document node, this function returns true.

A dynamic error is raised if $uri is not a valid URI according to the rules applied by the implementation of fn:doc.

In all other cases this function returns false. This includes the case where an invalid URI is supplied, and also the case where a valid relative URI reference is supplied, and cannot be resolved, for example because the static base URI is absent.

If this function returns true, then calling fn:doc($uri) within the same must return a document node. However, if nondeterministic processing has been selected for the fn:doc function, this guarantee is lost.