Loading TOC...

MarkLogic Server 11.0 Product Documentation
fn.localName

fn.localName(
   [arg as Node?]
) as String

Summary

Returns the local part of the name of $arg as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName.

If the argument is omitted, it defaults to the context node. If the context item is undefined an error is raised: [err:XPDY0002]. If the context item is not a node an error is raised: [err:XPTY0004].

If the argument is supplied and is the empty sequence, the function returns the zero-length string.

If the target node 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 value returned will be the local part of the expanded-QName of the target node (as determined by the dm:node-name accessor in Section 5.11 node-name Accessor[DM]. This will be an xs:string whose lexical form is an xs:NCName.

Parameters
arg The node whose local name is to be returned.

Example

var x = fn.head(xdmp.unquote('<a:name xmlns:a="a"/>')
   ).root.xpath("/element()");
fn.localName(x);

=> hello

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.