Cross-references: creating

This example illustrates cross-referencing within a procedure that lists steps to perform a given task. Cross-referencing is needed because a step will often have to refer to other steps in the same procedure. Cross-referencing can be accomplished through the use of referents.

Assigning each list in the document a unique number allows the referents to have unique names, even if steps in different lists have the same name. This will ensure that cross-references always refer to steps in the current list.

  global integer list-number
  global integer step-number
  ...
  element list
    set step-number to 1
    output "%c"
    increment list-number
  
  element step
    set referent "%d(list-number)/%v(id)" to "%d(step-number)"
                  when attribute id is specified
    output "%c"
    increment step-number
  
  element step-ref
    output referent "%d(list-number)/%v(id)"
    suppress