Loading TOC...

MarkLogic 12 EA 1 Product Documentation
fn:generate-id

fn:generate-id(
   [$node as node()?]
) as xs:string

Summary

Returns a string that uniquely identifies a given node.

If $node is the empty sequence, the zero-length string is returned.

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.

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].

Parameters
node The node whose ID will be generated.

Example

let $x := doc("auction.xml")
return
fn:generate-id($x)

=> n965c71980e85a011

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