DITA ID Attributes Specifications

DITA ID attributes and their scopes are specified in Serna document templates:

  1. Serna document template section with DITA ID specifications

    <id-scope-defs>
      <id-scope-def>
        <pattern>*[@class="- topic/topic "]</pattern>
        <attr-name>id</attr-name>
        <id-def>
          <pattern>*</pattern>
          <attr-name>id</attr-name>
        </id-def>
      </id-scope-def>
    </id-scope-defs>
  2. List of DITA ID scope definitions

    <id-scope-defs>
      <!-- Content: (id-scope-def*) --> 
    </id-scope-defs>
    1. id-scope-defs - the list of DITA ID scope definitions.

    2. id-scope-def - DITA ID scope definition (optional).

  3. DITA ID scope definition

    <id-scope-def>
      <!-- Content: ( pattern, 
                      attr-name, 
                      id-def*,
                      idref-def* 
                     ) -->
    </id-scope-def>
    Definition of the DITA ID uniqueness scope:
    1. pattern - XSLT pattern specifies the scoping element - element in the scope of which DITA ID attributes must be unique (required).

    2. attr-name - QName specifies the name of the DITA ID attribute of the scoping element (required).

    3. id-def - DITA ID definition (optional).

    4. idref-def - IDREF definition (optional).

  4. DITA ID definition

    <id-def>
      <!-- Content: ( pattern, 
                      attr-name ) -->
    </id-def>
    Definition of the DITA ID attribute and its element:
    1. pattern - XSLT pattern specifies the element which may have the DITA ID attribute (required).

    2. attr-name - QName specifies the name of the DITA ID attribute of the above-mentioned element (required).

  5. IDREF definition

    <idref-def>
      <!-- Content: ( pattern, 
                      attr-name ) -->
    </idref-def>
    Definition of the IDREF attribute and its element:
    1. pattern - XSLT pattern specifies the element which may have the IDREF attribute (required).

    2. attr-name - QName specifies the name of the IDREF attribute of the above-mentioned element (required).

    idref-def is used to validate references to elements with DITA IDs.

If you have your own DITA specialization, you can specify DITA ID attributes and their scopes in a document template. As an example, see DITA ID specifications at: sernaInstallationPath/plugins/dita/dita-scope-defs.ent:

<t:id-scope-defs>
  <t:id-scope-def>
    <t:pattern>*[contains(@class, ' topic/topic ') or
                 contains(@class, ' map/map ')]</t:pattern>
    <t:attr-name>id</t:attr-name>
    <t:id-def>
      <t:pattern>*</t:pattern>
      <t:attr-name>id</t:attr-name>
    </t:id-def>
    <t:idref-def>
      <t:pattern>*[contains(@class, ' topic/xref ') 
        or contains(@class, ' topic/link ')]</t:pattern>
      <t:attr-name>href</t:attr-name>
    </t:idref-def>
    <t:idref-def>
      <t:pattern>*[@conref != '']</t:pattern>
      <t:attr-name>conref</t:attr-name>
    </t:idref-def>
  </t:id-scope-def>
</t:id-scope-defs>
Related concepts
Maintenance of DITA ID Uniqueness
DITA ID Validation