file:current-dir

Returns the current working directory. - This function returns the same result as the function call file:resolve-path('.').

current-dir() ➔ xs:string

There are no arguments

Result

xs:string

Namespace

http://expath.org/ns/file

Links to specifications

EXPath File Module

Saxon availability

Available whether or not support for XPath 3.0 is enabled. Implemented since Saxon 9.6. Requires Saxon-PE or Saxon-EE.

Notes on the Saxon implementation

The EXPath specification says that the current working directory is implementation-defined. The Saxon implementation of file:current-dir() effectively invokes file:resolve-path("."). The file:resolve-path() function relies on Java's File.getAbsolutePath(). On Unix systems, this resolves the file name against the current directory (as defined by the system property user.dir). On Windows, it is possible for a relative file name to include a drive letter, and for each drive to have a different current directory: this affects the handling of relative file names in file:resolve-path() and in other functions (such as file:exists()), but it is not reflected in the result of file:current-dir().

For convenience in testing, Saxon recognizes the Java system property expath.base.directory and uses this as the current directory if the property exists. Applications should not rely on this feature.