Loading TOC...

MarkLogic 12 EA 2 Product Documentation
fn.namespaceUri

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

Summary

Returns the namespace URI of the xs:QName of the node specified by $arg.

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 $arg is the empty sequence, the xs:anyURI corresponding to the zero-length string is returned.

If $arg is neither an element nor an attribute node, or if it is an element or attribute node whose expanded-QName (as determined by the dm:node-name accessor in the Section 5.11 node-name Accessor[DM]) is in no namespace, then the function returns the xs:anyURI corresponding to the zero-length string.

Parameters
arg The node whose namespace URI is to be returned.

Example

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

=> a

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