fn:namespace-uri

fn:namespace-uri(
   [$arg as node()?]
) as xs:anyURI

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

xquery version "1.0-ml";
declare namespace a="aaa";

let $x := <a:hello/>
return
fn:namespace-uri($x)

=> aaa
Powered by MarkLogic Server | Terms of Use | Privacy Policy