component.xsl 14 KB

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