<!--XSLT Processor: Saxonica--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><!--DO NOT EDIT: GENERATED BY merge-function-specs.xsl--><spec xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax" id="spec-top" w3c-doctype="rec" status="ext-review"><header><title>EXPath File Module 4.0</title><version/><w3c-designation>REC-file-40</w3c-designation><w3c-doctype>W3C Editor's Draft</w3c-doctype><pubdate><day>01</day><month>January</month><year>2000</year></pubdate><publoc>
            <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="https://qt4cg.org/specifications/EXPath/file-40/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">https://qt4cg.org/specifications/EXPath/file-40/</loc>
        </publoc><altlocs><loc xmlns:xlink="http://www.w3.org/1999/xlink" href="file-40.xml" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">Specification in XML format</loc><loc xmlns:xlink="http://www.w3.org/1999/xlink" href="function-catalog.xml" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XML function catalog</loc></altlocs><latestloc doc="EXPath File Module 4.0">
            <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="https://qt4cg.org/specifications/EXPath/file-40/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">https://qt4cg.org/specifications/EXPath/file-40/</loc>
        </latestloc><prevrec doc="EXPath File Module">
            <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://expath.org/spec/file" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://expath.org/spec/file</loc>
            
        </prevrec><authlist><author role="editor"><name>Christian Grün</name><affiliation>BaseX GmbH</affiliation></author><author role="contrib"><name>Matthias Brantner</name><affiliation>28msec GmbH</affiliation></author><author role="contrib"><name>Gabriel Petrovay</name><affiliation>28msec GmbH</affiliation></author></authlist><errataloc xmlns:xlink="http://www.w3.org/1999/xlink" href="https://www.w3.org/XML/2017/qt-errata/xpath-functions-31-errata.html" xlink:type="simple"/><translationloc xmlns:xlink="http://www.w3.org/1999/xlink" href="https://www.w3.org/2003/03/Translations/byTechnology?technology=xpath-functions-40" xlink:type="simple"/><abstract><p>This document defines a file system API for XPath 4.0. It defines extension functions
                to perform file system related operations such as listing, reading, or writing files
                or directories.</p><p>The document is an update of the original <bibref ref="expath-file"/> specification,
                developed by the <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/community/expath/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">EXPath Community
                    Group</loc>, defined for <bibref ref="xpath20"/> and published in 2013.</p><p>The principal semantic alteration is use of functional argument defaults available in
                XPath 4.0.</p><p>These functions are defined for use in <bibref ref="xpath-40"/> and <bibref ref="xquery-40"/> and <bibref ref="xslt-40"/> and other related XML standards.
                The signatures and summaries of functions defined in this document are available at:
                    <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="https://qt4cg.org/specifications/EXPath/file-40/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">https://qt4cg.org/specifications/EXPath/file-40/</loc>.</p><p>A summary of changes since published version 1.0 (the XPath 2.0 version) is provided
                at <specref ref="changelog"/>.</p></abstract><status><p>This version of the specification is work in progress. It is produced by the QT4
                Working Group, officially the W3C XSLT 4.0 Extensions Community Group. Individual
                functions specified in the document may be at different stages of review, reflected
                in their <term>History</term> notes. Comments are invited, in the form of GitHub
                issues at <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="https://github.com/qt4cg/qtspecs" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">https://github.com/qt4cg/qtspecs</loc>.</p><note role="dedication" id="dedication"><p>The publications of this community group 
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="../xquery-40/xpath-40.html#dedication" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">are dedicated</loc> to our co-chair,
Michael Sperberg-McQueen (1954–2024).</p></note></status><langusage><language id="EN">English</language></langusage><revisiondesc><p/></revisiondesc></header><body><div1 id="intro"><head>Introduction</head><changes><change>Use the arrows to browse significant changes since the 1.0 version of this
                    specification.</change><change>Sections with significant changes are marked Δ in the table of contents. New
                    functions introduced in this version are marked ➕ in the table of
                    contents.</change></changes><p>The purpose of this document is to define functions to manipulate files within a
                local filesystem and their representations inclusion in XPath 4.0, XQuery 4.0, and
                XSLT 4.0.</p><p>The exact syntax used to call these functions and operators is specified in <bibref ref="xpath-40"/>, <bibref ref="xquery-40"/> and <bibref ref="xslt-40"/>. </p><p>This document defines several classes of functions:</p><ulist><item><p>Functions to examine the properties of files, such as size and modification
                        dates.</p></item><item><p>Functions to perform basic operations on files as entities, such as copying,
                        deletion, creating directories and establishment of temporary files.</p></item><item><p>Functions to read and write to and from files in various formats.</p></item><item><p>Functions to manipulate file paths.</p></item><item><p>Functions to examine properties of the underlying file system and current
                        context, such as establishing the current working directory or the
                        characters used for various separators within paths or files.</p></item></ulist><p>References to specific sections of some other specifications are indicated by
                cross-document links in this document. Each such link consists of a pointer to a
                specific section followed a superscript specifying the linked document. The
                superscripts have the following meanings: FO40 <bibref ref="xpath-functions-40"/>,
                SER30 <bibref ref="ser30"/> and XS2 <bibref ref="xmlschema-2"/>
                .</p><div2 id="error.management"><head>Error management</head><p>Error conditions are identified by a code (a <code nobreak="false">QName</code>.) When such an
                    error condition is reached in the evaluation of an expression, a dynamic error
                    is thrown, with the corresponding error code (as if the standard XPath function
                    <code nobreak="false">error()</code> had been called.)</p><p>In this specification these codes use the <code nobreak="false">http://expath.org/ns/file</code>
                    namespace and a 'descriptive string' local part, e.g. <errorref spec="FILE40" code="not-found"/>, rather than the
                    <code nobreak="false">http://www.w3.org/2005/xqt-errors</code> namespace and alpha-numeric local
                    part, e.g. <code nobreak="false">err:FOCH0004</code>, used in <bibref ref="xpath-functions-40"/>. These error codes were chosen originally in the 1.0 version of 2013.</p></div2><div2 id="file-paths"><head>File Paths</head><p>All file paths are specified as strings, and are resolved against the current
                    working directory. The current working directory is implementation-defined: It
                    can e. g. be the file system directory from which a query processor was
                    started.</p><p>An implementation <rfc2119>must</rfc2119> accept absolute and relative UNIX/Linux
                    and Windows paths as well as absolute file URIs. Some examples: </p><ulist><item><p><code nobreak="false">C:\Test Dir\my file.xml</code>: An absolute path on Windows
                            platforms.</p></item><item><p><code nobreak="false">/Test Dir/my file.xml</code>: An absolute path on UNIX-based
                            platforms.</p></item><item><p><code nobreak="false">C:\\\Test Dir//\\my file.xml</code>: An absolute path on Windows
                            platforms that tolerates an arbitrary number of slashes and
                            backslashes.</p></item><item><p><code nobreak="false">my file.xml</code>: A relative path, pointing to a file in the
                            current working directory.</p></item><item><p><code nobreak="false">file:///C:/Test%20Dir/my%20file.xml</code>: An absolute file URI on
                            Windows platforms.</p></item><item><p><code nobreak="false">file:///Test%20Dir/my%20file.xml</code>: An absolute path on
                            UNIX-based platforms.</p></item></ulist><p>Before further processing, all paths are normalized to an <xtermref spec="FO40" ref="implementation-defined">implementation-defined</xtermref>
                    representation (which usually is the representation of the underlying operating
                    system).</p><p>It is <xtermref spec="FO40" ref="implementation-defined">implementation-defined</xtermref> as to
                    whether the error <errorref spec="FILE40" code="invalid-path"/> is raised if a
                    path is invalid.</p><ednote><edtext>Should raising this error perhaps be <xtermref spec="FO40" ref="implementation-dependent">implementation-dependent</xtermref>?</edtext></ednote><p>If a function returns a string that refers to a directory, it will always be
                    suffixed with the system-specific directory separator.</p><p>The function <code nobreak="false">file:base-dir</code> can be used to resolve file operations
                    against the directory of the base URI:</p><eg xml:space="preserve">let $filename := "input.txt"
let $dir := file:base-dir() 
let $path := concat($dir, $filename)
return file:read-text($path)</eg></div2><div2 id="exec"><head>Function Execution</head><p>Almost all of these functions are marked as <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, which means they are
                    not guaranteed to perform the same operations and produce identical results from
                    repeated calls. A processor <rfc2119>must</rfc2119> ensure that these functions
                    are not relocated or pre-evaluated and that its results are not cached when
                    compiling and evaluating the query and serializing its results.</p></div2><div2 id="testing"><head>Test suite</head><p>A suite of test-cases for all the functions defined in this module, in <bibref ref="qt3"/> format, is defined at <bibref ref="tests.file"/>.</p></div2><div2 id="conformance"><head>Conformance</head><p>This specification follows the general remarks on and terminology for conformance
                    given in <xspecref spec="FO40" ref="conformance"/></p><p>In this document, text labeled as an example or as a note is provided for
                    explanatory purposes and is not normative.</p></div2><div2 id="namespace-prefixes"><head>Namespaces and prefixes</head><p>The functions defined in this document are contained exclusively in the namespace
                    <code nobreak="false">http://expath.org/ns/file</code> and referenced using a
                    <code nobreak="false">xs:QName</code> binding to that namespace.</p><p>This document uses the prefix <code nobreak="false">file</code> to refer to this namespace.
                    User-written applications can choose a different prefix to refer to the
                    namespace, so long as it is bound to the correct URI. In accordance with current
                    practice, it is recommended that the prefix <code nobreak="false">file</code> be reserved for
                    use with this namespace.</p></div2><div2 id="func-signatures"><head>Function signatures and descriptions</head><p>Each function (or group of functions having the same name) is defined in this
                    specification using a standard proforma, full details of which can be found in
                        <xspecref spec="FO40" ref="func-signatures"/>. In particular in this update
                    (trailing) optional arguments for functions (introduced in XPath 4.0) are used
                    where appropriate in the signatures, rather than multiple-arity signatures as
                    previously. </p></div2></div1><div1 id="props"><head>File Properties</head><div2 id="func-file-exists"><head>file:exists</head><glist><gitem><label>Summary</label><def><p>Tests if a file or directory exists.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="exists" return-type="xs:boolean" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns <code nobreak="false">true</code> if <code nobreak="false">$path</code> points to a file or directory,
                <code nobreak="false">false</code> otherwise.</p><p>On UNIX-based systems the root and the volume roots are considered directories.</p></def></gitem></glist></div2><div2 id="func-file-is-dir"><head>file:is-dir</head><glist><gitem><label>Summary</label><def><p>Tests if <code nobreak="false">$path</code> points to a directory.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="is-dir" return-type="xs:boolean" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns <code nobreak="false">true</code> if <code nobreak="false">$path</code> points to a directory,
                <code nobreak="false">false</code> otherwise.</p><p>On UNIX-based systems the root and the volume roots are considered directories.</p></def></gitem></glist></div2><div2 id="func-file-is-file"><head>file:is-file</head><glist><gitem><label>Summary</label><def><p>Tests if <code nobreak="false">$path</code> points to a file.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="is-file" return-type="xs:boolean" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns <code nobreak="false">true</code> if <code nobreak="false">$path</code> points to a existing file.</p><p>Returns <code nobreak="false">false</code> if <code nobreak="false">$path</code> points to a existing directory.</p><p>Otherwise returns <code nobreak="false">false</code></p></def></gitem></glist></div2><div2 id="func-file-last-modified"><head>file:last-modified</head><glist><gitem><label>Summary</label><def><p>Returns the last modification time of a file or directory.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="last-modified" return-type="xs:dateTime" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the last modification time of a file or directory.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="not-found"/> is raised if <code nobreak="false">$path</code> does not
                exist.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-size"><head>file:size</head><glist><gitem><label>Summary</label><def><p>Returns the byte size of a file, or the value <code nobreak="false">0</code> for directories.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="size" return-type="xs:integer" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns <code nobreak="false">0</code> if <code nobreak="false">$file</code> points to a directory.</p><p>Returns the byte size of the file <code nobreak="false">$file</code>, if it exists.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="not-found"/> is raised if <code nobreak="false">$path</code> does not
                exist.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2></div1><div1 id="entities"><head>Manipulation of Files as Entities</head><div2 id="func-file-copy"><head>file:copy</head><glist><gitem><label>Summary</label><def><p>Copies a file or a directory given a source and a target path/URI.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="copy" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="source" type="xs:string"/><arg name="target" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Copies a file or a directory given a source and a target path/URI. The following
                cases may occur if <code nobreak="false">$source</code> points to a file:</p><olist><item><p> if <code nobreak="false">$target</code> does not exist, it will be created.</p></item><item><p> if <code nobreak="false">$target</code> is a file, it will be overwritten.</p></item><item><p> if <code nobreak="false">$target</code> is a directory, the file will be created in that
                        directory with the name of the source file. If a file already exists, it
                        will be overwritten.</p></item></olist><p>The following cases may occur if <code nobreak="false">$source</code> points to a directory:</p><olist><item><p> if <code nobreak="false">$target</code> does not exist, it will be created as directory, and
                        all files of the source directory are copied to this directory with their
                        existing local names.</p></item><item><p> if <code nobreak="false">$target</code> is a directory, the source directory with all its
                        files will be copied into the target directory. At each level, if a file
                        already exists in the target with the same name as in the source, it is
                        overwritten. If a directory already exists in the target with the same name
                        as in the source, it is not removed, it is recursed in place (if it does not
                        exist, it is created before recursing).</p></item></olist><p>Other cases will raise one of the errors listed below.</p><p>The function returns the empty sequence if the operation is successful. If an error
                occurs during the operation, no rollback to the original state will be possible </p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="not-found"/> is raised if the <code nobreak="false">$source</code> path
                does not exist.</p><p><errorref spec="FILE40" code="exists"/> is raised if <code nobreak="false">$source</code> points to a
                directory and <code nobreak="false">$target</code> points to an existing file.</p><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$source</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$source</code> points to a
                file and <code nobreak="false">$target</code> points to a directory, in which a subdirectory exists
                with the name of the source file.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-create-dir"><head>file:create-dir</head><glist><gitem><label>Summary</label><def><p>Creates a directory if it does not already exist.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="create-dir" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="dir" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Creates a directory, or does nothing if the directory already exists. The operation
                will create all non-existing parent directories.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="exists"/> is raised if the specified path, or any of
                its parent directories, points to an existing file.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-create-temp-dir"><head>file:create-temp-dir</head><glist><gitem><label>Summary</label><def><p>Creates a temporary directory.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="create-temp-dir" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="prefix" type="xs:string"/><arg name="suffix" type="xs:string"/><arg name="dir" type="xs:string?" default="()"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Creates a temporary directory and all non-existing parent directories and returns the
                full path to the created directory.</p><p>The temporary directory will not be automatically deleted after query execution. It
                is guaranteed to not already exist when the function is called.</p><p>If <code nobreak="false">$dir</code> is omitted or an empty sequence, the directory will be created
                inside the system-dependent default temporary-file directory.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the specified directory does not
                exist or points to a file.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-create-temp-file"><head>file:create-temp-file</head><glist><gitem><label>Summary</label><def><p>Creates a temporary file.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="create-temp-file" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="prefix" type="xs:string"/><arg name="suffix" type="xs:string"/><arg name="dir" type="xs:string?" default="()"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Creates a temporary file and all non-existing parent directories and returns the full
                path to the created file.</p><p>The temporary file will not be automatically deleted after query execution. It is
                guaranteed to not already exist when the function is called.</p><p>If <code nobreak="false">$dir</code> is omitted or an empty sequence, the file will be created inside
                the system-dependent default temporary-file directory.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the specified does not exist or
                points to a file.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-delete"><head>file:delete</head><glist><gitem><label>Summary</label><def><p>Deletes a file or a directory from the file system.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="delete" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/><arg name="recursive" type="xs:boolean?" default="false()"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Deletes a file or a directory from the file system.</p><p>If the optional parameter <code nobreak="false">$recursive</code> is <code nobreak="false">true</code>,
                sub-directories will be deleted as well.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="not-found"/> is raised if <code nobreak="false">$path</code> does not
                exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                non-empty directory.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-list"><head>file:list</head><glist><gitem><label>Summary</label><def><p>Lists all files and directories in a given directory.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="list" return-type="xs:string*" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="dir" type="xs:string"/><arg name="recursive" type="xs:boolean?" default="false()"/><arg name="pattern" type="xs:string?" default="()"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Lists all files and directories in a given directory. The order of the items in the
                resulting sequence is not defined. The "." and ".." items are never returned. The
                returned paths are relative to the provided directory <code nobreak="false">$dir</code>.</p><p>If the optional parameter <code nobreak="false">$recursive</code> is <code nobreak="false">true</code>, all
                directories and files will be returned that are found while recursively traversing
                the given directory. If <code nobreak="false">$recursive</code> is omitted or an empty sequence or
                <code nobreak="false">false</code> only the contents of the specified directory will be returned. </p><p>The optional <code nobreak="false">$pattern</code> parameter defines a name pattern in the glob
                syntax. If this is provided and is not an empty sequence, only the paths of the
                files and directories whose names are matching the pattern will be returned.</p><p>An implementation must support at least the following glob syntax for the pattern: <ulist><item><p>
                            <code nobreak="false">*</code> for matching any number of unknown characters
                        and</p></item><item><p><code nobreak="false">?</code> for matching one unknown character.</p></item></ulist>
            </p><p>A related function is <code nobreak="false">file:children</code>.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if <code nobreak="false">$dir</code> does not point
                to an existing directory.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-move"><head>file:move</head><glist><gitem><label>Summary</label><def><p>Moves a file or a directory.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="move" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="source" type="xs:string"/><arg name="target" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Moves a file or a directory given a source and a target path/URI. The following cases
                may occur if <code nobreak="false">$source</code> points to a file:</p><olist><item><p> if <code nobreak="false">$target</code> does not exist, it will be created.</p></item><item><p> if <code nobreak="false">$target</code> is a file, it will be overwritten.</p></item><item><p> if <code nobreak="false">$target</code> is a directory, the file will be created in that
                        directory with the name of the source file. If a file already exists, it
                        will be overwritten.</p></item></olist><p>The following cases may occur if <code nobreak="false">$source</code> points to a directory:</p><olist><item><p> if <code nobreak="false">$target</code> does not exist, it will be created as directory, and
                        all files of the source directory are moved to this directory with their
                        existing local names.</p></item><item><p> if <code nobreak="false">$target</code> is a directory, the source directory with all its
                        files will be moved into the target directory. If the target directory
                        contains a directory with the same name as the source, the error <errorref spec="FILE40" code="is-dir"/> is raised.</p></item></olist><p>Other cases will raise one of the errors listed below.</p><p>The function returns the empty sequence if the operation is successful. If an error
                occurs during the operation, no rollback to the original state will be possible </p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="not-found"/> is raised if the <code nobreak="false">$source</code> path
                does not exist.</p><p><errorref spec="FILE40" code="exists"/> is raised if <code nobreak="false">$source</code> points to a
                directory and <code nobreak="false">$target</code> points to an existing file.</p><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$source</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$target</code> points to a
                directory, in which a subdirectory exists with the name of the source.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2></div1><div1 id="in-out"><head>Input/Output</head><div2 id="func-file-append"><head>file:append</head><glist><gitem><label>Summary</label><def><p>Appends a sequence of items to a file. If the file pointed by <code nobreak="false">$file</code> does
                not exist, a new file will be created.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="append" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="items" type="item()*"/><arg name="params" type="element(output:serialization-parameters)?" default="()"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Appends a sequence of items to a file.</p><p>If the file pointed by <code nobreak="false">$file</code> does not exist, a new file will be
                created.</p><p>
                <code nobreak="false">$params</code>, if not an empty sequence, controls the way the
                <code nobreak="false">$items</code> items are serialized. The semantics of <code nobreak="false">$params</code> are
                those of the same argument of <xspecref spec="FO40" ref="func-serialize"/>,
                consisting of an <code nobreak="false">output:serialization-parameters</code> element whose format
                is defined in <xspecref spec="SE40" ref="serparams-in-xdm-instance"/>. In contrast to <code nobreak="false">fn:serialize,</code> the
                encoding stage will not be skipped by this function.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$file</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-append-binary"><head>file:append-binary</head><glist><gitem><label>Summary</label><def><p>Appends a Base64 item as binary data to a file.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="append-binary" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="value" type="xs:base64Binary"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Appends a Base64 item as binary data to a file.</p><p>If the file pointed to by <code nobreak="false">$file</code> does not exist, a new file will be
                created.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$file</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-append-text"><head>file:append-text</head><glist><gitem><label>Summary</label><def><p>Appends a string to a file.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="append-text" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="value" type="xs:string"/><arg name="encoding" type="xs:string?" default="'utf-8'"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Appends a string to the file <code nobreak="false">$file</code>.</p><p>If the file pointed to by <code nobreak="false">$file</code> does not exist, a new file will be
                created.</p><p>The optional parameter <code nobreak="false">$encoding</code>, if omitted or an empty sequence, is
                considered to be <code nobreak="false">UTF-8</code>.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$file</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="unknown-encoding"/> is raised if <code nobreak="false">$encoding</code>
                is invalid or not supported by the implementation.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-append-text-lines"><head>file:append-text-lines</head><glist><gitem><label>Summary</label><def><p>Appends a sequence of strings to a file, each followed by the system-dependent
                newline character.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="append-text-lines" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="lines" type="xs:string*"/><arg name="encoding" type="xs:string?" default="'utf-8'"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Appends a sequence of strings to a file, each followed by the system-dependent
                newline character.</p><p>If the file pointed to by <code nobreak="false">$file</code> does not exist, a new file will be
                created.</p><p>The optional parameter <code nobreak="false">$encoding</code>, if omitted or an empty sequence, is
                considered to be <code nobreak="false">UTF-8</code>.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$file</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="unknown-encoding"/> is raised if <code nobreak="false">$encoding</code>
                is invalid or not supported by the implementation.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-read-binary"><head>file:read-binary</head><glist><gitem><label>Summary</label><def><p>Returns the content of a file in its Base64 representation.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="read-binary" return-type="xs:base64Binary" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="offset" type="xs:integer?" default="0"/><arg name="length" type="xs:integer?" default="()"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the content of a file in its Base64 representation.</p><p>The optional parameters <code nobreak="false">$offset</code> and <code nobreak="false">$length</code> can be used to
                read chunks of a file.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="not-found"/> is raised if <code nobreak="false">$file</code> does not
                exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="out-of-range"/> is raised if <code nobreak="false">$offset</code> or
                <code nobreak="false">$length</code> is negative, or if the chosen values would exceed the file
                bounds.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-read-text"><head>file:read-text</head><glist><gitem><label>Summary</label><def><p>Returns the content of a file in its string representation.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="read-text" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="encoding" type="xs:string?" default="'utf-8'"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the content of a file in its string representation.</p><p>The optional parameter <code nobreak="false">$encoding</code>, if omitted or an empty sequence, is
                considered to be <code nobreak="false">UTF-8</code>.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="not-found"/> is raised if <code nobreak="false">$file</code> does not
                exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="unknown-encoding"/> is raised if <code nobreak="false">$encoding</code>
                is invalid or not supported by the implementation.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-read-text-lines"><head>file:read-text-lines</head><glist><gitem><label>Summary</label><def><p>Returns the contents of a file as a sequence of strings, separated at newline
                boundaries.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="read-text-lines" return-type="xs:string*" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="encoding" type="xs:string?" default="'utf-8'"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the contents of a file as a sequence of strings, separated at newline
                boundaries.</p><p>The optional parameter <code nobreak="false">$encoding</code>, if omitted or an empty sequence, is
                considered to be <code nobreak="false">UTF-8</code>.</p><p>The newline handling is the same as for <xspecref spec="FO40" ref="func-unparsed-text-lines"/>.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="not-found"/> is raised if <code nobreak="false">$file</code> does not
                exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="unknown-encoding"/> is raised if <code nobreak="false">$encoding</code>
                is invalid or not supported by the implementation.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-write"><head>file:write</head><glist><gitem><label>Summary</label><def><p>Writes a sequence of items to a file.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="write" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="items" type="item()*"/><arg name="params" type="element(output:serialization-parameters)?" default="()"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Writes a sequence of items to a file.</p><p> If <code nobreak="false">$file</code> already exists, it will be overwritten; otherwise, it will be
                created.</p><p>
                <code nobreak="false">$params</code>, if not an empty sequence, controls the way the
                <code nobreak="false">$items</code> items are serialized. The semantics of <code nobreak="false">$params</code> are
                those of the same argument of <xspecref spec="FO40" ref="func-serialize"/>,
                consisting of an <code nobreak="false">output:serialization-parameters</code> element whose format
                is defined in <xspecref spec="SE40" ref="serparams-in-xdm-instance"/>. In contrast to <code nobreak="false">fn:serialize</code>, the encoding stage will not
                be skipped by this function.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$file</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-write-binary"><head>file:write-binary</head><glist><gitem><label>Summary</label><def><p>Writes a Base64 item as binary to a file.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="write-binary" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="value" type="xs:base64Binary"/><arg name="offset" type="xs:integer?" default="0"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Writes a Base64 item as binary to a file. </p><p>If <code nobreak="false">$file</code> already exists, it will be overwritten; otherwise, it will be
                created.</p><p>If the optional parameter <code nobreak="false">$offset</code> is specified and not set to an empty
                sequence, data will be written starting at this file position. An existing file may
                be resized by such an operation.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$file</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="out-of-range"/> is raised if <code nobreak="false">$offset</code> is
                negative, or if it exceeds the current file size.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-write-text"><head>file:write-text</head><glist><gitem><label>Summary</label><def><p>Writes a string to a file.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="write-text" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="value" type="xs:string"/><arg name="encoding" type="xs:string?" default="'utf-8'"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Writes a strings to a file.</p><p> If <code nobreak="false">$file</code> already exists, it will be overwritten.</p><p>The optional parameter <code nobreak="false">$encoding</code>, if omitted or an empty sequence, is
                considered to be <code nobreak="false">UTF-8</code>.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$file</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="unknown-encoding"/> is raised if <code nobreak="false">$encoding</code>
                is invalid or not supported by the implementation.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-write-text-lines"><head>file:write-text-lines</head><glist><gitem><label>Summary</label><def><p>Writes a sequence of strings to a file, each followed by the system-dependent newline
                character.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="write-text-lines" return-type="empty-sequence()" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="file" type="xs:string"/><arg name="values" type="xs:string*"/><arg name="encoding" type="xs:string?" default="'utf-8'"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Writes a sequence of strings to a file, each followed by the system-dependent newline
                character.</p><p> If <code nobreak="false">$file</code> already exists, it will be overwritten; otherwise, it will be
                created.</p><p>The optional parameter <code nobreak="false">$encoding</code>, if omitted or an empty sequence, is
                considered to be <code nobreak="false">UTF-8</code>.</p><p>The function returns the empty sequence if the operation is successful.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if the parent directory of
                <code nobreak="false">$file</code> does not exist.</p><p><errorref spec="FILE40" code="is-dir"/> is raised if <code nobreak="false">$file</code> points to a
                directory.</p><p><errorref spec="FILE40" code="unknown-encoding"/> is raised if <code nobreak="false">$encoding</code>
                is invalid or not supported by the implementation.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2></div1><div1 id="paths"><head>Paths</head><p>None of the functions in this section performs any check regarding the existence of
                the received or returned paths.</p><div2 id="func-file-name"><head>file:name</head><glist><gitem><label>Summary</label><def><p>Returns the name of a file or directory.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="name" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-deterministic">deterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-independent">context-independent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the name of a file or directory.</p><p>An empty string is returned if the path points to the root directory, or if it
                contains no directory separators.</p><p>This function is <xtermref spec="FO40" ref="dt-deterministic">deterministic</xtermref> (no path existence check is made).</p></def></gitem></glist></div2><div2 id="func-file-parent"><head>file:parent</head><glist><gitem><label>Summary</label><def><p>Returns the parent directory of a given path.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="parent" return-type="xs:string?" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Transforms the given path into an absolute path, as specified by <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="#fn.resolve-path" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">file:resolve-path</loc>, and returns the parent
                directory.</p><p>The inverse function is <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="#fn.children" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">file:children</loc>.</p><p>An empty sequence is returned if the path points to a root directory.</p></def></gitem></glist></div2><div2 id="func-file-children"><head>file:children</head><glist><gitem><label>Summary</label><def><p>Returns the paths of all files and directories that are located in the given
                directory.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="children" return-type="xs:string*" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the paths of all files and directories that are located in the given
                directory. The order of the items in the resulting sequence is not defined. The "."
                and ".." items are never returned.</p><p>The inverse function is <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="#fn.parent" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">file:parent</loc>; a related function
                is <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="#fn.list" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">file:list</loc>.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="no-dir"/> is raised if <code nobreak="false">$path</code> does not
                point to an existing directory.</p><p><errorref spec="FILE40" code="io-error"/> is raised if any other error occurs.</p></def></gitem></glist></div2><div2 id="func-file-path-to-native"><head>file:path-to-native</head><glist><gitem><label>Summary</label><def><p>Transforms a URI, an absolute path, or relative path to a canonical, system-dependent
                path representation.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="path-to-native" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Transforms a URI, an absolute path, or relative path to a canonical, system-dependent
                path representation. A canonical path is both absolute and unique and thus contains
                no redirections such as references to parent directories or symbolic links.</p><p>If the resulting path points to a directory, it will be suffixed with the
                system-specific directory separator.</p></def></gitem><gitem><label>Error Conditions</label><def><p><errorref spec="FILE40" code="not-found"/> is raised if <code nobreak="false">$path</code> does not
                exist.</p><p><errorref spec="FILE40" code="io-error"/> is raised if an error occurs while trying
                to obtain the native path.</p></def></gitem></glist></div2><div2 id="func-file-path-to-uri"><head>file:path-to-uri</head><glist><gitem><label>Summary</label><def><p>Transforms a file system path into a URI.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="path-to-uri" return-type="xs:anyURI" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-deterministic">deterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-independent">context-independent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Transforms a file system path into a URI with the <code nobreak="false">file://</code> scheme. If the
                path is relative, it is first resolved against the current working directory.</p><p>This function is <xtermref spec="FO40" ref="dt-deterministic">deterministic</xtermref> (no path existence check is made).</p></def></gitem></glist></div2><div2 id="func-file-resolve-path"><head>file:resolve-path</head><glist><gitem><label>Summary</label><def><p>Transforms a relative path into an absolute operating system path.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="resolve-path" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"><arg name="path" type="xs:string"/></proto></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Transforms a relative path into an absolute operating system path by resolving it
                against the current working directory.</p><p>If the resulting path points to a directory, it will be suffixed with the
                system-specific directory separator.</p></def></gitem></glist></div2></div1><div1 id="sys-props"><head>System Properties</head><div2 id="func-file-dir-separator"><head>file:dir-separator</head><glist><gitem><label>Summary</label><def><p>Returns the value of the operating system-specific directory separator.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="dir-separator" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"/></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the value of the operating system-specific directory separator, which usually
                is <code nobreak="false">/</code> on UNIX-based systems and <code nobreak="false">\</code> on Windows systems.</p></def></gitem></glist></div2><div2 id="func-file-line-separator"><head>file:line-separator</head><glist><gitem><label>Summary</label><def><p>Returns the value of the operating system-specific line separator.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="line-separator" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"/></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the value of the operating system-specific line separator, which usually is
                <code nobreak="false">&amp;#10;</code> on UNIX-based systems, <code nobreak="false">&amp;#13;&amp;#10;</code> on
                Windows systems and <code nobreak="false">&amp;#13;</code> on Mac systems.</p></def></gitem></glist></div2><div2 id="func-file-path-separator"><head>file:path-separator</head><glist><gitem><label>Summary</label><def><p>Returns the value of the operating system-specific path separator.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="path-separator" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"/></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the value of the operating system-specific path separator, which usually is
                <code nobreak="false">:</code> on UNIX-based systems and <code nobreak="false">;</code> on Windows systems.</p></def></gitem></glist></div2><div2 id="func-file-temp-dir"><head>file:temp-dir</head><glist><gitem><label>Summary</label><def><p>Returns the path to the default temporary-file directory of an operating system.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="temp-dir" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"/></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the path to the default temporary-file directory of an operating system.</p></def></gitem></glist></div2><div2 id="func-file-base-dir"><head>file:base-dir</head><glist><gitem><label>Summary</label><def><p>Returns the parent directory of the static base URI.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="base-dir" return-type="xs:string?" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"/></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the parent directory of the static base URI.</p><p>If the Base URI property is undefined, the empty sequence is returned.</p><p>If a static base URI exists, and if points to a local file path, this function
                returns the same result as the expression
                <code nobreak="false">file:parent(static-base-uri())</code>.</p></def></gitem></glist></div2><div2 id="func-file-current-dir"><head>file:current-dir</head><glist><gitem><label>Summary</label><def><p>Returns the current working directory.</p></def></gitem><gitem><label>Signature</label><def><example role="signature"><proto isOp="no" prefix="file" name="current-dir" return-type="xs:string" returnEmptyOk="no" returnSeq="no" returnVaries="no" isSchema="no" isDatatype="no" isSpecial="no"/></example></def></gitem><gitem><label>Properties</label><def><p>This function is <xtermref spec="FO40" ref="dt-nondeterministic">nondeterministic</xtermref>, <xtermref spec="FO40" ref="dt-context-dependent">context-dependent</xtermref>,  and <xtermref spec="FO40" ref="dt-focus-independent">focus-independent</xtermref>. </p></def></gitem><gitem><label>Rules</label><def><p>Returns the current working directory.</p></def></gitem><gitem><label>Formal Equivalent</label><def><p>The effect of the function is equivalent to the result of the following XPath expression.</p><eg xml:space="preserve">file:resolve-path('.')</eg></def></gitem></glist></div2></div1></body><back><div1 id="biblio"><head>References</head><div2 id="normative-biblio"><head>Normative references</head><blist><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="expath-file" key="EXPath File 1.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
                        <loc href="http://expath.org/spec/file" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">File Module 1.0</loc>. Christian
                        Grün, Matthias Brantner and Gabriel Petrovay, editors. EXPath Module 20
                        February 2015.</bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="ieee754" key="IEEE 754-1985" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">IEEE Standard for Binary Floating-Point
                        Arithmetic. See <loc href="http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://standards.ieee.org/reading/ieee/std_public/description/busarch/754-1985_desc.html</loc></bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="ieee754-2019" key="IEEE 754-2019" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">IEEE. <emph>IEEE Standard for
                            Floating-Point Arithmetic.</emph>
                    </bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xpath20" key="XML Path Language (XPath) 2.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xpath-functions-40" key="XQuery and XPath Functions and Operators 4.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xpath-40" key="XML Path Language (XPath) 4.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
                        
                    </bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xslt-40" key="XSL Transformations (XSLT) Version 4.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
                        <emph>CITATION: T.B.D.</emph>
                    </bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xpath-datamodel-40" key="XQuery and XPath Data Model (XDM) 4.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="ser30" key="XSLT and XQuery Serialization 3.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
                        <loc href="http://www.w3.org/TR/xslt-xquery-serialization-30/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XSLT and
                            XQuery Serialization 3.0</loc>. Henry Zongaro, et al. W3C Recommendation
                        08 April 2014.</bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="fo30" key="XQuery and XPath Functions and Operators 3.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
                        <loc href="http://www.w3.org/TR/xpath-functions-30/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XPath and XQuery
                            Functions and Operators 3.0</loc>. Michael Kay. W3C Recommendation 08
                        April 2014.</bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xquery-40" key="XQuery 4.1: An XML Query Language" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
                        <emph>CITATION: T.B.D.</emph>
                    </bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xmlschema-2" key="XML Schema Part 2: Datatypes Second Edition" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"> XML
                        Schema Part 2: Datatypes Second Edition, Oct. 28 2004. Available at: <loc href="http://www.w3.org/TR/xmlschema-2/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://www.w3.org/TR/xmlschema-2/</loc>
                    </bibl></blist></div2><div2 id="non-normative-biblio"><head>Non-normative references</head><blist><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="tests.file" key="Test-suite" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">The test suite for this module, using QT3
                        format, is in the EXPath repository <loc href="http://github.com/expath/expath-cg/tree/master/tests/qt3/file" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://github.com/expath/expath-cg</loc> in the directory
                        tests/qt3/file/</bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="qt3" key="QT3" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
                        <loc href="http://dev.w3.org/2011/QT3-test-suite/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XML Query Test
                            Suite</loc>. W3C 21 June 2013. </bibl><bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="expath" key="EXPath" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">EXPath: Collaboratively Defining Open Standards
                        for Portable XPath Extensions. <loc href="http://expath.org/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://expath.org/</loc>.</bibl></blist></div2></div1><div1 id="error-summary"><head>Error summary</head><p>The error text provided with these errors is non-normative.</p><error-list><error spec="FILE40" code="not-found"><p>The specified path does not exist.</p></error><error spec="FILE40" code="invalid-path"><p>The specified path is invalid.</p></error><error spec="FILE40" code="exists"><p>The specified path already exists.</p></error><error spec="FILE40" code="no-dir"><p>The specified path does not point to a directory.</p></error><error spec="FILE40" code="is-dir"><p>The specified path points to a directory.</p></error><error spec="FILE40" code="unknown-encoding"><p>The specified encoding is not supported.</p></error><error spec="FILE40" code="out-of-range"><p>The specified offset or length is negative, or the chosen values would exceed
                        the file bounds.</p></error><error spec="FILE40" code="io-error"><p>A generic file system error occurred.</p></error></error-list></div1><inform-div1 id="glossary"><head>Glossary</head><?glossary?></inform-div1><inform-div1 id="other-functions"><head>Other Functions</head><p>This Appendix describes some sources of functions or operators that fall outside the
                scope of the function library defined in this specification. It includes both
                function specifications and function implementations. Inclusion of a function in
                this appendix does not constitute any kind of recommendation or endorsement; neither
                is omission from this appendix to be construed negatively. This Appendix does not
                attempt to give any information about licensing arrangements for these function
                specifications or implementations.</p><div2 id="functions-in-other-w3c-specs"><head>XPath Functions and Operators Defined in Other W3C Recommendations</head><p>A number of W3C Recommendations make use of XPath, and in some cases such
                    Recommmendations define additional functions to be made available when XPath is
                    used in a specific host language.</p><div3 id="functions-defined-in-XPathFO"><head>Functions and Operators Defined in XPath and XQuery Functions and
                        Operators</head></div3></div2></inform-div1><inform-div1 id="impl-def"><head>Checklist of implementation-defined features</head><?imp-def-features?></inform-div1><inform-div1 id="changelog" diff="chg" at="2024-11-22"><head>Changes since version 1.0</head><div2 id="changes-summary"><head>Summary of Changes</head><?change-log?></div2><div2 id="changes-to-function-signatures"><head>Changes to Function Signatures</head><olist><item><p>The function signatures of all the specified signatures now use the
                            'optional argument' syntax of XPath 4.0 where appropriate, rather than
                            giving several signatures of differing arity. Other than that, no
                            intended change to the semantics of the functions are assumed.</p></item></olist></div2><div2 id="editorial-changes"><head>Editorial Changes</head><p>These changes are not highlighted in the change-marked version of the
                    specification.</p></div2></inform-div1><inform-div1 id="back-compatibility" diff="chg" at="A"><head>Compatibility with Previous Versions</head><p>This section summarizes the extent to which this specification is compatible with
                previous versions.</p><p>Version 4.0 of this function library is fully backwards compatible with version 1.0,
                except as noted below:</p><olist><item diff="add" at="2024-11-25"><p>The use of optional arguments in the function signatures means that minor
                        alterations to possible function calls, which would be invalid in 1.0, are
                        now supported. For example:</p><eg xml:space="preserve">file:list($dir,false(),())</eg><p>would be invalid in 1.0, as the third argument <code nobreak="false">$pattern</code> is
                        defined to be of type <code nobreak="false">xs:string</code>. It is valid for 4.0 as the
                        empty sequence denotes default behaviour, that is all files are listed. </p><p>The functions <code nobreak="false">file:append</code>, <code nobreak="false">file:append-text</code>, <code nobreak="false">file:append-text-lines</code>
                        <code nobreak="false">file:create-temp-dir</code>, <code nobreak="false">file:create-temp-file</code>,
                        <code nobreak="false">file:delete</code>, <code nobreak="false">file:read-binary</code>,
                        <code nobreak="false">file:read-text</code>, <code nobreak="false">file:read-text-lines</code>,
                        <code nobreak="false">file:write</code>, <code nobreak="false">file:write-binary</code>,
                        <code nobreak="false">file:write-text</code> and <code nobreak="false">file:write-text-lines</code> all have
                        similar incompatibilities.</p></item></olist></inform-div1></back></spec>