admon.xsl 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 9728 2013-03-08 00:16:41Z 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 != '' and $make.clean.html = 0">
  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. <xsl:attribute name="width">
  77. <xsl:apply-templates select="." mode="admon.graphic.width"/>
  78. </xsl:attribute>
  79. <img alt="[{$alt}]">
  80. <xsl:attribute name="src">
  81. <xsl:call-template name="admon.graphic"/>
  82. </xsl:attribute>
  83. </img>
  84. </td>
  85. <th align="{$direction.align.start}">
  86. <xsl:call-template name="anchor"/>
  87. <xsl:if test="$admon.textlabel != 0 or title or info/title">
  88. <xsl:apply-templates select="." mode="object.title.markup"/>
  89. </xsl:if>
  90. </th>
  91. </tr>
  92. <tr>
  93. <td align="{$direction.align.start}" valign="top">
  94. <xsl:apply-templates/>
  95. </td>
  96. </tr>
  97. </table>
  98. </div>
  99. </xsl:template>
  100. <xsl:template name="nongraphical.admonition">
  101. <div>
  102. <xsl:call-template name="common.html.attributes">
  103. <xsl:with-param name="inherit" select="1"/>
  104. </xsl:call-template>
  105. <xsl:call-template name="id.attribute"/>
  106. <xsl:if test="$admon.style != '' and $make.clean.html = 0">
  107. <xsl:attribute name="style">
  108. <xsl:value-of select="$admon.style"/>
  109. </xsl:attribute>
  110. </xsl:if>
  111. <xsl:if test="$admon.textlabel != 0 or title or info/title">
  112. <h3 class="title">
  113. <xsl:call-template name="anchor"/>
  114. <xsl:apply-templates select="." mode="object.title.markup"/>
  115. </h3>
  116. </xsl:if>
  117. <xsl:apply-templates/>
  118. </div>
  119. </xsl:template>
  120. <xsl:template match="note/title"/>
  121. <xsl:template match="important/title"/>
  122. <xsl:template match="warning/title"/>
  123. <xsl:template match="caution/title"/>
  124. <xsl:template match="tip/title"/>
  125. </xsl:stylesheet>