<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.nodeName.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.nodeName</api:function-name><api:suggest>fn.nodename</api:suggest><api:suggest>fn</api:suggest><api:suggest>nodename</api:suggest><api:function-link mode="xquery" fullname="fn:node-name">/apidoc/8.0/fn:node-name.xml</api:function-link><api:function mode="javascript" name="nodeName" type="builtin" lib="fn" category="AccessorBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.nodeName"><api: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.
</api:summary><api:params><api:param name="arg" type="node()?"><api:param-description>
The node whose name is to be returned.
  </api:param-description><api:param-name>arg</api:param-name><api:param-type>Node?</api:param-type></api:param></api:params><api:return>xs.QName?</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var x = xdmp.unquote('&lt;hello&gt;&lt;goodbye&gt;1&lt;/goodbye&gt;&lt;/hello&gt;').toArray()[0];
fn.nodeName(x.xpath("/child::element()"));

=&gt; hello (because the xdmp.unquote produces a ValueIterator 
          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")
</pre>

</api:example></api:function></api:function-page>