<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.generateId.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.generateId</api:function-name><api:suggest>fn.generateid</api:suggest><api:suggest>fn</api:suggest><api:suggest>generateid</api:suggest><api:function-link mode="xquery" fullname="fn:generate-id">/apidoc/8.0/fn:generate-id.xml</api:function-link><api:function mode="javascript" name="generateId" type="builtin" lib="fn" category="NodeBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.generateId"><api:summary>
<p xmlns="http://www.w3.org/1999/xhtml">Returns a string that uniquely identifies a given node.  </p>
<p xmlns="http://www.w3.org/1999/xhtml"> If $node is the empty sequence, the zero-length string is returned.  </p>
<p xmlns="http://www.w3.org/1999/xhtml">
If the function is called without an argument, the context item is used as
the default argument. The behavior of the function when the argument is 
omitted is the same as if the context item is passed as an argument.</p>
<p xmlns="http://www.w3.org/1999/xhtml">If the context item is undefined an error is raised:
[err:XPDY0002]. If the context item is not a node an error is raised:
[err:XPTY0004].
</p>
</api:summary><api:params><api:param name="node" type="node()?" optional="true"><api:param-description>
The node whose ID will be generated.
  </api:param-description><api:param-name>node</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 doc = cts.doc("/bar.json");
fn.generateId(doc);
=&gt; naaaaffcc704258cd
</pre>
</api:example></api:function></api:function-page>