Loading TOC...

MarkLogic 12 EA 2 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")

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