MarkLogic 12 EA 1 Product Documentation
xdmp:key-from-QName

xdmp:key-from-QName(
   $name as xs:QName
) as xs:string

Summary

Construct a context-independent string from a QName. This string is of the form "{namespaceURI}localname" and is suitable for use as a map key.

Parameters
name The QName to compute a key for.

Example

(: Using a QName with an in-scope namespace prefix :)
xquery version "1.0-ml";
xdmp:key-from-QName(xs:QName("xs:string"))

(: Returns output of the following form:
     {http://www.w3.org/2001/XMLSchema}string

   The generated key includes the XMLSchema namespace URI because the
   "xs" namespace binding is implicitly defined in MarkLogic.
:)

Example

(: Using a QName with an arbitrary namespace :)
xquery version "1.0-ml";
xdmp:key-from-QName(fn:QName("/my/namespace","thing"))

(: Returns output of the following form: 
     {/my/namespace}thing
 :)
Powered by MarkLogic Server | Terms of Use | Privacy Policy