#### 9.6.4 Directing a cross reference to the correct branch

Branch PI markers in maps allow you to specify inclusion of the same topic in more than one place in the output (see §9.6.3 Reusing the same topics with different conditions). How do you specify where a cross reference to a duplicated topic should go? DITA2Go applies two rules, in the following order:

1. If a cross reference in a named map branch targets another topic in the same branch, the cross reference goes to the instance in its own branch.
2. If a cross reference is to a topic in a different named branch, you can specify the target with a cross-reference branch PI marker placed just before the cross reference:

       <?dtall xrefbranch="branchname" ?>

   A cross-reference branch PI applies only to the very next cross reference.

If neither of these rules applies, the cross reference goes to the first instance of the topic.

Suppose in common_intro.dita you want to reference an introduction that occurs in each branch. You would insert a cross-reference branch PI in the referencing topic, just before each cross reference. For example:

    <p>The following products are described here:
     <ul>
      <?dtall xrefbranch="productA" ?>
      <li><xref href="product_intro.dita" /></li>
      <?dtall xrefbranch="productB" ?>
      <li><xref href="product_intro.dita" /></li>
    </ul>
    </p>

The references are both to the same file; the PIs sort out which instance of the file to target. So if the file referenced has conditions applied to <ph> elements in its title to yield different resulting titles, you get the correct title for each in the list items.

Previous Topic: 9.6.3 Reusing the same topics with different conditions

Next Topic: 9.6.5 Directing a content reference to the correct branch

Parent Topic: 9.6 Scoping and filtering within maps

Sibling Topics:

9.6.1 Understanding the advantages of filtering in maps

9.6.2 Designating map sections as named branches

9.6.3 Reusing the same topics with different conditions

9.6.5 Directing a content reference to the correct branch

9.6.6 Limiting the scope of keydefs by branch

9.6.7 Directing a key reference to the correct branch