Cross-referencing a step

Cross-references to steps are accomplished with the xref element with a type attribute of li.

When referring a reader to a step in a task, you should not hard-code the step number. In different contexts (such as when the content is filtered or transcluded) the step number may be different, or if a step is added, there is a high risk that the hard-coded reference won't be updated.

You must always use the xref element to cross-reference steps, with the type attribute set to li. (The li element is the ancestor of the step element.)

You can only reference a step by its id attribute; therefore, before you can cross-reference to a step, you must ensure that the step element's id attribute has a value.

The following example illustrates how to cross-reference a step number. Don't include any text in the xref element, otherwise this text will be rendered (in most publishing tools), not the step number.

<task id="keypad1">
<step id="a"> 
      <cmd>Repeat step <xref href="#keypad1/a" type="li" /> until the red light displays.</cmd> 

Referring to a step in another topic is almost identical; the difference is that the href attribute will include the file name of the other topic. Again, you must set the type attribute to li.

<cmd>Complete step <xref href="c_panel.dita#keypad2/b" type="li" /> of 
the PIN recovery procedure.</cmd>