division.xsl 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. version='1.0'>
  4. <!-- ********************************************************************
  5. $Id: division.xsl 9366 2012-05-12 23:44:25Z bobstayton $
  6. ********************************************************************
  7. This file is part of the XSL DocBook Stylesheet distribution.
  8. See ../README or http://docbook.sf.net/release/xsl/current/ for
  9. copyright and other information.
  10. ******************************************************************** -->
  11. <!-- ==================================================================== -->
  12. <xsl:template match="set">
  13. <xsl:call-template name="id.warning"/>
  14. <xsl:element name="{$div.element}">
  15. <xsl:apply-templates select="." mode="common.html.attributes"/>
  16. <xsl:call-template name="id.attribute">
  17. <xsl:with-param name="conditional" select="0"/>
  18. </xsl:call-template>
  19. <xsl:call-template name="dir">
  20. <xsl:with-param name="inherit" select="1"/>
  21. </xsl:call-template>
  22. <xsl:call-template name="language.attribute"/>
  23. <xsl:if test="$generate.id.attributes != 0">
  24. <xsl:attribute name="id">
  25. <xsl:call-template name="object.id"/>
  26. </xsl:attribute>
  27. </xsl:if>
  28. <xsl:call-template name="set.titlepage"/>
  29. <xsl:variable name="toc.params">
  30. <xsl:call-template name="find.path.params">
  31. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  32. </xsl:call-template>
  33. </xsl:variable>
  34. <xsl:call-template name="make.lots">
  35. <xsl:with-param name="toc.params" select="$toc.params"/>
  36. <xsl:with-param name="toc">
  37. <xsl:call-template name="set.toc">
  38. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  39. </xsl:call-template>
  40. </xsl:with-param>
  41. </xsl:call-template>
  42. <xsl:apply-templates/>
  43. </xsl:element>
  44. </xsl:template>
  45. <xsl:template match="set/setinfo"></xsl:template>
  46. <xsl:template match="set/title"></xsl:template>
  47. <xsl:template match="set/titleabbrev"></xsl:template>
  48. <xsl:template match="set/subtitle"></xsl:template>
  49. <!-- ==================================================================== -->
  50. <xsl:template match="book">
  51. <xsl:call-template name="id.warning"/>
  52. <div>
  53. <xsl:apply-templates select="." mode="common.html.attributes"/>
  54. <xsl:call-template name="id.attribute">
  55. <xsl:with-param name="conditional" select="0"/>
  56. </xsl:call-template>
  57. <xsl:call-template name="book.titlepage"/>
  58. <xsl:apply-templates select="dedication" mode="dedication"/>
  59. <xsl:apply-templates select="acknowledgements" mode="acknowledgements"/>
  60. <xsl:variable name="toc.params">
  61. <xsl:call-template name="find.path.params">
  62. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  63. </xsl:call-template>
  64. </xsl:variable>
  65. <xsl:call-template name="make.lots">
  66. <xsl:with-param name="toc.params" select="$toc.params"/>
  67. <xsl:with-param name="toc">
  68. <xsl:call-template name="division.toc">
  69. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  70. </xsl:call-template>
  71. </xsl:with-param>
  72. </xsl:call-template>
  73. <xsl:apply-templates/>
  74. </div>
  75. </xsl:template>
  76. <xsl:template match="book/bookinfo"></xsl:template>
  77. <xsl:template match="book/info"></xsl:template>
  78. <xsl:template match="book/title"></xsl:template>
  79. <xsl:template match="book/titleabbrev"></xsl:template>
  80. <xsl:template match="book/subtitle"></xsl:template>
  81. <!-- ==================================================================== -->
  82. <xsl:template match="part">
  83. <xsl:call-template name="id.warning"/>
  84. <div>
  85. <xsl:apply-templates select="." mode="common.html.attributes"/>
  86. <xsl:call-template name="id.attribute">
  87. <xsl:with-param name="conditional" select="0"/>
  88. </xsl:call-template>
  89. <xsl:call-template name="part.titlepage"/>
  90. <xsl:variable name="toc.params">
  91. <xsl:call-template name="find.path.params">
  92. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  93. </xsl:call-template>
  94. </xsl:variable>
  95. <xsl:if test="not(partintro) and contains($toc.params, 'toc')">
  96. <xsl:call-template name="division.toc"/>
  97. </xsl:if>
  98. <xsl:apply-templates/>
  99. </div>
  100. </xsl:template>
  101. <xsl:template match="part" mode="make.part.toc">
  102. <xsl:call-template name="division.toc"/>
  103. </xsl:template>
  104. <xsl:template match="reference" mode="make.part.toc">
  105. <xsl:call-template name="division.toc"/>
  106. </xsl:template>
  107. <xsl:template match="part/docinfo"></xsl:template>
  108. <xsl:template match="part/partinfo"></xsl:template>
  109. <xsl:template match="part/info"></xsl:template>
  110. <xsl:template match="part/title"></xsl:template>
  111. <xsl:template match="part/titleabbrev"></xsl:template>
  112. <xsl:template match="part/subtitle"></xsl:template>
  113. <xsl:template match="partintro">
  114. <xsl:call-template name="id.warning"/>
  115. <div>
  116. <xsl:call-template name="common.html.attributes"/>
  117. <xsl:call-template name="id.attribute">
  118. <xsl:with-param name="conditional" select="0"/>
  119. </xsl:call-template>
  120. <xsl:call-template name="partintro.titlepage"/>
  121. <xsl:apply-templates/>
  122. <xsl:variable name="toc.params">
  123. <xsl:call-template name="find.path.params">
  124. <xsl:with-param name="node" select="parent::*"/>
  125. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  126. </xsl:call-template>
  127. </xsl:variable>
  128. <xsl:if test="contains($toc.params, 'toc')">
  129. <!-- not ancestor::part because partintro appears in reference -->
  130. <xsl:apply-templates select="parent::*" mode="make.part.toc"/>
  131. </xsl:if>
  132. <xsl:call-template name="process.footnotes"/>
  133. </div>
  134. </xsl:template>
  135. <xsl:template match="partintro/title"></xsl:template>
  136. <xsl:template match="partintro/titleabbrev"></xsl:template>
  137. <xsl:template match="partintro/subtitle"></xsl:template>
  138. <xsl:template match="partintro/title" mode="partintro.title.mode">
  139. <h2>
  140. <xsl:apply-templates/>
  141. </h2>
  142. </xsl:template>
  143. <xsl:template match="partintro/subtitle" mode="partintro.title.mode">
  144. <h3>
  145. <i><xsl:apply-templates/></i>
  146. </h3>
  147. </xsl:template>
  148. <!-- ==================================================================== -->
  149. <xsl:template match="book" mode="division.number">
  150. <xsl:number from="set" count="book" format="1."/>
  151. </xsl:template>
  152. <xsl:template match="part" mode="division.number">
  153. <xsl:number from="book" count="part" format="I."/>
  154. </xsl:template>
  155. <!-- ==================================================================== -->
  156. <xsl:template name="division.title">
  157. <xsl:param name="node" select="."/>
  158. <h1>
  159. <xsl:attribute name="class">title</xsl:attribute>
  160. <xsl:call-template name="anchor">
  161. <xsl:with-param name="node" select="$node"/>
  162. <xsl:with-param name="conditional" select="0"/>
  163. </xsl:call-template>
  164. <xsl:apply-templates select="$node" mode="object.title.markup">
  165. <xsl:with-param name="allow-anchors" select="1"/>
  166. </xsl:apply-templates>
  167. </h1>
  168. </xsl:template>
  169. </xsl:stylesheet>