lfs-admon.xsl 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns="http://www.w3.org/1999/xhtml"
  4. version="1.0">
  5. <!-- This stylesheet controls how admonitions are displayed -->
  6. <!-- Use graphics in admonitions? 1 = yes, 0 = no -->
  7. <xsl:param name="admon.graphics" select="1"/>
  8. <!-- Relative path to images directory. We set here relative path
  9. from sub-dirs HTML files. The path from top-level HTML files (index.html,
  10. partX.html, etc) MUST be fixed via a sed in the Makefile. -->
  11. <xsl:param name="admon.graphics.path">../images/</xsl:param>
  12. <!-- The images files extension -->
  13. <xsl:param name="admon.graphics.extension" select="'.png'"/>
  14. <!-- Changing the output tagging:
  15. Removed $admon.style support
  16. Hardcoded $admon.textlabel feature
  17. Changed the output format from table to nested divs -->
  18. <!-- The original template is in {docbook-xsl}/xhtml/admon.xsl -->
  19. <xsl:template name="graphical.admonition">
  20. <xsl:variable name="admon.type">
  21. <xsl:choose>
  22. <xsl:when test="local-name(.)='note'">Note</xsl:when>
  23. <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
  24. <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
  25. <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
  26. <xsl:when test="local-name(.)='important'">Important</xsl:when>
  27. <xsl:otherwise>Note</xsl:otherwise>
  28. </xsl:choose>
  29. </xsl:variable>
  30. <xsl:variable name="alt">
  31. <xsl:call-template name="gentext">
  32. <xsl:with-param name="key" select="$admon.type"/>
  33. </xsl:call-template>
  34. </xsl:variable>
  35. <div class="admon {name(.)}">
  36. <img alt="[{$alt}]">
  37. <xsl:attribute name="src">
  38. <xsl:call-template name="admon.graphic"/>
  39. </xsl:attribute>
  40. </img>
  41. <h3>
  42. <xsl:apply-templates select="." mode="object.title.markup"/>
  43. </h3>
  44. <xsl:apply-templates/>
  45. </div>
  46. </xsl:template>
  47. </xsl:stylesheet>