lfs-titles.xsl 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 the h* xhtml tags used for several titles -->
  6. <!-- preface.titlepage:
  7. Uses h1 and removed a lot of unneeded code.
  8. No label in preface. -->
  9. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  10. <xsl:template name="preface.titlepage">
  11. <div class="titlepage">
  12. <h1 class="{name(.)}">
  13. <xsl:value-of select="title"/>
  14. </h1>
  15. </div>
  16. </xsl:template>
  17. <!-- part.titlepage:
  18. Uses h1 and removed a lot of unneeded code.
  19. When sections are not labeled, we want the part label in TOC
  20. but not in titlepage. -->
  21. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  22. <xsl:template name="part.titlepage">
  23. <div class="titlepage">
  24. <h1 class="{name(.)}">
  25. <xsl:if test="$section.autolabel != 0">
  26. <xsl:apply-templates select="." mode="label.markup"/>
  27. <xsl:text>. </xsl:text>
  28. </xsl:if>
  29. <xsl:value-of select="title"/>
  30. </h1>
  31. </div>
  32. </xsl:template>
  33. <!-- appendix.titlepage:
  34. Uses h1 and removed a lot of unneeded code.
  35. When sections are not labeled, we want the appendix label in TOC
  36. but not in titlepage. -->
  37. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  38. <xsl:template name="appendix.titlepage">
  39. <div class="titlepage">
  40. <h1 class="{name(.)}">
  41. <xsl:if test="$section.autolabel != 0">
  42. <xsl:apply-templates select="." mode="label.markup"/>
  43. <xsl:text>. </xsl:text>
  44. </xsl:if>
  45. <xsl:value-of select="title"/>
  46. </h1>
  47. </div>
  48. </xsl:template>
  49. <!-- chapter.titlepage:
  50. Uses h1 and removed a lot of unneeded code.
  51. When sections are not labeled, we want the chapter label in TOC
  52. but not in titlepage. -->
  53. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  54. <xsl:template name="chapter.titlepage">
  55. <div class="titlepage">
  56. <h1 class="{name(.)}">
  57. <xsl:if test="$section.autolabel != 0">
  58. <xsl:apply-templates select="." mode="label.markup"/>
  59. <xsl:text>. </xsl:text>
  60. </xsl:if>
  61. <xsl:value-of select="title"/>
  62. </h1>
  63. </div>
  64. </xsl:template>
  65. <!-- sect1.titlepage:
  66. Uses h1 and removed a lot of unneeded code. -->
  67. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  68. <xsl:template name="sect1.titlepage">
  69. <div class="titlepage">
  70. <h1 class="{name(.)}">
  71. <xsl:if test="$section.autolabel != 0">
  72. <xsl:apply-templates select="." mode="label.markup"/>
  73. <xsl:text>. </xsl:text>
  74. </xsl:if>
  75. <xsl:value-of select="title"/>
  76. </h1>
  77. </div>
  78. </xsl:template>
  79. <!-- sect2.titlepage:
  80. Uses h2 and removed a lot of unneeded code.
  81. Skip empty titles.
  82. No label in preface (actualy, skip the hardcoded dot). -->
  83. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  84. <xsl:template name="sect2.titlepage">
  85. <xsl:choose>
  86. <xsl:when test="string-length(title) = 0"/>
  87. <xsl:otherwise>
  88. <div class="titlepage">
  89. <xsl:if test="@id">
  90. <a id="{@id}" name="{@id}"/>
  91. </xsl:if>
  92. <h2 class="{name(.)}">
  93. <xsl:if test="not(ancestor::preface) and $section.autolabel != 0">
  94. <xsl:apply-templates select="." mode="label.markup"/>
  95. <xsl:text>. </xsl:text>
  96. </xsl:if>
  97. <xsl:value-of select="title"/>
  98. </h2>
  99. </div>
  100. </xsl:otherwise>
  101. </xsl:choose>
  102. </xsl:template>
  103. <!-- bridgehead:
  104. When use always renderas attributes and want the output h* level
  105. matching the defined sect* level. -->
  106. <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
  107. <xsl:template match="bridgehead">
  108. <xsl:variable name="hlevel">
  109. <xsl:choose>
  110. <xsl:when test="@renderas = 'sect1'">1</xsl:when>
  111. <xsl:when test="@renderas = 'sect2'">2</xsl:when>
  112. <xsl:when test="@renderas = 'sect3'">3</xsl:when>
  113. <xsl:when test="@renderas = 'sect4'">4</xsl:when>
  114. <xsl:when test="@renderas = 'sect5'">5</xsl:when>
  115. </xsl:choose>
  116. </xsl:variable>
  117. <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
  118. <xsl:call-template name="anchor">
  119. <xsl:with-param name="conditional" select="0"/>
  120. </xsl:call-template>
  121. <xsl:apply-templates/>
  122. </xsl:element>
  123. </xsl:template>
  124. </xsl:stylesheet>