Insert a cross-reference (xref) to an element within the current topic using the XMetaL editor

This procedure uses the XMetaL editor to set up a hypertext link within a topic.

Sometimes you may want to create hypertext jumps within the current topic. You might, for example, have a bulleted list at the top of the topic, and you'd like to link each item to a corresponding section farther down the page.

When you're making an intra-file hyperlink, there are two distinct stages:
  • Assign an ID to the target element.
  • Write an xref around the text where you want your hypertext link to appear. You'll use the target element's ID in this xref.

Say you've written a topic like the one shown below, and you wanted to link each item in the bulleted list to the appropriate section.
Intrafile xref

  1. In the opening tag of the target element – the element you want to jump to – insert an ID attribute.
    You'll use the Attribute Inspector to do this.
    This example shows what you'd see if you assigned the string "ducksid" to the section "About Ducks".
    Intrafile attributes target XM
  2. Highlight the word or phrase where you want to insert the xref.
    In this case, you'll highlight the word "Ducks" in the bulleted list.
  3. Use Search to display topics in the Search Results view.
  4. Right-click any topic, then select XMetaL Editor > Insert as Xref from the menu.
    Note: This inserts an XML cross-reference (xref). You'll need to edit its attributes so that it references the target text.
  5. Place your cursor on the newly created <xref>.
  6. Open the Attribute Inspector.
  7. In the <xref> tag's href attribute, type the location you want to reference.
    An intra-file xref uses the following syntax:
    #topicid/idstring
    where:
    • topicid is the root ID of the topic
    • idstring is the ID of the target element

    The following screen shot shows what the completed href attribute should look like.
    Intrafile jump XM 2

Your intra-file xref is complete. You can now generate output and test the results.