lfs-titles.xsl 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?xml version='1.0' encoding='ISO-8859-1'?>
  2. <!--
  3. $LastChangedBy$
  4. $Date$
  5. -->
  6. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  7. xmlns="http://www.w3.org/1999/xhtml"
  8. version="1.0">
  9. <!-- This stylesheet controls the h* xhtml tags used for several titles -->
  10. <!-- preface.titlepage:
  11. Uses h1 and removed a lot of unneeded code.
  12. No label in preface. -->
  13. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  14. <xsl:template name="preface.titlepage">
  15. <h1 class="{name(.)}">
  16. <xsl:if test="@id">
  17. <a id="{@id}" name="{@id}"/>
  18. </xsl:if>
  19. <xsl:value-of select="title"/>
  20. </h1>
  21. </xsl:template>
  22. <!-- part.titlepage:
  23. Uses h1 and removed a lot of unneeded code.
  24. When sections are not labeled, we want the part label in TOC
  25. but not in titlepage. -->
  26. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  27. <xsl:template name="part.titlepage">
  28. <h1 class="{name(.)}">
  29. <xsl:if test="@id">
  30. <a id="{@id}" name="{@id}"/>
  31. </xsl:if>
  32. <xsl:if test="$section.autolabel != 0">
  33. <xsl:apply-templates select="." mode="label.markup"/>
  34. <xsl:text>. </xsl:text>
  35. </xsl:if>
  36. <xsl:value-of select="title"/>
  37. </h1>
  38. </xsl:template>
  39. <!-- partintro.titlepage:
  40. Uses h2 and removed a lot of unneeded code. -->
  41. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  42. <xsl:template name="partintro.titlepage">
  43. <xsl:if test="title">
  44. <h2 class="{name(.)}">
  45. <xsl:if test="@id">
  46. <a id="{@id}" name="{@id}"/>
  47. </xsl:if>
  48. <xsl:value-of select="title"/>
  49. </h2>
  50. </xsl:if>
  51. </xsl:template>
  52. <!-- appendix.titlepage:
  53. Uses h1 and removed a lot of unneeded code.
  54. When sections are not labeled, we want the appendix label in TOC
  55. but not in titlepage. -->
  56. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  57. <xsl:template name="appendix.titlepage">
  58. <h1 class="{name(.)}">
  59. <xsl:if test="@id">
  60. <a id="{@id}" name="{@id}"/>
  61. </xsl:if>
  62. <xsl:if test="$section.autolabel != 0">
  63. <xsl:apply-templates select="." mode="label.markup"/>
  64. <xsl:text>. </xsl:text>
  65. </xsl:if>
  66. <xsl:value-of select="title"/>
  67. </h1>
  68. </xsl:template>
  69. <!-- chapter.titlepage:
  70. Uses h1 and removed a lot of unneeded code.
  71. When sections are not labeled, we want the chapter label in TOC
  72. but not in titlepage. -->
  73. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  74. <xsl:template name="chapter.titlepage">
  75. <h1 class="{name(.)}">
  76. <xsl:if test="@id">
  77. <a id="{@id}" name="{@id}"/>
  78. </xsl:if>
  79. <xsl:if test="$section.autolabel != 0">
  80. <xsl:apply-templates select="." mode="label.markup"/>
  81. <xsl:text>. </xsl:text>
  82. </xsl:if>
  83. <xsl:value-of select="title"/>
  84. </h1>
  85. </xsl:template>
  86. <!-- sect1.titlepage:
  87. Uses h1 and removed a lot of unneeded code. -->
  88. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  89. <xsl:template name="sect1.titlepage">
  90. <h1 class="{name(.)}">
  91. <xsl:if test="@id">
  92. <a id="{@id}" name="{@id}"/>
  93. </xsl:if>
  94. <xsl:if test="$section.autolabel != 0">
  95. <xsl:apply-templates select="." mode="label.markup"/>
  96. <xsl:text>. </xsl:text>
  97. </xsl:if>
  98. <xsl:value-of select="title"/>
  99. </h1>
  100. </xsl:template>
  101. <!-- sect2.titlepage:
  102. Uses h2 and removed a lot of unneeded code.
  103. Skip empty titles.
  104. No label in preface. -->
  105. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  106. <xsl:template name="sect2.titlepage">
  107. <xsl:choose>
  108. <xsl:when test="string-length(title) = 0"/>
  109. <xsl:otherwise>
  110. <h2 class="{name(.)}">
  111. <xsl:if test="@id">
  112. <a id="{@id}" name="{@id}"/>
  113. </xsl:if>
  114. <xsl:if test="not(ancestor::preface) and $section.autolabel != 0">
  115. <xsl:apply-templates select="." mode="label.markup"/>
  116. <xsl:text>. </xsl:text>
  117. </xsl:if>
  118. <xsl:value-of select="title"/>
  119. </h2>
  120. </xsl:otherwise>
  121. </xsl:choose>
  122. </xsl:template>
  123. <!-- sect3.titlepage:
  124. Uses h3 and removed a lot of unneeded code. -->
  125. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  126. <xsl:template name="sect3.titlepage">
  127. <h3 class="{name(.)}">
  128. <xsl:if test="@id">
  129. <a id="{@id}" name="{@id}"/>
  130. </xsl:if>
  131. <xsl:if test="$section.autolabel != 0">
  132. <xsl:apply-templates select="." mode="label.markup"/>
  133. <xsl:text>. </xsl:text>
  134. </xsl:if>
  135. <xsl:value-of select="title"/>
  136. </h3>
  137. </xsl:template>
  138. <!-- dedication.titlepage:
  139. Uses h2 and removed a lot of unneeded code. -->
  140. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  141. <xsl:template name="dedication.titlepage">
  142. <h2>
  143. <xsl:value-of select="title"/>
  144. </h2>
  145. </xsl:template>
  146. <!-- bridgehead:
  147. We use always renderas attributes and want the output h* level
  148. matching the defined sect* level.
  149. Create the anchor only if there is an @id. -->
  150. <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
  151. <xsl:template match="bridgehead">
  152. <xsl:variable name="hlevel">
  153. <xsl:choose>
  154. <xsl:when test="@renderas = 'sect1'">1</xsl:when>
  155. <xsl:when test="@renderas = 'sect2'">2</xsl:when>
  156. <xsl:when test="@renderas = 'sect3'">3</xsl:when>
  157. <xsl:when test="@renderas = 'sect4'">4</xsl:when>
  158. <xsl:when test="@renderas = 'sect5'">5</xsl:when>
  159. </xsl:choose>
  160. </xsl:variable>
  161. <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
  162. <xsl:if test="@id">
  163. <a id="{@id}" name="{@id}"/>
  164. </xsl:if>
  165. <xsl:apply-templates/>
  166. </xsl:element>
  167. </xsl:template>
  168. <!-- book.titlepage.verso:
  169. Process bookinfo/bibliosource from here. -->
  170. <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
  171. <xsl:template name="book.titlepage.verso">
  172. <xsl:apply-templates select="bookinfo/bibliosource"/>
  173. </xsl:template>
  174. <!-- bookinfo/bibliosource:
  175. Self-made template to handle bibliosource when inside bookinfo. -->
  176. <xsl:template match="bookinfo/bibliosource">
  177. <p class="copyright">
  178. <xsl:apply-templates/>
  179. </p>
  180. </xsl:template>
  181. </xsl:stylesheet>