Returns the name of a node, as an
xs:string that is either the zero-length
string, or has the lexical form of an
If the argument is omitted, it defaults to the context item (
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 the argument is supplied and is the empty sequence, the function returns the zero-length string.
If the node identified by
$arg has no name (that is, if it is a document
node, a comment, a text node, or a namespace node having no name), the function returns
the zero-length string.
Otherwise, the function returns the value of the expression
The following errors may be raised when
$arg is omitted:
If the context item is absent, dynamic error
If the context item is not a node, type error .
Because the result depends on the choice of namespace prefixes in the source document,
it is not good practice to use the result of this function for anything other than display
purposes. For example, the test
name(.) = 'my:profile' will fail if the source
document uses an unexpected namespace prefix. Such a test (assuming it relates to an element node)
is better written as