component.xsl 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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$
  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. <!-- ==================================================================== -->
  13. <xsl:template name="component.title">
  14. <xsl:param name="node" select="."/>
  15. <xsl:variable name="level">
  16. <xsl:choose>
  17. <xsl:when test="ancestor::section">
  18. <xsl:value-of select="count(ancestor::section)+1"/>
  19. </xsl:when>
  20. <xsl:when test="ancestor::sect5">6</xsl:when>
  21. <xsl:when test="ancestor::sect4">5</xsl:when>
  22. <xsl:when test="ancestor::sect3">4</xsl:when>
  23. <xsl:when test="ancestor::sect2">3</xsl:when>
  24. <xsl:when test="ancestor::sect1">2</xsl:when>
  25. <xsl:otherwise>1</xsl:otherwise>
  26. </xsl:choose>
  27. </xsl:variable>
  28. <!-- Let's handle the case where a component (bibliography, for example)
  29. occurs inside a section; will we need parameters for this? -->
  30. <xsl:element name="h{$level+1}" namespace="http://www.w3.org/1999/xhtml">
  31. <xsl:attribute name="class">title</xsl:attribute>
  32. <xsl:if test="$generate.id.attributes = 0">
  33. <xsl:call-template name="anchor">
  34. <xsl:with-param name="node" select="$node"/>
  35. <xsl:with-param name="conditional" select="0"/>
  36. </xsl:call-template>
  37. </xsl:if>
  38. <xsl:apply-templates select="$node" mode="object.title.markup">
  39. <xsl:with-param name="allow-anchors" select="1"/>
  40. </xsl:apply-templates>
  41. </xsl:element>
  42. </xsl:template>
  43. <xsl:template name="component.subtitle">
  44. <xsl:param name="node" select="."/>
  45. <xsl:variable name="subtitle" select="($node/docinfo/subtitle |$node/info/subtitle |$node/prefaceinfo/subtitle |$node/chapterinfo/subtitle |$node/appendixinfo/subtitle |$node/articleinfo/subtitle |$node/artheader/subtitle |$node/subtitle)[1]"/>
  46. <xsl:if test="$subtitle">
  47. <h3 class="subtitle">
  48. <i>
  49. <xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
  50. </i>
  51. </h3>
  52. </xsl:if>
  53. </xsl:template>
  54. <xsl:template name="component.separator">
  55. </xsl:template>
  56. <!-- ==================================================================== -->
  57. <xsl:template match="dedication" mode="dedication">
  58. <xsl:call-template name="id.warning"/>
  59. <div>
  60. <xsl:apply-templates select="." mode="class.attribute"/>
  61. <xsl:call-template name="dir">
  62. <xsl:with-param name="inherit" select="1"/>
  63. </xsl:call-template>
  64. <xsl:call-template name="language.attribute"/>
  65. <xsl:call-template name="dedication.titlepage"/>
  66. <xsl:apply-templates/>
  67. <xsl:call-template name="process.footnotes"/>
  68. </div>
  69. </xsl:template>
  70. <xsl:template match="dedication/title|dedication/info/title" mode="titlepage.mode" priority="2">
  71. <xsl:call-template name="component.title">
  72. <xsl:with-param name="node" select="ancestor::dedication[1]"/>
  73. </xsl:call-template>
  74. </xsl:template>
  75. <xsl:template match="dedication/subtitle|dedication/info/subtitle" mode="titlepage.mode" priority="2">
  76. <xsl:call-template name="component.subtitle">
  77. <xsl:with-param name="node" select="ancestor::dedication[1]"/>
  78. </xsl:call-template>
  79. </xsl:template>
  80. <xsl:template match="dedication"/> <!-- see mode="dedication" -->
  81. <xsl:template match="dedication/title"/>
  82. <xsl:template match="dedication/subtitle"/>
  83. <xsl:template match="dedication/titleabbrev"/>
  84. <!-- ==================================================================== -->
  85. <xsl:template match="colophon">
  86. <xsl:call-template name="id.warning"/>
  87. <div>
  88. <xsl:apply-templates select="." mode="class.attribute"/>
  89. <xsl:call-template name="dir">
  90. <xsl:with-param name="inherit" select="1"/>
  91. </xsl:call-template>
  92. <xsl:call-template name="language.attribute"/>
  93. <xsl:if test="$generate.id.attributes != 0">
  94. <xsl:attribute name="id">
  95. <xsl:call-template name="object.id"/>
  96. </xsl:attribute>
  97. </xsl:if>
  98. <xsl:call-template name="component.separator"/>
  99. <xsl:call-template name="component.title"/>
  100. <xsl:call-template name="component.subtitle"/>
  101. <xsl:apply-templates/>
  102. <xsl:call-template name="process.footnotes"/>
  103. </div>
  104. </xsl:template>
  105. <xsl:template match="colophon/title"/>
  106. <xsl:template match="colophon/subtitle"/>
  107. <xsl:template match="colophon/titleabbrev"/>
  108. <!-- ==================================================================== -->
  109. <xsl:template match="preface">
  110. <xsl:call-template name="id.warning"/>
  111. <div>
  112. <xsl:apply-templates select="." mode="class.attribute"/>
  113. <xsl:call-template name="dir">
  114. <xsl:with-param name="inherit" select="1"/>
  115. </xsl:call-template>
  116. <xsl:call-template name="language.attribute"/>
  117. <xsl:if test="$generate.id.attributes != 0">
  118. <xsl:attribute name="id">
  119. <xsl:call-template name="object.id"/>
  120. </xsl:attribute>
  121. </xsl:if>
  122. <xsl:call-template name="component.separator"/>
  123. <xsl:call-template name="preface.titlepage"/>
  124. <xsl:variable name="toc.params">
  125. <xsl:call-template name="find.path.params">
  126. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  127. </xsl:call-template>
  128. </xsl:variable>
  129. <xsl:if test="contains($toc.params, 'toc')">
  130. <xsl:call-template name="component.toc">
  131. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  132. </xsl:call-template>
  133. <xsl:call-template name="component.toc.separator"/>
  134. </xsl:if>
  135. <xsl:apply-templates/>
  136. <xsl:call-template name="process.footnotes"/>
  137. </div>
  138. </xsl:template>
  139. <xsl:template match="preface/title" mode="titlepage.mode" priority="2">
  140. <xsl:call-template name="component.title">
  141. <xsl:with-param name="node" select="ancestor::preface[1]"/>
  142. </xsl:call-template>
  143. </xsl:template>
  144. <xsl:template match="preface/subtitle |preface/prefaceinfo/subtitle |preface/info/subtitle |preface/docinfo/subtitle" mode="titlepage.mode" priority="2">
  145. <xsl:call-template name="component.subtitle">
  146. <xsl:with-param name="node" select="ancestor::preface[1]"/>
  147. </xsl:call-template>
  148. </xsl:template>
  149. <xsl:template match="preface/docinfo|prefaceinfo"/>
  150. <xsl:template match="preface/info"/>
  151. <xsl:template match="preface/title"/>
  152. <xsl:template match="preface/titleabbrev"/>
  153. <xsl:template match="preface/subtitle"/>
  154. <!-- ==================================================================== -->
  155. <xsl:template match="chapter">
  156. <xsl:call-template name="id.warning"/>
  157. <div>
  158. <xsl:apply-templates select="." mode="class.attribute"/>
  159. <xsl:call-template name="dir">
  160. <xsl:with-param name="inherit" select="1"/>
  161. </xsl:call-template>
  162. <xsl:call-template name="language.attribute"/>
  163. <xsl:if test="$generate.id.attributes != 0">
  164. <xsl:attribute name="id">
  165. <xsl:call-template name="object.id"/>
  166. </xsl:attribute>
  167. </xsl:if>
  168. <xsl:call-template name="component.separator"/>
  169. <xsl:call-template name="chapter.titlepage"/>
  170. <xsl:variable name="toc.params">
  171. <xsl:call-template name="find.path.params">
  172. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  173. </xsl:call-template>
  174. </xsl:variable>
  175. <xsl:if test="contains($toc.params, 'toc')">
  176. <xsl:call-template name="component.toc">
  177. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  178. </xsl:call-template>
  179. <xsl:call-template name="component.toc.separator"/>
  180. </xsl:if>
  181. <xsl:apply-templates/>
  182. <xsl:call-template name="process.footnotes"/>
  183. </div>
  184. </xsl:template>
  185. <xsl:template match="chapter/title" mode="titlepage.mode" priority="2">
  186. <xsl:call-template name="component.title">
  187. <xsl:with-param name="node" select="ancestor::chapter[1]"/>
  188. </xsl:call-template>
  189. </xsl:template>
  190. <xsl:template match="chapter/subtitle |chapter/chapterinfo/subtitle |chapter/info/subtitle |chapter/docinfo/subtitle" mode="titlepage.mode" priority="2">
  191. <xsl:call-template name="component.subtitle">
  192. <xsl:with-param name="node" select="ancestor::chapter[1]"/>
  193. </xsl:call-template>
  194. </xsl:template>
  195. <xsl:template match="chapter/docinfo|chapterinfo"/>
  196. <xsl:template match="chapter/info"/>
  197. <xsl:template match="chapter/title"/>
  198. <xsl:template match="chapter/titleabbrev"/>
  199. <xsl:template match="chapter/subtitle"/>
  200. <!-- ==================================================================== -->
  201. <xsl:template match="appendix">
  202. <xsl:variable name="ischunk">
  203. <xsl:call-template name="chunk"/>
  204. </xsl:variable>
  205. <xsl:call-template name="id.warning"/>
  206. <div>
  207. <xsl:apply-templates select="." mode="class.attribute"/>
  208. <xsl:call-template name="dir">
  209. <xsl:with-param name="inherit" select="1"/>
  210. </xsl:call-template>
  211. <xsl:call-template name="language.attribute"/>
  212. <xsl:if test="$generate.id.attributes != 0">
  213. <xsl:attribute name="id">
  214. <xsl:call-template name="object.id"/>
  215. </xsl:attribute>
  216. </xsl:if>
  217. <xsl:choose>
  218. <xsl:when test="parent::article and $ischunk = 0">
  219. <xsl:call-template name="section.heading">
  220. <xsl:with-param name="level" select="1"/>
  221. <xsl:with-param name="title">
  222. <xsl:apply-templates select="." mode="object.title.markup"/>
  223. </xsl:with-param>
  224. </xsl:call-template>
  225. </xsl:when>
  226. <xsl:otherwise>
  227. <xsl:call-template name="component.separator"/>
  228. <xsl:call-template name="appendix.titlepage"/>
  229. </xsl:otherwise>
  230. </xsl:choose>
  231. <xsl:variable name="toc.params">
  232. <xsl:call-template name="find.path.params">
  233. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  234. </xsl:call-template>
  235. </xsl:variable>
  236. <xsl:if test="contains($toc.params, 'toc')">
  237. <xsl:call-template name="component.toc">
  238. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  239. </xsl:call-template>
  240. <xsl:call-template name="component.toc.separator"/>
  241. </xsl:if>
  242. <xsl:apply-templates/>
  243. <xsl:if test="not(parent::article) or $ischunk != 0">
  244. <xsl:call-template name="process.footnotes"/>
  245. </xsl:if>
  246. </div>
  247. </xsl:template>
  248. <xsl:template match="appendix/title" mode="titlepage.mode" priority="2">
  249. <xsl:call-template name="component.title">
  250. <xsl:with-param name="node" select="ancestor::appendix[1]"/>
  251. </xsl:call-template>
  252. </xsl:template>
  253. <xsl:template match="appendix/subtitle |appendix/appendixinfo/subtitle |appendix/info/subtitle |appendix/docinfo/subtitle" mode="titlepage.mode" priority="2">
  254. <xsl:call-template name="component.subtitle">
  255. <xsl:with-param name="node" select="ancestor::appendix[1]"/>
  256. </xsl:call-template>
  257. </xsl:template>
  258. <xsl:template match="appendix/docinfo|appendixinfo"/>
  259. <xsl:template match="appendix/info"/>
  260. <xsl:template match="appendix/title"/>
  261. <xsl:template match="appendix/titleabbrev"/>
  262. <xsl:template match="appendix/subtitle"/>
  263. <!-- ==================================================================== -->
  264. <xsl:template match="article">
  265. <xsl:call-template name="id.warning"/>
  266. <div>
  267. <xsl:apply-templates select="." mode="class.attribute"/>
  268. <xsl:call-template name="dir">
  269. <xsl:with-param name="inherit" select="1"/>
  270. </xsl:call-template>
  271. <xsl:call-template name="language.attribute"/>
  272. <xsl:if test="$generate.id.attributes != 0">
  273. <xsl:attribute name="id">
  274. <xsl:call-template name="object.id"/>
  275. </xsl:attribute>
  276. </xsl:if>
  277. <xsl:call-template name="article.titlepage"/>
  278. <xsl:variable name="toc.params">
  279. <xsl:call-template name="find.path.params">
  280. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  281. </xsl:call-template>
  282. </xsl:variable>
  283. <xsl:call-template name="make.lots">
  284. <xsl:with-param name="toc.params" select="$toc.params"/>
  285. <xsl:with-param name="toc">
  286. <xsl:call-template name="component.toc">
  287. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  288. </xsl:call-template>
  289. </xsl:with-param>
  290. </xsl:call-template>
  291. <xsl:apply-templates/>
  292. <xsl:call-template name="process.footnotes"/>
  293. </div>
  294. </xsl:template>
  295. <xsl:template match="article/title|article/articleinfo/title" mode="titlepage.mode" priority="2">
  296. <xsl:call-template name="component.title">
  297. <xsl:with-param name="node" select="ancestor::article[1]"/>
  298. </xsl:call-template>
  299. </xsl:template>
  300. <xsl:template match="article/subtitle |article/articleinfo/subtitle |article/info/subtitle |article/artheader/subtitle" mode="titlepage.mode" priority="2">
  301. <xsl:call-template name="component.subtitle">
  302. <xsl:with-param name="node" select="ancestor::article[1]"/>
  303. </xsl:call-template>
  304. </xsl:template>
  305. <xsl:template match="article/artheader|article/articleinfo"/>
  306. <xsl:template match="article/info"/>
  307. <xsl:template match="article/title"/>
  308. <xsl:template match="article/titleabbrev"/>
  309. <xsl:template match="article/subtitle"/>
  310. <!-- ==================================================================== -->
  311. </xsl:stylesheet>