Loading TOC...

MarkLogic 12 EA 2 Product Documentation
fn.nodeName

fn.nodeName(
   arg as Node?
) as xs.QName?

Summary

Returns an expanded-QName for node kinds that can have names. For other kinds of nodes it returns the empty sequence. If $arg is the empty sequence, the empty sequence is returned.

Parameters
arg The node whose name is to be returned.

Example

var x = fn.head(xdmp.unquote('<hello><goodbye>1</goodbye></hello>'));
fn.nodeName(x.xpath("/child::element()"));

=> hello (because the xdmp.unquote produces a Sequence 
          containing a document node, and the xpath starts at the
	  document node and selects the sequence of child elements,
	  which in this case is the root node named "hello")

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