Loading TOC...

MarkLogic 10 Product Documentation
xdmp:QName-from-key

xdmp:QName-from-key(
   $key as xs: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:xslt-eval and xdmp:xslt-invoke 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 :)
xquery version "1.0-ml";
let $key := xdmp:key-from-QName(xs:QName("xs:string"))
let $qname := xdmp:QName-from-key($key)
return ($key, $qname)

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

Example

(: Using a key based on an arbitrary namespace :)
xquery version "1.0-ml";
xdmp:QName-from-key("{/my/namespace}thing")

(: Returns output of the following form: 
     thing
 :)

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