XSLT and XPath function reference in alphabetical order

(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z



Association and localisation of nodes and resources at runtime


XPath 2.0

Return value:

A Boolean value, true or false.




A string xs:string which has to lexically correspond to a valid xs:anyURI URI string.

Purpose of use:

The fn:doc-available() function tests whether the string passed on to it corresponds to an URI which points at an existing and embeddable resource. Therefore, the function returns the value true only in the event that the URI string points at a document node. If this is not the case, the return value is false.

If a string which cannot be a valid URI string of the xs:anyURI type is passed on to the function, the error »Invalid argument to fn:doc or fn:doc-available« (err:FODC0005) is reported.

Example – prior test of the embedding of an external resource:

if fn:document-available('my_doc.xml')

then fn:doc('my_doc.xml')

The embedding of the external resource only takes place if it exists and can be recorded. This is ensured by fn:doc-available().

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

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


<< 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