xf:local-name

Returns the local name (as a string) of $node-var.

Signatures

xf:local-name(xf:node? $node-var) —> xs:string

Arguments

Data Type
Argument
Description

node?

$node-var

Represents the node to get the local name from.

Returns

Returns the local name (as a string) of $node-var.

Examples

Simple

The following XML document defines the namespace called xacme:

<?xml version='1.0'?>
<mydoc xmlns:xacme="http://www.acme.com/foo"> <xacme:n/> </mydoc> 

The preceding XML Document associates the namespace prefix xacme to the URI: http://www.acme.com/foo. The string xacme:n is qualified name for the URI/local name pair: ("http://www.acme.com/foo", "n").

The following example query returns the local part of the URI/local name pair as shown in the following XQuery code:

let $a := <mydoc xmlns:xacme="http://www.acme.com/foo"> <xacme:n/> </mydoc>
return <name>{xf:local-name($a/*[1])}</name> 

The preceding query generates the following result:

<name>n</name> 

Related Topics

W3C local-name function description.