File Functions

File functions load external XML documents, plain-text files, and system environment variables into an XPath expression. Any filename passed to the functions below may be prefixed with http:// or file://, and a query string starting with ? can also be appended to a URL.
doc("data.xml")Returns the document node for the file data.xml. Further node paths can be appended, e.g. doc("data.xml")//a returns all <a> nodes in the document.
doc-available("data.xml")Returns true if data.xml exists and can be returned as a document node.
collection("s*.xml")Returns a sequence of document nodes for files whose names start with s.
uri-collection("s*.xml")Returns a sequence of URI strings, i.e. file names, for files whose names start with s.
unparsed-text("data.dat")Returns a string representation of the content of the file data.dat.
unparsed-text-lines("data.dat")Returns a sequence of strings, one per line of content in the file data.dat.
unparsed-text-available("data.dat")Returns true if the file data.dat is available to be read by unparsed-text().
environment-variable("APPDATA")Returns the value of the system environment variable APPDATA.
available-environment-variables()Returns a sequence of the names of the available system environment variables.

ch03-file-functions.xpath.txt:
doc("data.xml")//a
doc-available("data.xml")
unparsed-text-lines("data.dat")
environment-variable("APPDATA")