Automatic link targets

The generated content files contain markup that can be used to create a link to the content that produced the generated item. If no appropriate target can be found for the link an automatic target is created. The name for an automatic target is constructed by using the input file name and the number of tags that have been processed. In order for automatic targets to work correctly the following must be satisfied:

  • The name of the input file must not change from one composition pass to the next.

  • The number of tags processed must be the same in the pass that creates the generated file and the pass that read it. Additional composition passes may be required to satisfy this requirement.

The use of automatic link targets should be avoided when using output page differencing in a looseleaf publication.

These restrictions can be avoided by creating explicit target identifiers in the Content tab of the mappings. An explicit target will be used in preference to an automatic target if it occurs at the same vertical position on the page. One way to ensure this is to create the explicit target in the same mapping that produces the generated content.

Another way to avoid the need for automatic targets is to include the link information in the generated content itself. For example, to include a target in a table of contents entry you could put the following in the custom content of the mapping for a title:

<Toc1><Target id="{LevelId}"/><content/></Toc1>

where the %Toc1 mapping assigns its content to a top-level TOC entry and the LevelId variable contains the identifier for the level. The mapping that processes the level should create an explicit target for the TOC link to use.

To assist with avoiding problems related to automatic targets, an idtype attribute with value auto is added to each element in a generated file that refers to an automatic target.