Skriftlig InfoDITA publishingDITA variablesDefining a variable in a library topic

Defining a variable in a library topic

You can use a library topic to define variables and give them the necessary values.

(This procedure is based on the Tridion Docs database repository and Oxygen XML editor. Other tools have similar functionality.)

On this page

Prerequisites

You have all the tools available, and the necessary rights to develop new content. A suitable folder is available in the database structure.

Context

The library topic you will make must only be used to define variables. You cannot use the same library for both variables and text fragments.

You can make a new library in one of the following ways:

Procedure

  1. From the editor's main menu, select Tridion DocsBrowse repository.
  2. In the database structure, navigate to the folder where you want to establish the new library topic.
  3. To duplicate an existing library:
    1. Right-click on one of the existing libraries and select Duplicate.

      A copy of the existing library is established.

    2. Right-click on the new library and select Properties.

      Make sure you do this with the new library! You must not change the old!

    3. In the dialogue box that opens, fill in all relevant fields with metadata.

      Follow the rules for metadata. Identifiy the new library so that it is easy to see that it is used to define variables.

    4. Click OK.
    5. Select the new library, then right-click and select Check out.
    6. Assign the new values.

      The tags look like this:

      <keyword varref="VARIABLE">
         VALUE
      </keyword>
      
    7. Select Tridion DocsCheck in when you have finished.
  4. To make an new library from a template:
    1. On the toolbar on the right side, click the green + symbol to bring up relevant templates.

      Tridion Docs / Browse repository toolbar

    2. Select a template.
    3. In the dialogue box that opens, fill in all relevant fields with metadata.

      Follow the rules for metadata. Identifiy the new library so that it is easy to see that it is used to define variables.

    4. Click OK.
    5. Select the new library, then right-click and select Check out.
    6. Change the relevant variable definitions by altering the varid attributes and providing new values.

      The tags look like this:

      <keyword varref="VARIABLE">
         VALUE
      </keyword>
      
    7. Select Tridion DocsCheck in when you have finished.
  5. To make an new library from scratch:
    1. On the toolbar on the right side, click the green + symbol to bring up relevant templates.

      Tridion Docs / Browse repository toolbar

    2. Select an empty library template.
    3. In the dialogue box that opens, fill in all relevant fields with metadata.

      Follow the rules for metadata. Identifiy the new library so that it is easy to see that it is used to define variables.

    4. Click OK.
    5. Select the new library, then right-click and select Check out.
    6. Add a <p> element.
    7. Inside the <p> element, add a <keyword> element.
    8. Define the variable by setting the varid attribute and providing the requested value.

      The tags look like this:

      <p>
      <keyword varref="VARIABLE">
         VALUE
      </keyword>
      </p>
      
    9. Repeat (f), (g) and (h) to define additional variables.
    10. Select Tridion DocsCheck in when you have finished.

Tip

Consider building a modular system with variable definitions. This allows reuse of definitions and values, and provides a high degree of consistency.

These pages only explain how variables are used in DITA publishing. If you want additional explanations about the principle of variables, see under Methodology and especially Using variables in the text.


All external links open in a new window. I take no responsibility for information on external websites, even if I have linked to them. Please report links that do not work.

The information on this page represents my personal opinions and my understanding of the topic being described. Feel free to link to the page, but do not copy large parts of the content without permission. I take no responsibility for any errors, misunderstandings or missing information. I also take no responsibility for any mistakes you may make or cause as a result of incorrect or missing information. You are welcome to contribute with comments, relevant experiences or additional information. See Editor and contact information.