Skip to main content

Import Conkeyrefs as Variables

If you have used conkeyrefs for variables in DITA, Paligo can import them as variables and variable sets in Paligo. For this to work, you need:

Note

Paligo can convert DITA conkeyrefs used as variables into variables and variable sets in Paligo. If you have used any other constructions for emulating variables in DITA, change to using conkeyrefs before you import into Paligo. This will allow the import to handle conversion of variables.

If you have any trouble with this, ask support for instructions about how to prepare the content.

  1. A ditamap that contains a topicref to a topic and a keydef to the variable file. For example:

    <topicref href="topics/DITA-topic-w-vars.dita"/>
    <keydef keys="products" href="topics/DITA-variables.dita"/>
  2. The variable file, which is a topic with each variable declared with an ID. For example:

     <p>Product name: <ph id="productname">product A1</ph></p>
  3. A topic that contains references to the variables, such as:

    <p>This is the product name: <ph conkeyref="products/productname"/></p>

    Where:

    • "products" is the id of the variable file, as given in the ditamap keydef

    • "productname" is the id of the variable.

  4. When you have these files, add them to a folder and zip the folder.

  5. Use the Import Wizard to import your content.

    When the import is complete, Paligo will import the variable file as a variable set and will import the conkeyref elements into variables.

Tip

To learn more about variables and variable sets in Paligo, see:

The example below shows what happens when you import DITA content with variables into Paligo (assuming the DITA content is set up correctly).

Example 1. DITA files for importing conkeyref as variables

The zip file contains a folder and inside the folder are:

  • index.ditamap

    A ditamap that contains a topicref to a topic (DITA-topic-w-vars.dita) and a keydef to the variable file (DITA-variables.dita)

  • DITA-variables.dita

    This is the variable file, where each variable is declared with an ID.

  • DITA-topic-w-vars.dita

    This is a topic that contains conkeyref references to the variable file (DITA-variables.dita).

The content of the files is:

index.ditamap

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
    <title>DITA map with variables</title>
    <topicref href="topics/DITA-topic-w-vars.dita"/>
    <keydef keys="products" href="topics/DITA-variables.dita"/>
</map>

DITA-variables.dita

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="DITAvariables">
    <title>DITA_variables</title>
    <body>
        <p>This is an example of a DITA variable file</p>
        <p>Here is the variables enclosed in PH-tags with Ids:</p>
        <p>Product name: <ph id="productname">product A1</ph></p>
        <p>Product type: <ph id="producttype">produkttype A1</ph></p>
    </body>
</topic>

DITA-topic-w-vars.dita

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="dita_topic_w_vars">
    <title>DITA topic with variables</title>
    <shortdesc></shortdesc>
    <conbody>
        <p>This is an example of a topic using variables as conkeyrefs.</p>
        <p>This is the product name: <ph conkeyref="products/productname"/></p>
        <p>This is the product type: <ph conkeyref="products/producttype"/></p>
    </conbody>
</concept>

When you import this zip into Paligo, Paligo generates:

  • A publication that contains a fork to the topic that Paligo creates for the DITA-topic-w-vars.dita file.

    Paligo has created a publication for a DITA import. The publication contains a fork to a "DITA topic with variables" topic.
  • A topic with the content from the DITA-topic-w-vars.dita file, converted to Paligo XML with Paligo variables instead of conkeyref variables.

    A topic called "DITA topic with variables" shown in the Paligo editor. It has various paragraphs, two of which contain variables that reference a variable set.
  • A variable set. Paligo creates a variable set and imports the content of the DITA.variables.dita file into it. The imported data is converted into Paligo variables.

    A variable set that Paligo has generated automatically for an imported DITA variable file. It contains a variable for product name and a variable for product type. Both variables have a value set for a "general" variant.

    The values for the variables are in a "General" column. This represents the values to use for one variant. You can add extra variants so that the variables can have different values in different circumstances.