MarkLogic Server 11.0 Product Documentation
fn.namespaceUriForPrefix

fn.namespaceUriForPrefix(
   prefix as String?,
   element as Node
) as String?

Summary

Returns the namespace URI of one of the in-scope namespaces for $element, identified by its namespace prefix.

If $element has an in-scope namespace whose namespace prefix is equal to $prefix, it returns the namespace URI of that namespace. If $prefix is the zero-length string or the empty sequence, it returns the namespace URI of the default (unnamed) namespace. Otherwise, it returns the empty sequence.

Prefixes are equal only if their Unicode code points match exactly.

Parameters
prefix A namespace prefix to look up.
element An element node providing namespace context.

Example

const x = xdmp.unquote(
  '<ex:hello xmlns:ex="http://example.com/example">1</ex:hello>');
const el = fn.head(x).xpath("/element()");
fn.namespaceUriForPrefix("ex", el);

=> the namespace URI corresponding to
   "http://www.example.com/example".  
Powered by MarkLogic Server | Terms of Use | Privacy Policy