<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.name.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.name</api:function-name><api:suggest>fn.name</api:suggest><api:suggest>fn</api:suggest><api:suggest>name</api:suggest><api:function-link mode="xquery" fullname="fn:name">/apidoc/8.0/fn:name.xml</api:function-link><api:function mode="javascript" name="name" type="builtin" lib="fn" category="NodeBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.name"><api:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns the name of a node, as an <code>xs:string</code> that is either the
zero-length string, or has the lexical form of an <code>xs:QName</code>.
</p><p xmlns="http://www.w3.org/1999/xhtml">
If the argument is omitted, it defaults to the context node. If the context
item is undefined an error is raised: [err:XPDY002]. If the context item is
not a node an error is raised: [err:XPTY0004]. 
</p><p xmlns="http://www.w3.org/1999/xhtml">
If the argument is supplied and is the empty sequence, the function
returns the zero-length string.
</p><p xmlns="http://www.w3.org/1999/xhtml">
If the target node has no name (that is, if it is a document node, a
comment, a text node, or a namespace node having no name), the
function returns the zero-length string.
</p>
<p xmlns="http://www.w3.org/1999/xhtml">
If the specified node was created with a namespace prefix, that namespace
prefix is returned with the element localname (for example,
<code>a:hello</code>).  Note that the namespace prefix is not always the same
prefix that would be returned if you serialized the QName of the node, as
the serialized QName will use the namespace from the XQuery context in
which it was serialized.</p>
</api:summary><api:params><api:param name="arg" type="node()?" optional="true"><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>String</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var x = xdmp.unquote('&lt;a:hello xmlns:a="a"/&gt;')
   .toArray()[0].root.xpath("/element()");
fn.name(x);

=&gt; a:hello
</pre></api:example></api:function></api:function-page>