MarkLogic 10 Product Documentation
xdmp.QNameFromKey

xdmp.QNameFromKey(
   key as String
) as xs.QName

Summary

Construct a QName from a string of the form "{namespaceURI}localname". This function is useful for constructing Clark notation parameters for the xdmp.xsltEval and xdmp.xsltInvoke functions.

Parameters
key The string from which to construct a QName.

Example

// Using a key based on a QName with an in-scope namespace prefix
'use strict';
const key = xdmp.keyFromQName('xs:string');
const qname = xdmp.QNameFromKey(key);
[key, qname];

// Returns output of the following form:
//   ["{http://www.w3.org/2001/XMLSchema}string", "xs:string"]
//
// The generated key uses the "xs" namespace prefix because
// this binding is implicitly defined in MarkLogic.

Example

// Using a key based on an arbitrary namespace
'use strict';
xdmp.QNameFromKey('{/my/namespace}thing');

// Returns output of the following form:
//   thing
Powered by MarkLogic Server | Terms of Use | Privacy Policy