messages.xsl 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--This file is part of the DITA Open Toolkit project. See the accompanying LICENSE.md file for applicable licenses.-->
  3. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4. <xsl:output method="xml"
  5. indent="no"
  6. doctype-public="-//OASIS//DTD DITA Reference//EN"
  7. doctype-system="reference.dtd"/>
  8. <xsl:template match="/">
  9. <xsl:comment>
  10. This file is part of the DITA Open Toolkit project.
  11. See the accompanying license.txt file for applicable licenses.
  12. </xsl:comment>
  13. <xsl:comment>
  14. This file is generated based on the message information shipped
  15. in the DITA-OT, as defined in the file
  16. DITA-OT/resources/messages.xml
  17. To regenerate this topic, run the following command:
  18. DITA-OT/docsrc/ant -f build.xml generate-msg-topic
  19. Alternatively, you may use that same build file to
  20. create a PDF, HTML5, or HTML Help version of the User Guide, which
  21. will update the topic as part of the build. To rebuild PDF and HTML5,
  22. just run the command
  23. DITA-OT/docsrc/ant -f build.xml
  24. To build only one output format, run that same build command, followed
  25. by either "html", "pdf", or "htmlhelp". For example,
  26. this command will rebuild the HTML documentation (including the updated
  27. messages topic):
  28. DITA-OT/docsrc/ant -f build.xml build-html
  29. </xsl:comment>
  30. <!-- The title, shortdesc, and overview section in this topic will all
  31. be overwritten with "conref push", as long as it is built
  32. with the full userguide.ditamap. The text here is provided as
  33. a default in case the topic is generated on its own. -->
  34. <reference id="msgs">
  35. <title id="title">Error messages</title>
  36. <shortdesc id="shortdesc">This topic defines all error messages generated by the DITA-OT.</shortdesc>
  37. <refbody>
  38. <section id="overview"><p>Plug-ins may be used to add additional error messages into the toolkit;
  39. for more information, see the DITA-OT <cite>Developer Reference</cite>.</p></section>
  40. <simpletable>
  41. <xsl:attribute name="relcolwidth">1.5* 1.8* 4* 4*</xsl:attribute>
  42. <sthead>
  43. <stentry>Message ID</stentry>
  44. <stentry>Severity</stentry>
  45. <stentry>Message text</stentry>
  46. <stentry>Additional details</stentry>
  47. </sthead>
  48. <xsl:for-each select="/*/message">
  49. <xsl:sort select="@id"/>
  50. <strow id="{@id}">
  51. <stentry><msgnum><xsl:value-of select="@id"/></msgnum></stentry>
  52. <stentry>
  53. <xsl:choose>
  54. <xsl:when test="@type='INFO'">Informational</xsl:when>
  55. <xsl:when test="@type='WARN'">Warning</xsl:when>
  56. <xsl:when test="@type='ERROR'">Error</xsl:when>
  57. <xsl:when test="@type='FATAL'">Fatal</xsl:when>
  58. <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
  59. </xsl:choose>
  60. </stentry>
  61. <stentry>
  62. <xsl:call-template name="format-message">
  63. <xsl:with-param name="text" select="string(reason)"/>
  64. </xsl:call-template>
  65. <xsl:text> </xsl:text>
  66. <xsl:call-template name="format-message">
  67. <xsl:with-param name="text" select="string(response)"/>
  68. </xsl:call-template>
  69. </stentry>
  70. <stentry id="{@id}-extra">&#xA0;</stentry>
  71. </strow>
  72. </xsl:for-each>
  73. </simpletable>
  74. </refbody>
  75. </reference>
  76. </xsl:template>
  77. <xsl:template name="format-message">
  78. <xsl:param name="text"/>
  79. <xsl:choose>
  80. <xsl:when test="contains($text, '%') and not(number(substring(substring-after($text, '%'), 1, 1)) = number('NaN'))">
  81. <xsl:value-of select="substring-before($text, '%')"/>
  82. <varname>
  83. <xsl:text>%</xsl:text>
  84. <xsl:value-of select="substring(substring-after($text, '%'), 1, 1)"/>
  85. </varname>
  86. <xsl:call-template name="format-message">
  87. <xsl:with-param name="text" select="substring(substring-after($text, '%'), 2)"/>
  88. </xsl:call-template>
  89. </xsl:when>
  90. <xsl:otherwise>
  91. <xsl:value-of select="$text"/>
  92. </xsl:otherwise>
  93. </xsl:choose>
  94. </xsl:template>
  95. <!-- To create each as a nested topic -->
  96. <!--
  97. <xsl:for-each select="/*/message">
  98. <reference id="{@id}">
  99. <title><xsl:value-of select="@id"/></title>
  100. <shortdesc><xsl:value-of select="reason"/></shortdesc>
  101. <refbody>
  102. <section><title>User response</title><p><xsl:value-of select="response"/></p></section>
  103. </refbody>
  104. </reference>
  105. </xsl:for-each>
  106. -->
  107. </xsl:stylesheet>