file:current-dir
Returns the current working directory.
current-dir( ) ➔ xs:string
There are no arguments | ||||
Result | xs:string | |||
Namespace
http://expath.org/ns/file
Links to specifications
Saxon availability
Available in XPath 2.0 and later versions. Implemented since Saxon 9.6. Requires Saxon-PE or Saxon-EE. Available for all platforms.
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.
If the Java system property expath.base.directory is not set, the standard
system property user.dir is used.