sections.xsl 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. version='1.0'>
  4. <!-- ********************************************************************
  5. $Id: sections.xsl 9392 2012-06-02 20:10:58Z 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="section">
  13. <xsl:variable name="depth" select="count(ancestor::section)+1"/>
  14. <xsl:call-template name="id.warning"/>
  15. <xsl:element name="{$div.element}">
  16. <xsl:call-template name="common.html.attributes">
  17. <xsl:with-param name="inherit" select="1"/>
  18. </xsl:call-template>
  19. <xsl:call-template name="id.attribute">
  20. <xsl:with-param name="conditional" select="0"/>
  21. </xsl:call-template>
  22. <xsl:call-template name="section.titlepage"/>
  23. <xsl:variable name="toc.params">
  24. <xsl:call-template name="find.path.params">
  25. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  26. </xsl:call-template>
  27. </xsl:variable>
  28. <xsl:if test="contains($toc.params, 'toc')
  29. and $depth &lt;= $generate.section.toc.level">
  30. <xsl:call-template name="section.toc">
  31. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  32. </xsl:call-template>
  33. <xsl:call-template name="section.toc.separator"/>
  34. </xsl:if>
  35. <xsl:apply-templates/>
  36. <xsl:call-template name="process.chunk.footnotes"/>
  37. </xsl:element>
  38. </xsl:template>
  39. <xsl:template name="section.title">
  40. <!-- the context node should be the title of a section when called -->
  41. <xsl:variable name="section" select="(ancestor::section
  42. |ancestor::simplesect
  43. |ancestor::sect1
  44. |ancestor::sect2
  45. |ancestor::sect3
  46. |ancestor::sect4
  47. |ancestor::sect5)[last()]"/>
  48. <xsl:variable name="renderas">
  49. <xsl:choose>
  50. <xsl:when test="$section/@renderas = 'sect1'">1</xsl:when>
  51. <xsl:when test="$section/@renderas = 'sect2'">2</xsl:when>
  52. <xsl:when test="$section/@renderas = 'sect3'">3</xsl:when>
  53. <xsl:when test="$section/@renderas = 'sect4'">4</xsl:when>
  54. <xsl:when test="$section/@renderas = 'sect5'">5</xsl:when>
  55. <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
  56. </xsl:choose>
  57. </xsl:variable>
  58. <xsl:variable name="level">
  59. <xsl:choose>
  60. <xsl:when test="$renderas != ''">
  61. <xsl:value-of select="$renderas"/>
  62. </xsl:when>
  63. <xsl:otherwise>
  64. <xsl:call-template name="section.level">
  65. <xsl:with-param name="node" select="$section"/>
  66. </xsl:call-template>
  67. </xsl:otherwise>
  68. </xsl:choose>
  69. </xsl:variable>
  70. <xsl:call-template name="section.heading">
  71. <xsl:with-param name="section" select="$section"/>
  72. <xsl:with-param name="level" select="$level"/>
  73. <xsl:with-param name="title">
  74. <xsl:apply-templates select="$section" mode="object.title.markup">
  75. <xsl:with-param name="allow-anchors" select="1"/>
  76. </xsl:apply-templates>
  77. </xsl:with-param>
  78. </xsl:call-template>
  79. </xsl:template>
  80. <xsl:template match="section/title
  81. |section/info/title
  82. |sectioninfo/title"
  83. mode="titlepage.mode" priority="2">
  84. <xsl:call-template name="section.title"/>
  85. </xsl:template>
  86. <xsl:template match="sect1">
  87. <xsl:call-template name="id.warning"/>
  88. <xsl:element name="{$div.element}">
  89. <xsl:call-template name="common.html.attributes">
  90. <xsl:with-param name="inherit" select="1"/>
  91. </xsl:call-template>
  92. <xsl:call-template name="id.attribute">
  93. <xsl:with-param name="conditional" select="0"/>
  94. </xsl:call-template>
  95. <xsl:choose>
  96. <xsl:when test="@renderas = 'sect2'">
  97. <xsl:call-template name="sect2.titlepage"/>
  98. </xsl:when>
  99. <xsl:when test="@renderas = 'sect3'">
  100. <xsl:call-template name="sect3.titlepage"/>
  101. </xsl:when>
  102. <xsl:when test="@renderas = 'sect4'">
  103. <xsl:call-template name="sect4.titlepage"/>
  104. </xsl:when>
  105. <xsl:when test="@renderas = 'sect5'">
  106. <xsl:call-template name="sect5.titlepage"/>
  107. </xsl:when>
  108. <xsl:otherwise>
  109. <xsl:call-template name="sect1.titlepage"/>
  110. </xsl:otherwise>
  111. </xsl:choose>
  112. <xsl:variable name="toc.params">
  113. <xsl:call-template name="find.path.params">
  114. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  115. </xsl:call-template>
  116. </xsl:variable>
  117. <xsl:if test="contains($toc.params, 'toc')
  118. and $generate.section.toc.level &gt;= 1">
  119. <xsl:call-template name="section.toc">
  120. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  121. </xsl:call-template>
  122. <xsl:call-template name="section.toc.separator"/>
  123. </xsl:if>
  124. <xsl:apply-templates/>
  125. <xsl:call-template name="process.chunk.footnotes"/>
  126. </xsl:element>
  127. </xsl:template>
  128. <xsl:template match="sect1/title
  129. |sect1/info/title
  130. |sect1info/title"
  131. mode="titlepage.mode" priority="2">
  132. <xsl:call-template name="section.title"/>
  133. </xsl:template>
  134. <xsl:template match="sect2">
  135. <xsl:call-template name="id.warning"/>
  136. <xsl:element name="{$div.element}">
  137. <xsl:call-template name="common.html.attributes">
  138. <xsl:with-param name="inherit" select="1"/>
  139. </xsl:call-template>
  140. <xsl:call-template name="id.attribute">
  141. <xsl:with-param name="conditional" select="0"/>
  142. </xsl:call-template>
  143. <xsl:choose>
  144. <xsl:when test="@renderas = 'sect1'">
  145. <xsl:call-template name="sect1.titlepage"/>
  146. </xsl:when>
  147. <xsl:when test="@renderas = 'sect3'">
  148. <xsl:call-template name="sect3.titlepage"/>
  149. </xsl:when>
  150. <xsl:when test="@renderas = 'sect4'">
  151. <xsl:call-template name="sect4.titlepage"/>
  152. </xsl:when>
  153. <xsl:when test="@renderas = 'sect5'">
  154. <xsl:call-template name="sect5.titlepage"/>
  155. </xsl:when>
  156. <xsl:otherwise>
  157. <xsl:call-template name="sect2.titlepage"/>
  158. </xsl:otherwise>
  159. </xsl:choose>
  160. <xsl:variable name="toc.params">
  161. <xsl:call-template name="find.path.params">
  162. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  163. </xsl:call-template>
  164. </xsl:variable>
  165. <xsl:if test="contains($toc.params, 'toc')
  166. and $generate.section.toc.level &gt;= 2">
  167. <xsl:call-template name="section.toc">
  168. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  169. </xsl:call-template>
  170. <xsl:call-template name="section.toc.separator"/>
  171. </xsl:if>
  172. <xsl:apply-templates/>
  173. <xsl:call-template name="process.chunk.footnotes"/>
  174. </xsl:element>
  175. </xsl:template>
  176. <xsl:template match="sect2/title
  177. |sect2/info/title
  178. |sect2info/title"
  179. mode="titlepage.mode" priority="2">
  180. <xsl:call-template name="section.title"/>
  181. </xsl:template>
  182. <xsl:template match="sect3">
  183. <xsl:call-template name="id.warning"/>
  184. <xsl:element name="{$div.element}">
  185. <xsl:call-template name="common.html.attributes">
  186. <xsl:with-param name="inherit" select="1"/>
  187. </xsl:call-template>
  188. <xsl:call-template name="id.attribute">
  189. <xsl:with-param name="conditional" select="0"/>
  190. </xsl:call-template>
  191. <xsl:choose>
  192. <xsl:when test="@renderas = 'sect1'">
  193. <xsl:call-template name="sect1.titlepage"/>
  194. </xsl:when>
  195. <xsl:when test="@renderas = 'sect2'">
  196. <xsl:call-template name="sect2.titlepage"/>
  197. </xsl:when>
  198. <xsl:when test="@renderas = 'sect4'">
  199. <xsl:call-template name="sect4.titlepage"/>
  200. </xsl:when>
  201. <xsl:when test="@renderas = 'sect5'">
  202. <xsl:call-template name="sect5.titlepage"/>
  203. </xsl:when>
  204. <xsl:otherwise>
  205. <xsl:call-template name="sect3.titlepage"/>
  206. </xsl:otherwise>
  207. </xsl:choose>
  208. <xsl:variable name="toc.params">
  209. <xsl:call-template name="find.path.params">
  210. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  211. </xsl:call-template>
  212. </xsl:variable>
  213. <xsl:if test="contains($toc.params, 'toc')
  214. and $generate.section.toc.level &gt;= 3">
  215. <xsl:call-template name="section.toc">
  216. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  217. </xsl:call-template>
  218. <xsl:call-template name="section.toc.separator"/>
  219. </xsl:if>
  220. <xsl:apply-templates/>
  221. <xsl:call-template name="process.chunk.footnotes"/>
  222. </xsl:element>
  223. </xsl:template>
  224. <xsl:template match="sect3/title
  225. |sect3/info/title
  226. |sect3info/title"
  227. mode="titlepage.mode" priority="2">
  228. <xsl:call-template name="section.title"/>
  229. </xsl:template>
  230. <xsl:template match="sect4">
  231. <xsl:call-template name="id.warning"/>
  232. <xsl:element name="{$div.element}">
  233. <xsl:call-template name="common.html.attributes">
  234. <xsl:with-param name="inherit" select="1"/>
  235. </xsl:call-template>
  236. <xsl:call-template name="id.attribute">
  237. <xsl:with-param name="conditional" select="0"/>
  238. </xsl:call-template>
  239. <xsl:choose>
  240. <xsl:when test="@renderas = 'sect1'">
  241. <xsl:call-template name="sect1.titlepage"/>
  242. </xsl:when>
  243. <xsl:when test="@renderas = 'sect2'">
  244. <xsl:call-template name="sect2.titlepage"/>
  245. </xsl:when>
  246. <xsl:when test="@renderas = 'sect3'">
  247. <xsl:call-template name="sect3.titlepage"/>
  248. </xsl:when>
  249. <xsl:when test="@renderas = 'sect5'">
  250. <xsl:call-template name="sect5.titlepage"/>
  251. </xsl:when>
  252. <xsl:otherwise>
  253. <xsl:call-template name="sect4.titlepage"/>
  254. </xsl:otherwise>
  255. </xsl:choose>
  256. <xsl:variable name="toc.params">
  257. <xsl:call-template name="find.path.params">
  258. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  259. </xsl:call-template>
  260. </xsl:variable>
  261. <xsl:if test="contains($toc.params, 'toc')
  262. and $generate.section.toc.level &gt;= 4">
  263. <xsl:call-template name="section.toc">
  264. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  265. </xsl:call-template>
  266. <xsl:call-template name="section.toc.separator"/>
  267. </xsl:if>
  268. <xsl:apply-templates/>
  269. <xsl:call-template name="process.chunk.footnotes"/>
  270. </xsl:element>
  271. </xsl:template>
  272. <xsl:template match="sect4/title
  273. |sect4/info/title
  274. |sect4info/title"
  275. mode="titlepage.mode" priority="2">
  276. <xsl:call-template name="section.title"/>
  277. </xsl:template>
  278. <xsl:template match="sect5">
  279. <xsl:call-template name="id.warning"/>
  280. <xsl:element name="{$div.element}">
  281. <xsl:call-template name="common.html.attributes">
  282. <xsl:with-param name="inherit" select="1"/>
  283. </xsl:call-template>
  284. <xsl:call-template name="id.attribute">
  285. <xsl:with-param name="conditional" select="0"/>
  286. </xsl:call-template>
  287. <xsl:choose>
  288. <xsl:when test="@renderas = 'sect1'">
  289. <xsl:call-template name="sect1.titlepage"/>
  290. </xsl:when>
  291. <xsl:when test="@renderas = 'sect2'">
  292. <xsl:call-template name="sect2.titlepage"/>
  293. </xsl:when>
  294. <xsl:when test="@renderas = 'sect3'">
  295. <xsl:call-template name="sect3.titlepage"/>
  296. </xsl:when>
  297. <xsl:when test="@renderas = 'sect4'">
  298. <xsl:call-template name="sect4.titlepage"/>
  299. </xsl:when>
  300. <xsl:otherwise>
  301. <xsl:call-template name="sect5.titlepage"/>
  302. </xsl:otherwise>
  303. </xsl:choose>
  304. <xsl:variable name="toc.params">
  305. <xsl:call-template name="find.path.params">
  306. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  307. </xsl:call-template>
  308. </xsl:variable>
  309. <xsl:if test="contains($toc.params, 'toc')
  310. and $generate.section.toc.level &gt;= 5">
  311. <xsl:call-template name="section.toc">
  312. <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
  313. </xsl:call-template>
  314. <xsl:call-template name="section.toc.separator"/>
  315. </xsl:if>
  316. <xsl:apply-templates/>
  317. <xsl:call-template name="process.chunk.footnotes"/>
  318. </xsl:element>
  319. </xsl:template>
  320. <xsl:template match="sect5/title
  321. |sect5/info/title
  322. |sect5info/title"
  323. mode="titlepage.mode" priority="2">
  324. <xsl:call-template name="section.title"/>
  325. </xsl:template>
  326. <xsl:template match="simplesect">
  327. <xsl:call-template name="id.warning"/>
  328. <xsl:element name="{$div.element}">
  329. <xsl:call-template name="common.html.attributes">
  330. <xsl:with-param name="inherit" select="1"/>
  331. </xsl:call-template>
  332. <xsl:call-template name="id.attribute">
  333. <xsl:with-param name="conditional" select="0"/>
  334. </xsl:call-template>
  335. <xsl:call-template name="simplesect.titlepage"/>
  336. <xsl:apply-templates/>
  337. </xsl:element>
  338. </xsl:template>
  339. <xsl:template match="simplesect/title|simplesect/info/title"
  340. mode="titlepage.mode" priority="2">
  341. <xsl:call-template name="section.title"/>
  342. </xsl:template>
  343. <xsl:template match="section/title"></xsl:template>
  344. <xsl:template match="section/titleabbrev"></xsl:template>
  345. <xsl:template match="section/subtitle"></xsl:template>
  346. <xsl:template match="sectioninfo"></xsl:template>
  347. <xsl:template match="section/info"></xsl:template>
  348. <xsl:template match="sect1/title"></xsl:template>
  349. <xsl:template match="sect1/titleabbrev"></xsl:template>
  350. <xsl:template match="sect1/subtitle"></xsl:template>
  351. <xsl:template match="sect1info"></xsl:template>
  352. <xsl:template match="sect1/info"></xsl:template>
  353. <xsl:template match="sect2/title"></xsl:template>
  354. <xsl:template match="sect2/subtitle"></xsl:template>
  355. <xsl:template match="sect2/titleabbrev"></xsl:template>
  356. <xsl:template match="sect2info"></xsl:template>
  357. <xsl:template match="sect2/info"></xsl:template>
  358. <xsl:template match="sect3/title"></xsl:template>
  359. <xsl:template match="sect3/subtitle"></xsl:template>
  360. <xsl:template match="sect3/titleabbrev"></xsl:template>
  361. <xsl:template match="sect3info"></xsl:template>
  362. <xsl:template match="sect3/info"></xsl:template>
  363. <xsl:template match="sect4/title"></xsl:template>
  364. <xsl:template match="sect4/subtitle"></xsl:template>
  365. <xsl:template match="sect4/titleabbrev"></xsl:template>
  366. <xsl:template match="sect4info"></xsl:template>
  367. <xsl:template match="sect4/info"></xsl:template>
  368. <xsl:template match="sect5/title"></xsl:template>
  369. <xsl:template match="sect5/subtitle"></xsl:template>
  370. <xsl:template match="sect5/titleabbrev"></xsl:template>
  371. <xsl:template match="sect5info"></xsl:template>
  372. <xsl:template match="sect5/info"></xsl:template>
  373. <xsl:template match="simplesect/title"></xsl:template>
  374. <xsl:template match="simplesect/subtitle"></xsl:template>
  375. <xsl:template match="simplesect/titleabbrev"></xsl:template>
  376. <xsl:template match="simplesect/info"></xsl:template>
  377. <!-- ==================================================================== -->
  378. <xsl:template name="section.heading">
  379. <xsl:param name="section" select="."/>
  380. <xsl:param name="level" select="1"/>
  381. <xsl:param name="allow-anchors" select="1"/>
  382. <xsl:param name="title"/>
  383. <xsl:param name="class" select="'title'"/>
  384. <xsl:variable name="id">
  385. <xsl:choose>
  386. <!-- Make sure the subtitle doesn't get the same id as the title -->
  387. <xsl:when test="self::subtitle">
  388. <xsl:call-template name="object.id">
  389. <xsl:with-param name="object" select="."/>
  390. </xsl:call-template>
  391. </xsl:when>
  392. <!-- if title is in an *info wrapper, get the grandparent -->
  393. <xsl:when test="contains(local-name(..), 'info')">
  394. <xsl:call-template name="object.id">
  395. <xsl:with-param name="object" select="../.."/>
  396. </xsl:call-template>
  397. </xsl:when>
  398. <xsl:otherwise>
  399. <xsl:call-template name="object.id">
  400. <xsl:with-param name="object" select=".."/>
  401. </xsl:call-template>
  402. </xsl:otherwise>
  403. </xsl:choose>
  404. </xsl:variable>
  405. <!-- HTML H level is one higher than section level -->
  406. <xsl:variable name="hlevel">
  407. <xsl:choose>
  408. <!-- highest valid HTML H level is H6; so anything nested deeper
  409. than 5 levels down just becomes H6 -->
  410. <xsl:when test="$level &gt; 5">6</xsl:when>
  411. <xsl:otherwise>
  412. <xsl:value-of select="$level + 1"/>
  413. </xsl:otherwise>
  414. </xsl:choose>
  415. </xsl:variable>
  416. <xsl:element name="h{$hlevel}">
  417. <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
  418. <xsl:if test="$css.decoration != '0'">
  419. <xsl:if test="$hlevel&lt;3">
  420. <xsl:attribute name="style">clear: both</xsl:attribute>
  421. </xsl:if>
  422. </xsl:if>
  423. <xsl:if test="$allow-anchors != 0">
  424. <xsl:call-template name="anchor">
  425. <xsl:with-param name="node" select="$section"/>
  426. <xsl:with-param name="conditional" select="0"/>
  427. </xsl:call-template>
  428. </xsl:if>
  429. <xsl:copy-of select="$title"/>
  430. </xsl:element>
  431. </xsl:template>
  432. <!-- ==================================================================== -->
  433. <xsl:template match="bridgehead">
  434. <xsl:variable name="container"
  435. select="(ancestor::appendix
  436. |ancestor::article
  437. |ancestor::bibliography
  438. |ancestor::chapter
  439. |ancestor::glossary
  440. |ancestor::glossdiv
  441. |ancestor::index
  442. |ancestor::partintro
  443. |ancestor::preface
  444. |ancestor::refsect1
  445. |ancestor::refsect2
  446. |ancestor::refsect3
  447. |ancestor::sect1
  448. |ancestor::sect2
  449. |ancestor::sect3
  450. |ancestor::sect4
  451. |ancestor::sect5
  452. |ancestor::section
  453. |ancestor::setindex
  454. |ancestor::simplesect)[last()]"/>
  455. <xsl:variable name="clevel">
  456. <xsl:choose>
  457. <xsl:when test="local-name($container) = 'appendix'
  458. or local-name($container) = 'chapter'
  459. or local-name($container) = 'article'
  460. or local-name($container) = 'bibliography'
  461. or local-name($container) = 'glossary'
  462. or local-name($container) = 'index'
  463. or local-name($container) = 'partintro'
  464. or local-name($container) = 'preface'
  465. or local-name($container) = 'setindex'">1</xsl:when>
  466. <xsl:when test="local-name($container) = 'glossdiv'">
  467. <xsl:value-of select="count(ancestor::glossdiv)+1"/>
  468. </xsl:when>
  469. <xsl:when test="local-name($container) = 'sect1'
  470. or local-name($container) = 'sect2'
  471. or local-name($container) = 'sect3'
  472. or local-name($container) = 'sect4'
  473. or local-name($container) = 'sect5'
  474. or local-name($container) = 'refsect1'
  475. or local-name($container) = 'refsect2'
  476. or local-name($container) = 'refsect3'
  477. or local-name($container) = 'section'
  478. or local-name($container) = 'simplesect'">
  479. <xsl:variable name="slevel">
  480. <xsl:call-template name="section.level">
  481. <xsl:with-param name="node" select="$container"/>
  482. </xsl:call-template>
  483. </xsl:variable>
  484. <xsl:value-of select="$slevel + 1"/>
  485. </xsl:when>
  486. <xsl:otherwise>1</xsl:otherwise>
  487. </xsl:choose>
  488. </xsl:variable>
  489. <!-- HTML H level is one higher than section level -->
  490. <xsl:variable name="hlevel">
  491. <xsl:choose>
  492. <xsl:when test="@renderas = 'sect1'">2</xsl:when>
  493. <xsl:when test="@renderas = 'sect2'">3</xsl:when>
  494. <xsl:when test="@renderas = 'sect3'">4</xsl:when>
  495. <xsl:when test="@renderas = 'sect4'">5</xsl:when>
  496. <xsl:when test="@renderas = 'sect5'">6</xsl:when>
  497. <xsl:otherwise>
  498. <xsl:value-of select="$clevel + 1"/>
  499. </xsl:otherwise>
  500. </xsl:choose>
  501. </xsl:variable>
  502. <xsl:element name="h{$hlevel}">
  503. <xsl:call-template name="id.attribute">
  504. <xsl:with-param name="conditional" select="0"/>
  505. </xsl:call-template>
  506. <xsl:call-template name="anchor">
  507. <xsl:with-param name="conditional" select="0"/>
  508. </xsl:call-template>
  509. <xsl:apply-templates/>
  510. </xsl:element>
  511. </xsl:template>
  512. <xsl:template match="section/subtitle" mode="titlepage.mode" priority="2">
  513. <xsl:call-template name="section.subtitle"/>
  514. </xsl:template>
  515. <xsl:template match="simplesect/subtitle" mode="titlepage.mode" priority="2">
  516. <xsl:call-template name="section.subtitle"/>
  517. </xsl:template>
  518. <xsl:template match="sect1/subtitle" mode="titlepage.mode" priority="2">
  519. <xsl:call-template name="section.subtitle"/>
  520. </xsl:template>
  521. <xsl:template match="sect2/subtitle" mode="titlepage.mode" priority="2">
  522. <xsl:call-template name="section.subtitle"/>
  523. </xsl:template>
  524. <xsl:template match="sect3/subtitle" mode="titlepage.mode" priority="2">
  525. <xsl:call-template name="section.subtitle"/>
  526. </xsl:template>
  527. <xsl:template match="sect4/subtitle" mode="titlepage.mode" priority="2">
  528. <xsl:call-template name="section.subtitle"/>
  529. </xsl:template>
  530. <xsl:template match="sect5/subtitle" mode="titlepage.mode" priority="2">
  531. <xsl:call-template name="section.subtitle"/>
  532. </xsl:template>
  533. <xsl:template name="section.subtitle">
  534. <!-- the context node should be the subtitle of a section when called -->
  535. <xsl:variable name="section" select="(ancestor::section
  536. |ancestor::simplesect
  537. |ancestor::sect1
  538. |ancestor::sect2
  539. |ancestor::sect3
  540. |ancestor::sect4
  541. |ancestor::sect5)[last()]"/>
  542. <xsl:variable name="level">
  543. <xsl:call-template name="section.level">
  544. <xsl:with-param name="node" select="$section"/>
  545. </xsl:call-template>
  546. </xsl:variable>
  547. <xsl:call-template name="section.heading">
  548. <xsl:with-param name="section" select=".."/>
  549. <xsl:with-param name="allow-anchors" select="0"/>
  550. <!-- subtitle heading level one higher than section level -->
  551. <xsl:with-param name="level" select="$level + 1"/>
  552. <xsl:with-param name="class" select="'subtitle'"/>
  553. <xsl:with-param name="title">
  554. <xsl:apply-templates select="$section" mode="object.subtitle.markup">
  555. <xsl:with-param name="allow-anchors" select="0"/>
  556. </xsl:apply-templates>
  557. </xsl:with-param>
  558. </xsl:call-template>
  559. </xsl:template>
  560. </xsl:stylesheet>