MarkLogic 10 Product Documentation
fn.inScopePrefixes

fn.inScopePrefixes(
   element as Node
) as Sequence

Summary

Returns the prefixes of the in-scope namespaces for $element. For namespaces that have a prefix, it returns the prefix as an xs:NCName. For the default namespace, which has no prefix, it returns the zero-length string.

Parameters
element The element whose in-scope prefixes will be returned.

Example

const x = xdmp.unquote('<a:hello xmlns:a="a">hello'
         +   '<b:goodbye xmlns:b="b">goodbye</b:goodbye>'
	 + '</a:hello>');
fn.inScopePrefixes(fn.head(x).xpath("/element()"));

=> ("a", "xml")

const x = xdmp.unquote('<a:hello xmlns:a="a">hello'
         +   '<b:goodbye xmlns:b="b">goodbye</b:goodbye>'
	 + '</a:hello>');
fn.inScopePrefixes(fn.head(x).xpath("/element()/element()"));

=> ("b", "a", "xml")
Powered by MarkLogic Server | Terms of Use | Privacy Policy