Generated text is the term for strings that are automatically added by the build, such as "Note" before the contents of a <note> element.
The generated text extension point is used to add new strings to the default set of Generated Text.
First copy the file xsl/common/strings.xml to your plug-in, and edit it to contain the languages that you are providing translations for ("en-us" must be present). The new strings file will look something like this:
<?xml version="1.0" encoding="utf-8"?>
<!-- Provide strings for my plug-in; this plug-in supports
English, Icelandic, and Russian. -->
<langlist>
<lang xml:lang="en" filename="mystring-en-us.xml"/>
<lang xml:lang="en-us" filename="mystring-en-us.xml"/>
<lang xml:lang="is" filename="mystring-is-is.xml"/>
<lang xml:lang="is-is" filename="mystring-is-is.xml"/>
<lang xml:lang="ru" filename="mystring-ru-ru.xml"/>
<lang xml:lang="ru-ru" filename="mystring-ru-ru.xml"/>
</langlist>
Next, copy the file xsl/common/strings-en-us.xml to your plug-in, and replace the content with your own strings (be sure to give them unique name attributes). Do the same for each language that you are providing a translation for. For example, the file mystring-en-us.xml might contain:
<?xml version="1.0" encoding="utf-8"?> <strings xml:lang="en-us"> <str name="String1">English generated text</str> <str name="Another String">Another String in English</str> </strings>
Use the following extension code to include your strings in the set of generated text:
<plugin id="com.example.strings"> <feature extension="dita.xsl.strings" file="xsl/my-new-strings.xml"/> </plugin>
The string is now available to the "getString" template used in many DITA-OT XSLT files. For example, if processing in a context where the xml:lang value is "en-us", the following call would return "Another String in English":
<xsl:call-template name="getString"> <xsl:with-param name="stringName" select="'Another String'"/> </xsl:call-template>