Returns the value of a system environment variable, if it exists.

Implemented in Saxon using the Java method System.getenv(). The rule in the XPath specification requiring the result to be deterministic is not enforced.

environment-variable($name as xs:string) ➔ xs:string?





The name of the required environment variable



Links to W3C specifications

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

Applies to: XPath 3.0, XSLT 3.0, XQuery 3.0 (if enabled in Saxon: requires Saxon-PE or Saxon-EE)

XPath 3.0 Functions and Operators

Notes on the Saxon implementation

Implemented in Saxon 9.3 under the name get-environment-variable; name changed to environment-variable in Saxon 9.4. Requires XPath 3.0 to be enabled.