Skip to content
Node Functions

Node Functions

base-uri

base-uri() as xs:anyURI?

base-uri($arg as node()?) as xs:anyURI?

Returns the base URI of the context node or $arg. The base URI is retrieved from the context store.

default-language

default-language() as xs:language

Returns the default language. Returns "en".

doc

doc($uri as xs:string) as document-node()

Loads and parses an XML document from the given URI. Results are cached.

doc-available

doc-available($uri as xs:string) as xs:boolean

Returns true if a document is available at the given URI.

document-uri

document-uri() as xs:anyURI?

document-uri($arg as node()?) as xs:anyURI?

Returns the document URI of the context node or $arg. Returns the base URI for document nodes when available, or the empty sequence otherwise.

environment-variable

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

Returns the value of the system environment variable with the given name, or the empty sequence if no such variable exists.

environment-variable('HOME')  →  "/home/user"

available-environment-variables

available-environment-variables() as xs:string*

Returns the names of all available system environment variables.

generate-id

generate-id() as xs:string

generate-id($arg as node()?) as xs:string

Returns a string that uniquely identifies the context node or $arg. Returns the empty string if the argument is the empty sequence. The generated ID is based on the internal node ID.

generate-id(.)  →  "d42"

has-children

has-children() as xs:boolean

has-children($arg as node()?) as xs:boolean

Returns true if the context node or $arg has one or more child nodes.

in-scope-prefixes

in-scope-prefixes($element as element()) as xs:string*

Returns all namespace prefixes in scope for the given element.

innermost

innermost($nodes as node()*) as node()*

Returns every node in $nodes that is not an ancestor of another node in $nodes. The result is in document order.

lang

lang($testlang as xs:string) as xs:boolean

lang($testlang as xs:string, $node as node()) as xs:boolean

Returns true if the language of the context node (or $node) matches $testlang.

local-name

local-name() as xs:string

local-name($arg as node()?) as xs:string

Returns the local name of the context node or $arg.

local-name(<book/>)  →  "book"

name

name() as xs:string

name($arg as node()?) as xs:string

Returns the qualified name (prefix:local) of the context node or $arg.

namespace-uri

namespace-uri() as xs:anyURI

namespace-uri($arg as node()?) as xs:anyURI

Returns the namespace URI of the context node or $arg.

namespace-uri-for-prefix

namespace-uri-for-prefix($prefix as xs:string, $element as element()) as xs:anyURI?

Returns the namespace URI bound to the given prefix on the element.

namespace-uri-from-QName

namespace-uri-from-QName($arg as xs:QName?) as xs:anyURI?

Returns the namespace URI from a QName.

nilled

nilled() as xs:boolean

nilled($arg as node()?) as xs:boolean

Returns true if the context node or $arg is nilled. Without schema awareness, this always returns false for element nodes and the empty sequence for non-element nodes.

node-name

node-name() as xs:QName?

node-name($arg as node()?) as xs:QName?

Returns the name of the context node or $arg as a QName. Returns the empty sequence for nodes that have no name (e.g. text nodes, comments).

outermost

outermost($nodes as node()*) as node()*

Returns every node in $nodes that is not a descendant of another node in $nodes. The result is in document order.

path

path() as xs:string?

path($arg as node()?) as xs:string?

Returns an XPath expression that uniquely identifies the context node or $arg within its document. The path uses the Q{uri}local notation for element names.

path(.)  →  "/Q{}root[1]/Q{}child[1]"

local-name-from-QName

local-name-from-QName($arg as xs:QName?) as xs:NCName?

Returns the local name from a QName.

prefix-from-QName

prefix-from-QName($arg as xs:QName?) as xs:NCName?

Returns the prefix from a QName.

QName

QName($namespace as xs:string, $qualifiedName as xs:string) as xs:QName

Constructs a QName from a namespace URI and a qualified name string.

resolve-QName

resolve-QName($qname as xs:string, $element as element()) as xs:QName

Resolves a lexical QName against the in-scope namespaces of an element.

resolve-uri

resolve-uri($relative as xs:string) as xs:anyURI

resolve-uri($relative as xs:string, $base as xs:string) as xs:anyURI

Resolves a relative URI against a base URI.

root

root() as node()

root($arg as node()?) as node()?

Returns the root node of the tree containing the context node or $arg.

static-base-uri

static-base-uri() as xs:anyURI?

Returns the static base URI from the context, or the empty sequence if none is set.