f:generate-id

f:generate-id — Generate a unique identifier for an element.

Function:
{http://docbook.org/ns/docbook/functions}generate-id#1
{http://docbook.org/ns/docbook/functions}generate-id#2
Defined in:
modules/functions.xsl (2)
Used in:
main.xsl, modules/chunk.xsl
Used by:

Synopsis

f:generate-id($node as element()) as xs:string
f:generate-id($node as element(),
$use-xml-id as xs:boolean) as xs:string

Description

This function returns a unique ID for an element. The ID is generated from the names of the ancestors and preceding siblings of the element. This value will be consistent across different transformations as long as the ancestors and preceding siblings remain unchanged.

If use-xml-id is true and there’s an element with a xml:id attribute among the ancestors, the unique identifier is rooted at that element, rather than traversing all the way to the root of the document.

Disabling this feature by setting use-xml-id to false allows for the creation of globally unique IDs with f:unique-id().