fn:unparsed-text-available

Determines whether the corresponding call on unparsed-text() with the same arguments would succeed.

unparsed-text-available($source as xs:string?, $options as (xs:string | map(*))?:={}) ➔ xs:boolean

Arguments

 

$source

xs:string?

The URI of the text file to be read

 

$options

(xs:string | map(*))?

:= {}

The encoding to be assumed for the text file

Result

xs:boolean

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 3.1 Functions and Operators

XPath 4.0 Functions and Operators

Saxon availability

Available in XPath 3.0, XSLT 3.0, XQuery 3.0, and later versions. Available in all Saxon editions. Available for all platforms.

Notes on the Saxon implementation

The Saxon implementation is by default not deterministic: if the function is called twice with the same argument, it will read the external file twice, and may return different results if it has changed. If stable results are required, this can be achieved (from 9.8) by setting the configuration option Feature.STABLE_UNPARSED_TEXT.

The default implementation is inefficient: if a call on unparsed-text-available() is followed by a call on unparsed-text() to read the same file, the file will be read twice. This is avoided if the STABLE_UNPARSED_TEXT option is set, but at the cost of keeping the text in memory for the entire query or transformation.