Strings and Variables - which are used where? #DITA-OT #HTML #PDF

Vic Mortelmans

I'm puzzled by the DITA-OT mechanism for generated text.

I find two repositories where (localized) generic text is stored. Based on examples, both seem to be retrievable using the "getVariable" XSL template.

1/ Strings
  • location: dita-ot-3.4\plugins\org.dita.base\xsl\common\strings-nl-nl.xml
  • entries look like: <str name="Caution">Let op!</str>
  • customizable by using the "dita.xsl.strings" extension point in plugin.xml
2/ Variables (common vars)
  • location: dita-ot-3.4\plugins\org.dita.pdf2\cfg\common\vars\nl.xml
  • entries look like: <variable id="Foot note">Voetnoot.</variable>
  • customizable only by adding a file to the "Customization" directory to my plugin and updating its catalog.xml
Because they belong to different plugins, I can guess that the "Strings" can be used in all output types, and the "Variables" only in PDF output.

I am making a plugin that will produce both PDF and HTML5.

Some questions:

  1. Are most of the above findings/assumptions correct? 
  2. When customizing generated text for my plugin, can I ignore the "Variables" alltogether and use only "Strings" as a repository for any of my custom text, that is retrieved using the "getVariable" template?
  3. There's also a file "commonvariables.xml" containing text that is not translated, how can I customize that in my plugin? 

Thanks for sharing some experience,
Best regards,


Vic Mortelmans

Note to self: custom texts can have parametrized parts, e.g.:

<variable id="Body odd footer"><param ref-name="documentnumber"/>&#xA0;<param ref-name="buildlanguage"/>&#xA0;<param ref-name="builddate"/></variable>

You fill them in when calling "getVariable" by providing "params", like this:

                <xsl:call-template name="getVariable">
                    <xsl:with-param name="id" select="'Body odd footer'"/>
                    <xsl:with-param name="params">
                          <xsl:value-of select="//*[contains(@class, ' topic/othermeta ') and @name='documentnumber']/@content"/>
                          <xsl:value-of select="$buildParameterLanguage"/>
                          <xsl:value-of select="document($revisedDate)/reviseddate/@modified"/>

This does however NOT work, when the custom text is defined as a <str> element, e.g.:

    <str name="Body even footer"><param ref-name="documentnumber"/>&#xA0;<param ref-name="buildlanguage"/>&#xA0;<param ref-name="builddate"/></str>

Here the parametrized fields will be left out, whatever you provide as "params" when calling "getVariable".

I've found no documentation on this so far. Maybe someone more knowledgeable can confirm that these assumptions (based on experience) are true?

Best regards,