Setting up variables using key references that reuse existing elements

Last Updated : Oct 23, 2015 |
Prolog information
Before you begin
Create the necessary keymaps. See the topic Creating key maps to define key references for variables.
This procedure provides the steps for defining the key definitions (keydefs) in special maps that reuse existing elements (indirect keyrefs). You can include indirect keydefs in the same maps as keyrefs that define the values directly in the maps.
Important:
  • The elements you want to reuse must be in different topics.
  • Because of the way that keys are referenced in the topics, each variable you want to use must always be specified directly in the maps or must always be referenced indirectly through reuse. You cannot define a key reference that’s defined directly in some contexts and indirectly in other contexts.
  1. Add the keyref attribute to the elements you want to reuse:
    1. Open a topic that contains one of the elements you want to reuse as a keyref.
    2. In Arbortext Editor, put the cursor in the element and press Ctrl+D to open the Modify Attributes dialog box.
    3. In the keyref field, type the name of the key.
      ADDITIONAL INFORMATION:
      This is the name that you’ll use in the topics to point to this key reference. The keynames are case-sensitive and should not include any spaces or special characters.
    4. Repeat for at least one other topic that contains elements you want to reuse as keyrefs.
  2. Check out one of the maps that you have created for the keys.
  3. Put the cursor after the map element, press Enter, and select keydef.
  4. When the Modify Attributes dialog display, type a name for the key in the keys field.
  5. When the Modify Attributes dialog displays, type a name for the key in the keys field and click OK.
    ADDITIONAL INFORMATION:
    This is the name that you’ll use in the topics to point to this key reference. The keynames are case-sensitive and should not include any spaces or special characters.
  6. In the desktop repository, navigate to the topic that contains the element you want to reference in this map, right-click and select Properties, and copy the Identifier.
  7. Paste the identifier you copied into the href field.
  8. Click OK.
  9. Check in the map.
  10. Repeat steps 2 through 9 for each of your key maps.
    ADDITIONAL INFORMATION:
    It’s very important that the href field for the keyrefs in each map point to a different topic.
  11. Add a new last chapter to the publication and then add the key map to the chapter and set the format attribute to ditamap like you do for other maps.
    ADDITIONAL INFORMATION:
    The use of the keydef elements signal the processor that the map contains key references instead of topics.
  12. If you want to use the same bookmap and apply different values in different publications, apply the appropriate condition to each key map.
  13. If you added multiple conditionalized keymaps to your publication, select the Conditions tab in Publication Manager to select the condition to apply.
Next steps
Use the variables (keydefs) in your topics.