Loading TOC...

fn:prefix-from-QName

fn:prefix-from-QName(
   arg as xs:QName?
) as xs:NCName?

Summary

Returns an xs:NCName representing the prefix of $arg. The empty sequence is returned if $arg is the empty sequence or if the value of $arg contains no prefix.

Parameters
arg A qualified name.

Example

xquery version "1.0-ml";
declare namespace ex="http://www.example.com/example";

fn:prefix-from-QName(
   fn:QName("http://www.example.com/example", "person") )

=> empty sequence, because the QName constructed
   by fn:QName does not have a prefix

Example

let $qn := fn:QName("http://www.w3.org/XML/1998/namespace", "lang")
return
fn:prefix-from-QName(fn:node-name( attribute {$qn} {"en"}))

=> xml

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