#### 28.5.2 Specifying HTML options for cross-reference formats

You might not want every cross reference in your document to become a link in the HTML output, or you might want to specify HTML attributes for the links generated from some cross references. You can choose to have DITA2Go delete cross references of a certain format, convert them to text, redirect them to top-of-page, or enhance them with link attributes:

    [XrefStyles]
    ; xref format name = properties (Delete, Text, NoRef, or LinkSrc)
    ; if omitted, xref is treated as link

These properties have the following effects:

Delete | Omits the cross reference entirely from HTML output. You can assign this property to remove unwanted page references, provided you have set up the format so that deleting the cross-reference content leaves readable text.
Text | Prevents creation of the <a href=... > tag, so the cross reference does not become a link.
NoRef | Creates the <a href=... > tag, but omits any hash part of the href attribute; for example, file.htm#heading would become just file.htm. The result is that the jump goes to the start of the file, not to a point within the file. Assign this property if you want the top of the page to show, instead of the referenced object, when a jump goes to a split file.
LinkSrc | Allows a DITA2Go macro in the href attribute of the link; you define the macro in section [XrefStyleLinkSrc]. If you assign property LinkSrc to a cross reference, and also to a character format applied to the same cross reference (see §28.2.4 Specifying link properties with macros), the cross-reference LinkSrc macro prevails. In the macro definition you can use predefined macro variable <$$_linksrc>, which provides the normal href content of the link.

For example:

    [XrefStyles]
    zSectionLink=NoRef
    Heading & Page=Text
    Page=Delete

With these settings, DITA2Go would do the following:

- Omit the #heading part of the href attribute from any link generated from a cross reference that uses the zSectionLink format.
- Render any cross reference that uses the Heading & Page format as plain text rather than as a link.
- Omit any cross reference that uses the Page format.

To use macros (see §37. Working with macros) in the href attribute of the links generated from cross references, you assign property LinkSrc to the cross-reference format, and you specify the macro in the following section:

    [XrefStyleLinkSrc]
    ; xref format name = text macro to use in the href attribute
    ;  of the xref link; <$$_linksrc> is available to use in the macro,
    ;  with the normal href content.

To assign properties LinkSrc and NoRef to paragraph formats, see:

§28.2.4 Specifying link properties with macros

§28.3.1 Forcing links to top-of-page for selected paragraph formats.

Previous Topic: 28.5.1 Specifying HTML options for all cross references

Next Topic: 28.6 Linking to other files and other DITA2Go projects

Parent Topic: 28.5 Converting DITA cross-reference links to HTML

Sibling Topics:

28.5.1 Specifying HTML options for all cross references