admon.xsl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?xml version="1.0" encoding="ASCII"?>
  2. <!--This file was created automatically by html2xhtml-->
  3. <!--from the HTML stylesheets.-->
  4. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
  5. <!-- ********************************************************************
  6. $Id: admon.xsl 9352 2012-05-12 23:17:11Z bobstayton $
  7. ********************************************************************
  8. This file is part of the XSL DocBook Stylesheet distribution.
  9. See ../README or http://docbook.sf.net/release/xsl/current/ for
  10. copyright and other information.
  11. ******************************************************************** -->
  12. <xsl:template match="*" mode="admon.graphic.width">
  13. <xsl:param name="node" select="."/>
  14. <xsl:text>25</xsl:text>
  15. </xsl:template>
  16. <xsl:template match="note|important|warning|caution|tip">
  17. <xsl:choose>
  18. <xsl:when test="$admon.graphics != 0">
  19. <xsl:call-template name="graphical.admonition"/>
  20. </xsl:when>
  21. <xsl:otherwise>
  22. <xsl:call-template name="nongraphical.admonition"/>
  23. </xsl:otherwise>
  24. </xsl:choose>
  25. </xsl:template>
  26. <xsl:template name="admon.graphic">
  27. <xsl:param name="node" select="."/>
  28. <xsl:value-of select="$admon.graphics.path"/>
  29. <xsl:choose>
  30. <xsl:when test="local-name($node)='note'">note</xsl:when>
  31. <xsl:when test="local-name($node)='warning'">warning</xsl:when>
  32. <xsl:when test="local-name($node)='caution'">caution</xsl:when>
  33. <xsl:when test="local-name($node)='tip'">tip</xsl:when>
  34. <xsl:when test="local-name($node)='important'">important</xsl:when>
  35. <xsl:otherwise>note</xsl:otherwise>
  36. </xsl:choose>
  37. <xsl:value-of select="$admon.graphics.extension"/>
  38. </xsl:template>
  39. <xsl:template name="graphical.admonition">
  40. <xsl:variable name="admon.type">
  41. <xsl:choose>
  42. <xsl:when test="local-name(.)='note'">Note</xsl:when>
  43. <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
  44. <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
  45. <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
  46. <xsl:when test="local-name(.)='important'">Important</xsl:when>
  47. <xsl:otherwise>Note</xsl:otherwise>
  48. </xsl:choose>
  49. </xsl:variable>
  50. <xsl:variable name="alt">
  51. <xsl:call-template name="gentext">
  52. <xsl:with-param name="key" select="$admon.type"/>
  53. </xsl:call-template>
  54. </xsl:variable>
  55. <div>
  56. <xsl:call-template name="common.html.attributes"/>
  57. <xsl:call-template name="id.attribute"/>
  58. <xsl:if test="$admon.style != ''">
  59. <xsl:attribute name="style">
  60. <xsl:value-of select="$admon.style"/>
  61. </xsl:attribute>
  62. </xsl:if>
  63. <table border="{$table.border.off}">
  64. <!-- omit summary attribute in html5 output -->
  65. <xsl:if test="$div.element != 'section'">
  66. <xsl:attribute name="summary">
  67. <xsl:value-of select="$admon.type"/>
  68. <xsl:if test="title|info/title">
  69. <xsl:text>: </xsl:text>
  70. <xsl:value-of select="(title|info/title)[1]"/>
  71. </xsl:if>
  72. </xsl:attribute>
  73. </xsl:if>
  74. <tr>
  75. <td rowspan="2" align="center" valign="top">
  76. <img alt="[{$alt}]">
  77. <xsl:attribute name="src">
  78. <xsl:call-template name="admon.graphic"/>
  79. </xsl:attribute>
  80. </img>
  81. </td>
  82. <th align="{$direction.align.start}">
  83. <xsl:call-template name="anchor"/>
  84. <xsl:if test="$admon.textlabel != 0 or title or info/title">
  85. <xsl:apply-templates select="." mode="object.title.markup"/>
  86. </xsl:if>
  87. </th>
  88. </tr>
  89. <tr>
  90. <td align="{$direction.align.start}" valign="top">
  91. <xsl:apply-templates/>
  92. </td>
  93. </tr>
  94. </table>
  95. </div>
  96. </xsl:template>
  97. <xsl:template name="nongraphical.admonition">
  98. <div>
  99. <xsl:call-template name="common.html.attributes">
  100. <xsl:with-param name="inherit" select="1"/>
  101. </xsl:call-template>
  102. <xsl:call-template name="id.attribute"/>
  103. <xsl:if test="$admon.style">
  104. <xsl:attribute name="style">
  105. <xsl:value-of select="$admon.style"/>
  106. </xsl:attribute>
  107. </xsl:if>
  108. <xsl:if test="$admon.textlabel != 0 or title or info/title">
  109. <h3 class="title">
  110. <xsl:call-template name="anchor"/>
  111. <xsl:apply-templates select="." mode="object.title.markup"/>
  112. </h3>
  113. </xsl:if>
  114. <xsl:apply-templates/>
  115. </div>
  116. </xsl:template>
  117. <xsl:template match="note/title"/>
  118. <xsl:template match="important/title"/>
  119. <xsl:template match="warning/title"/>
  120. <xsl:template match="caution/title"/>
  121. <xsl:template match="tip/title"/>
  122. </xsl:stylesheet>