Adding new diagnostic messages Use the dita.xsl.messages extension point to add plug-in-specific messages to the diagnostic messages that are generated by DITA-OT. These messages then can be used by any XSLT override. type iddiagnostic messages plug-instroubleshooting troubleshootingplug-ins XSLTerrors preprocessingXSLT Create an XML file that contains the messages that you want to add. Be sure to use the following format for the XML file: <messages> <!-- See resources/messages.xml for the details. --> <message id="PrefixNumberLetter" type="error-severity"> <reason>Message text</reason> <response>How to resolve</response> </message> </messages>where:
  • Prefix is a sequence of four capital letters.By convention, the toolkit messages use DOTX but any sequence can be used by plug-in developers.
  • Number is a three-digit integer.
  • Letter is one of the following upper-case letters: I, W, E, F. It should match the value that is specified for the type attribute.As the id attribute is used as a whole and not decomposed by recent versions of the toolkit, you could use any sequence as the message identifier. Nevertheless, to facilitate reuse of the plug-in and make it more readable by other users, we recommend following these guidelines.
  • error-severity specifies the severity of the error. It must be one of the following values:
    The FATAL value throws a fatal error message in XSLT and an exception in Java. If the id attribute of your message is equal to the id of a default DITA-OT message, your message will override the default one.
Create a plugin.xml file that contains the following content: <plugin id="plugin-id"> <feature extension="dita.xsl.messages" file="file"/> </plugin>

where:

  • plugin-id is the plug-in identifier, for example, com.example.newmsg.
  • file is the name of the new XML file containing the messages created in step , for example, myMessages.xml.
Install the plug-in.

Add the following call in XSLT modules to generate a message when a specific condition occurs:

<xsl:call-template name="output-message"> <xsl:with-param name="id">prefixnumberletter</xsl:with-param> <xsl:with-param name="msg">Message text and parameters.</xsl:with-param> </xsl:call-template>

Use the ctx parameter if calling from a function.