local-name function

The fn:local-name function returns the local name property of a node.

Syntax

Read syntax diagramSkip visual syntax diagramfn:local-name(node)
node
The node for which the local name is to be retrieved. If node is not specified, fn:local-name is evaluated for the current context node.

Returned value

The returned value depends on whether node is specified, and the value of node:
  • If node is not specified, the local name of the context node is returned.
  • If node meets any of the following conditions, a string of length 0 is returned:
    • node is the empty sequence.
    • node is not an element node, an attribute node, or a processing-instruction node.
  • If node meets any of the following conditions, an error is returned:
    • node is undefined.
    • node is not a node.
  • Otherwise, an xs:string value is returned that contains the local name part of the expanded name for node.

Example

The following function returns the local name for node emp.
declare namespace a="http://posample.org";
fn:local-name(<a:b/>)

The returned value is b.