Next / Previous / Contents / Shipman's homepage

12.4. generate-id(): Generate a unique identifier

The purpose of this function is to generate a string of characters that uniquely identifies a node. Such values are useful for attributes of type ID.

The function takes one optional argument, a node-set:

    generate-id(S)

where S is a node-set. If S is not given, the function generates an identifier for the context node. If S is empty, the function returns an empty string. If S contains more than one node, the function operates on the one that occurs first in the document.

Within a given execution, this function will always produce the same value for a given node. There is no guarantee that it will produce the same value on a different execution of the stylesheet.