Create a cross-reference to an element within the same topic

You may want to create links within a topic; for example, have a bulleted list which links each item to a corresponding section in the topic.

When you create a link referencing another part of the same topic, you need to first add an ID attribute to the target element and then create the cross-reference.

To create the internal cross-reference:

  1. Add an ID attribute in the element to which you want to cross-reference.

    For example, if you had a bullet list at the top of your topic and you wanted to link each list item to a section later in the topic, you would add an ID to each section element: <section id="firstbullet">

  2. Place the cursor where you want to insert the cross-reference.
    Note: You must be within an element that allows an <xref> element.
  3. In the DITA Map view, right-click your topic.
    If you do not have the map containing the topic open in the DITA Map view, either open the map or perform a search so you can display the topic in a view.
  4. Select one of the following depending on your environment and XML editor:
  5. Right-click the cross-reference and do one of the following depending on your XML editor:
    • For oXygen XML Editor: Click Edit Attributes.
    • For XMetaL XML Editor: Open the Attribute Inspector.
  6. In the Value box for the href attribute, add the ID attribute for the topic and the ID attribute for the element that you want to reference.
    Use the following syntax:
    filename.xml#topicid/idstring
    where:
    • filename is the file name of the topic
    • topicid is the root ID of the topic
    • idstring is the ID of the target element
    For example, if your topic ID is acb4321987654321 and the target element's ID is firstbullet, then the value would be:
    acb4321987654321.xml#acb4321987654321/firstbullet
  7. In the cross-reference element, type the text that you want to display.
    For example:
    <xref href="acb4321987654321.xml#acb4321987654321/firstbullet">This is the first bullet point.</xref>