fn:node-name
Returns the name of a node, as an xs:QName
.
Signatures
fn:node-name() as xs:QName?
fn:node-name($arg as node()?) as xs:QName?
Properties
The zero-argument form of this function is deterministic, context-dependent, and focus-dependent.
The one-argument form of this function is deterministic, context-independent, and focus-independent.
Rules
If the argument is omitted, it defaults to the context item (.
). The
behavior of the function if the argument is omitted is exactly the same as if the
context item had been passed as the argument.
If $arg
is the empty sequence, the empty sequence is returned.
Otherwise, the function returns the result of the dm:node-name
accessor as
defined in [Data Model (XDM) 3.1] (see node-name Accessor).
Error Conditions
The following errors may be raised when $arg
is omitted:
If the context item is absent, dynamic error [ERRXPDY0002]
If the context item is not a node, type error [ERRXPTY0004].
Notes
For element and attribute nodes, the name of the node is returned as an
xs:QName
, retaining the prefix, namespace URI, and local part.
For processing instructions, the name of the node is returned as an
xs:QName
in which the prefix and namespace URI are absent.
For a namespace node, the function returns an empty sequence if the node represents
the
default namespace; otherwise it returns an xs:QName
in which prefix and
namespace URI are absent and the local
part is the namespace prefix being bound.
For all other kinds of node, the function returns the empty sequence.