# unparsed-text

Returns the contents of an external text file, given its URI. The function attempts to infer the encoding. First it looks in the HTTP headers if available. Then it examines the start of the file looking first for a byte-order-mark, and failing that for an XML declaration. If none of this works, it assumes the encoding is UTF-8.

unparsed-text($href as xs:string?) → xs:string?

Arguments
| $href | xs:string? |
Result | xs:string?

unparsed-text($href as xs:string?, $encoding as xs:string) → xs:string?

Arguments
| $href | xs:string? |
| $encoding | xs:string |
Result | xs:string?

Links to W3C specifications

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

Applies to: XPath 2.0, XSLT 2.0, XQuery 1.0 and later versions

XPath 2.0 Specification

XPath 3.0 Specification

Notes on the Saxon implementation

The current Saxon implementation is not stable: 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.

Next