home contribute faq download

FunctX XQuery Functions

fn:local-name

The local part of a node's name

Google
Webxqueryfunctions.com

Description

The fn:local-name function is useful only for element, attribute and processing instruction nodes. For an element or attribute, this is simply its name, stripped of any prefix it might have.

This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book.

Arguments and Return Type

NameType
$arg node()?
return value xs:string

Examples

declare namespace pre = "http://datypic.com/pre";
declare namespace unpre = "http://datypic.com/unpre";
let $in-xml :=
<noNamespace>
  <pre:prefixed xmlns="http://datypic.com/unpre"
           xmlns:pre="http://datypic.com/pre">
    <unprefixed pre:prefAttr="a" noNSAttr="b">123</unprefixed>
  </pre:prefixed>
</noNamespace>
return
XQuery ExampleResults
local-name($in-xml)
noNamespace
local-name($in-xml//pre:prefixed)
prefixed
local-name($in-xml//unpre:unprefixed)
unprefixed
local-name($in-xml//@pre:prefAttr)
prefAttr
local-name($in-xml//@noNSAttr)
noNSAttr

See Also

fn:nameThe qualified name of a node, as a string
fn:node-nameThe qualified name of a node, as a QName
fn:local-name-from-QNameThe local part of a QName

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Datypic XQuery Services

Recommended Reading:

XQuery