<?xml version="1.0" encoding="UTF-8"?>
<!--Arbortext, Inc., 1988-2011, v.4002-->
<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
 "reference.dtd">
<?Pub Inc?>
<reference id="plugin-addgeneratedtext" xml:lang="en-us">
<title>Adding new generated text</title>
<shortdesc>Generated text is the term for strings that are automatically
added by the build, such as "Note" before the contents of a &lt;note>
element.</shortdesc>
<refbody>
<section>       <p>The generated text extension point is used to add
new strings to the default set of Generated Text.</p><dl><dlentry>
<dt><codeph>dita.xsl.strings</codeph></dt>
<dd>Add new strings to generated text file. </dd>
</dlentry></dl>       </section>
<example><title>Example</title><p>First copy the file <filepath>xsl/common/strings.xml</filepath> 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:</p><codeblock>&lt;?xml version="1.0" encoding="utf-8"?>
&lt;!-- Provide strings for my plug-in; this plug-in supports
     English, Icelandic, and Russian. -->
&lt;langlist>
  &lt;lang xml:lang="en"     filename="mystring-en-us.xml"/>
  &lt;lang xml:lang="en-us"  filename="mystring-en-us.xml"/>
  &lt;lang xml:lang="is"     filename="mystring-is-is.xml"/>
  &lt;lang xml:lang="is-is"  filename="mystring-is-is.xml"/>
  &lt;lang xml:lang="ru"     filename="mystring-ru-ru.xml"/>
  &lt;lang xml:lang="ru-ru"  filename="mystring-ru-ru.xml"/>
&lt;/langlist></codeblock><p>Next, copy the file <filepath>xsl/common/strings-en-us.xml</filepath> 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 <filepath>mystring-en-us.xml</filepath> might
contain:</p><codeblock>&lt;?xml version="1.0" encoding="utf-8"?>
&lt;strings xml:lang="en-us">
  &lt;str name="String1">English generated text&lt;/str>
  &lt;str name="Another String">Another String in English&lt;/str>
&lt;/strings></codeblock><p>Use the following extension code to include
your strings in the set of generated text: </p><codeblock>&lt;plugin id="com.example.strings">
  &lt;feature extension="dita.xsl.strings" file="xsl/my-new-strings.xml"/>
&lt;/plugin></codeblock><p>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":</p><?Pub Caret 87?><codeblock>&lt;xsl:call-template name="getString">
  &lt;xsl:with-param name="stringName" select="'Another String'"/>
&lt;/xsl:call-template>
</codeblock>       </example>
</refbody>
</reference>
<?Pub *0000002860?>
