component.xsl 16 KB

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