sections.xsl 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  4. xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
  5. version='1.0'>
  6. <!-- ********************************************************************
  7. $Id: sections.xsl 9647 2012-10-26 17:42:03Z bobstayton $
  8. ********************************************************************
  9. This file is part of the XSL DocBook Stylesheet distribution.
  10. See ../README or http://docbook.sf.net/release/xsl/current/ for
  11. copyright and other information.
  12. ******************************************************************** -->
  13. <!-- ==================================================================== -->
  14. <xsl:template match="section">
  15. <xsl:choose>
  16. <xsl:when test="$rootid = @id or $rootid = @xml:id">
  17. <xsl:call-template name="section.page.sequence"/>
  18. </xsl:when>
  19. <xsl:otherwise>
  20. <xsl:variable name="id">
  21. <xsl:call-template name="object.id"/>
  22. </xsl:variable>
  23. <xsl:variable name="renderas">
  24. <xsl:choose>
  25. <xsl:when test="@renderas = 'sect1'">1</xsl:when>
  26. <xsl:when test="@renderas = 'sect2'">2</xsl:when>
  27. <xsl:when test="@renderas = 'sect3'">3</xsl:when>
  28. <xsl:when test="@renderas = 'sect4'">4</xsl:when>
  29. <xsl:when test="@renderas = 'sect5'">5</xsl:when>
  30. <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
  31. </xsl:choose>
  32. </xsl:variable>
  33. <xsl:variable name="level">
  34. <xsl:choose>
  35. <xsl:when test="$renderas != ''">
  36. <xsl:value-of select="$renderas"/>
  37. </xsl:when>
  38. <xsl:otherwise>
  39. <xsl:call-template name="section.level"/>
  40. </xsl:otherwise>
  41. </xsl:choose>
  42. </xsl:variable>
  43. <!-- xsl:use-attribute-sets takes only a Qname, not a variable -->
  44. <xsl:choose>
  45. <xsl:when test="$level = 1">
  46. <xsl:element name="fo:{$section.container.element}"
  47. use-attribute-sets="section.level1.properties">
  48. <xsl:attribute name="id"><xsl:value-of
  49. select="$id"/></xsl:attribute>
  50. <xsl:call-template name="section.content"/>
  51. </xsl:element>
  52. </xsl:when>
  53. <xsl:when test="$level = 2">
  54. <xsl:element name="fo:{$section.container.element}"
  55. use-attribute-sets="section.level2.properties">
  56. <xsl:attribute name="id"><xsl:value-of
  57. select="$id"/></xsl:attribute>
  58. <xsl:call-template name="section.content"/>
  59. </xsl:element>
  60. </xsl:when>
  61. <xsl:when test="$level = 3">
  62. <xsl:element name="fo:{$section.container.element}"
  63. use-attribute-sets="section.level3.properties">
  64. <xsl:attribute name="id"><xsl:value-of
  65. select="$id"/></xsl:attribute>
  66. <xsl:call-template name="section.content"/>
  67. </xsl:element>
  68. </xsl:when>
  69. <xsl:when test="$level = 4">
  70. <xsl:element name="fo:{$section.container.element}"
  71. use-attribute-sets="section.level4.properties">
  72. <xsl:attribute name="id"><xsl:value-of
  73. select="$id"/></xsl:attribute>
  74. <xsl:call-template name="section.content"/>
  75. </xsl:element>
  76. </xsl:when>
  77. <xsl:when test="$level = 5">
  78. <xsl:element name="fo:{$section.container.element}"
  79. use-attribute-sets="section.level5.properties">
  80. <xsl:attribute name="id"><xsl:value-of
  81. select="$id"/></xsl:attribute>
  82. <xsl:call-template name="section.content"/>
  83. </xsl:element>
  84. </xsl:when>
  85. <xsl:otherwise>
  86. <xsl:element name="fo:{$section.container.element}"
  87. use-attribute-sets="section.level6.properties">
  88. <xsl:attribute name="id"><xsl:value-of
  89. select="$id"/></xsl:attribute>
  90. <xsl:call-template name="section.content"/>
  91. </xsl:element>
  92. </xsl:otherwise>
  93. </xsl:choose>
  94. </xsl:otherwise>
  95. </xsl:choose>
  96. </xsl:template>
  97. <xsl:template name="section.content">
  98. <xsl:call-template name="section.titlepage"/>
  99. <xsl:variable name="toc.params">
  100. <xsl:call-template name="find.path.params">
  101. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  102. </xsl:call-template>
  103. </xsl:variable>
  104. <xsl:if test="contains($toc.params, 'toc')
  105. and (count(ancestor::section)+1) &lt;=
  106. $generate.section.toc.level">
  107. <xsl:call-template name="section.toc">
  108. <xsl:with-param name="toc.title.p"
  109. select="contains($toc.params, 'title')"/>
  110. </xsl:call-template>
  111. <xsl:call-template name="section.toc.separator"/>
  112. </xsl:if>
  113. <xsl:apply-templates/>
  114. </xsl:template>
  115. <xsl:template match="/section" name="section.page.sequence">
  116. <xsl:variable name="id">
  117. <xsl:call-template name="object.id"/>
  118. </xsl:variable>
  119. <xsl:variable name="master-reference">
  120. <xsl:call-template name="select.pagemaster"/>
  121. </xsl:variable>
  122. <fo:page-sequence hyphenate="{$hyphenate}"
  123. master-reference="{$master-reference}">
  124. <xsl:attribute name="language">
  125. <xsl:call-template name="l10n.language"/>
  126. </xsl:attribute>
  127. <xsl:attribute name="format">
  128. <xsl:call-template name="page.number.format">
  129. <xsl:with-param name="master-reference" select="$master-reference"/>
  130. </xsl:call-template>
  131. </xsl:attribute>
  132. <xsl:attribute name="initial-page-number">
  133. <xsl:call-template name="initial.page.number">
  134. <xsl:with-param name="master-reference" select="$master-reference"/>
  135. </xsl:call-template>
  136. </xsl:attribute>
  137. <xsl:attribute name="force-page-count">
  138. <xsl:call-template name="force.page.count">
  139. <xsl:with-param name="master-reference" select="$master-reference"/>
  140. </xsl:call-template>
  141. </xsl:attribute>
  142. <xsl:attribute name="hyphenation-character">
  143. <xsl:call-template name="gentext">
  144. <xsl:with-param name="key" select="'hyphenation-character'"/>
  145. </xsl:call-template>
  146. </xsl:attribute>
  147. <xsl:attribute name="hyphenation-push-character-count">
  148. <xsl:call-template name="gentext">
  149. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  150. </xsl:call-template>
  151. </xsl:attribute>
  152. <xsl:attribute name="hyphenation-remain-character-count">
  153. <xsl:call-template name="gentext">
  154. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  155. </xsl:call-template>
  156. </xsl:attribute>
  157. <xsl:apply-templates select="." mode="running.head.mode">
  158. <xsl:with-param name="master-reference" select="$master-reference"/>
  159. </xsl:apply-templates>
  160. <xsl:apply-templates select="." mode="running.foot.mode">
  161. <xsl:with-param name="master-reference" select="$master-reference"/>
  162. </xsl:apply-templates>
  163. <fo:flow flow-name="xsl-region-body">
  164. <xsl:call-template name="set.flow.properties">
  165. <xsl:with-param name="element" select="local-name(.)"/>
  166. <xsl:with-param name="master-reference" select="$master-reference"/>
  167. </xsl:call-template>
  168. <fo:block id="{$id}"
  169. xsl:use-attribute-sets="section.level1.properties">
  170. <xsl:call-template name="section.titlepage"/>
  171. </fo:block>
  172. <xsl:variable name="toc.params">
  173. <xsl:call-template name="find.path.params">
  174. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  175. </xsl:call-template>
  176. </xsl:variable>
  177. <xsl:if test="contains($toc.params, 'toc')
  178. and (count(ancestor::section)+1) &lt;=
  179. $generate.section.toc.level">
  180. <xsl:call-template name="section.toc">
  181. <xsl:with-param name="toc.title.p"
  182. select="contains($toc.params, 'title')"/>
  183. </xsl:call-template>
  184. <xsl:call-template name="section.toc.separator"/>
  185. </xsl:if>
  186. <xsl:apply-templates/>
  187. </fo:flow>
  188. </fo:page-sequence>
  189. </xsl:template>
  190. <xsl:template match="section/title
  191. |simplesect/title
  192. |sect1/title
  193. |sect2/title
  194. |sect3/title
  195. |sect4/title
  196. |sect5/title
  197. |section/info/title
  198. |simplesect/info/title
  199. |sect1/info/title
  200. |sect2/info/title
  201. |sect3/info/title
  202. |sect4/info/title
  203. |sect5/info/title
  204. |section/sectioninfo/title
  205. |sect1/sect1info/title
  206. |sect2/sect2info/title
  207. |sect3/sect3info/title
  208. |sect4/sect4info/title
  209. |sect5/sect5info/title"
  210. mode="titlepage.mode"
  211. priority="2">
  212. <xsl:variable name="section"
  213. select="(ancestor::section |
  214. ancestor::simplesect |
  215. ancestor::sect1 |
  216. ancestor::sect2 |
  217. ancestor::sect3 |
  218. ancestor::sect4 |
  219. ancestor::sect5)[position() = last()]"/>
  220. <fo:block keep-with-next.within-column="always">
  221. <xsl:variable name="id">
  222. <xsl:call-template name="object.id">
  223. <xsl:with-param name="object" select="$section"/>
  224. </xsl:call-template>
  225. </xsl:variable>
  226. <xsl:variable name="renderas">
  227. <xsl:choose>
  228. <xsl:when test="$section/@renderas = 'sect1'">1</xsl:when>
  229. <xsl:when test="$section/@renderas = 'sect2'">2</xsl:when>
  230. <xsl:when test="$section/@renderas = 'sect3'">3</xsl:when>
  231. <xsl:when test="$section/@renderas = 'sect4'">4</xsl:when>
  232. <xsl:when test="$section/@renderas = 'sect5'">5</xsl:when>
  233. <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
  234. </xsl:choose>
  235. </xsl:variable>
  236. <xsl:variable name="level">
  237. <xsl:choose>
  238. <xsl:when test="$renderas != ''">
  239. <xsl:value-of select="$renderas"/>
  240. </xsl:when>
  241. <xsl:otherwise>
  242. <xsl:call-template name="section.level">
  243. <xsl:with-param name="node" select="$section"/>
  244. </xsl:call-template>
  245. </xsl:otherwise>
  246. </xsl:choose>
  247. </xsl:variable>
  248. <xsl:variable name="marker">
  249. <xsl:choose>
  250. <xsl:when test="$level &lt;= $marker.section.level">1</xsl:when>
  251. <xsl:otherwise>0</xsl:otherwise>
  252. </xsl:choose>
  253. </xsl:variable>
  254. <xsl:variable name="title">
  255. <xsl:apply-templates select="$section" mode="object.title.markup">
  256. <xsl:with-param name="allow-anchors" select="1"/>
  257. </xsl:apply-templates>
  258. </xsl:variable>
  259. <xsl:variable name="marker.title">
  260. <xsl:apply-templates select="$section" mode="titleabbrev.markup">
  261. <xsl:with-param name="allow-anchors" select="0"/>
  262. </xsl:apply-templates>
  263. </xsl:variable>
  264. <xsl:if test="$axf.extensions != 0">
  265. <xsl:attribute name="axf:outline-level">
  266. <xsl:value-of select="count(ancestor::*)-1"/>
  267. </xsl:attribute>
  268. <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
  269. <xsl:attribute name="axf:outline-title">
  270. <xsl:value-of select="normalize-space($title)"/>
  271. </xsl:attribute>
  272. </xsl:if>
  273. <xsl:call-template name="section.heading">
  274. <xsl:with-param name="level" select="$level"/>
  275. <xsl:with-param name="title" select="$title"/>
  276. <xsl:with-param name="marker" select="$marker"/>
  277. <xsl:with-param name="marker.title" select="$marker.title"/>
  278. </xsl:call-template>
  279. </fo:block>
  280. </xsl:template>
  281. <xsl:template match="sect1">
  282. <xsl:variable name="id">
  283. <xsl:call-template name="object.id"/>
  284. </xsl:variable>
  285. <xsl:element name="fo:{$section.container.element}"
  286. use-attribute-sets="section.level1.properties">
  287. <xsl:attribute name="id"><xsl:value-of
  288. select="$id"/></xsl:attribute>
  289. <xsl:call-template name="sect1.titlepage"/>
  290. <xsl:variable name="toc.params">
  291. <xsl:call-template name="find.path.params">
  292. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  293. </xsl:call-template>
  294. </xsl:variable>
  295. <xsl:if test="contains($toc.params, 'toc')
  296. and $generate.section.toc.level &gt;= 1">
  297. <xsl:call-template name="section.toc">
  298. <xsl:with-param name="toc.title.p"
  299. select="contains($toc.params, 'title')"/>
  300. </xsl:call-template>
  301. <xsl:call-template name="section.toc.separator"/>
  302. </xsl:if>
  303. <xsl:apply-templates/>
  304. </xsl:element>
  305. </xsl:template>
  306. <xsl:template match="/sect1">
  307. <xsl:variable name="id">
  308. <xsl:call-template name="object.id"/>
  309. </xsl:variable>
  310. <xsl:variable name="master-reference">
  311. <xsl:call-template name="select.pagemaster"/>
  312. </xsl:variable>
  313. <fo:page-sequence hyphenate="{$hyphenate}"
  314. master-reference="{$master-reference}">
  315. <xsl:attribute name="language">
  316. <xsl:call-template name="l10n.language"/>
  317. </xsl:attribute>
  318. <xsl:attribute name="format">
  319. <xsl:call-template name="page.number.format">
  320. <xsl:with-param name="master-reference" select="$master-reference"/>
  321. </xsl:call-template>
  322. </xsl:attribute>
  323. <xsl:attribute name="initial-page-number">
  324. <xsl:call-template name="initial.page.number">
  325. <xsl:with-param name="master-reference" select="$master-reference"/>
  326. </xsl:call-template>
  327. </xsl:attribute>
  328. <xsl:attribute name="force-page-count">
  329. <xsl:call-template name="force.page.count">
  330. <xsl:with-param name="master-reference" select="$master-reference"/>
  331. </xsl:call-template>
  332. </xsl:attribute>
  333. <xsl:attribute name="hyphenation-character">
  334. <xsl:call-template name="gentext">
  335. <xsl:with-param name="key" select="'hyphenation-character'"/>
  336. </xsl:call-template>
  337. </xsl:attribute>
  338. <xsl:attribute name="hyphenation-push-character-count">
  339. <xsl:call-template name="gentext">
  340. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  341. </xsl:call-template>
  342. </xsl:attribute>
  343. <xsl:attribute name="hyphenation-remain-character-count">
  344. <xsl:call-template name="gentext">
  345. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  346. </xsl:call-template>
  347. </xsl:attribute>
  348. <xsl:apply-templates select="." mode="running.head.mode">
  349. <xsl:with-param name="master-reference" select="$master-reference"/>
  350. </xsl:apply-templates>
  351. <xsl:apply-templates select="." mode="running.foot.mode">
  352. <xsl:with-param name="master-reference" select="$master-reference"/>
  353. </xsl:apply-templates>
  354. <fo:flow flow-name="xsl-region-body">
  355. <xsl:call-template name="set.flow.properties">
  356. <xsl:with-param name="element" select="local-name(.)"/>
  357. <xsl:with-param name="master-reference" select="$master-reference"/>
  358. </xsl:call-template>
  359. <fo:block id="{$id}"
  360. xsl:use-attribute-sets="section.level1.properties">
  361. <xsl:call-template name="sect1.titlepage"/>
  362. </fo:block>
  363. <xsl:variable name="toc.params">
  364. <xsl:call-template name="find.path.params">
  365. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  366. </xsl:call-template>
  367. </xsl:variable>
  368. <xsl:if test="contains($toc.params, 'toc')
  369. and $generate.section.toc.level &gt;= 1">
  370. <xsl:call-template name="section.toc">
  371. <xsl:with-param name="toc.title.p"
  372. select="contains($toc.params, 'title')"/>
  373. </xsl:call-template>
  374. <xsl:call-template name="section.toc.separator"/>
  375. </xsl:if>
  376. <xsl:apply-templates/>
  377. </fo:flow>
  378. </fo:page-sequence>
  379. </xsl:template>
  380. <xsl:template match="sect2">
  381. <xsl:variable name="id">
  382. <xsl:call-template name="object.id"/>
  383. </xsl:variable>
  384. <xsl:element name="fo:{$section.container.element}"
  385. use-attribute-sets="section.level2.properties">
  386. <xsl:attribute name="id"><xsl:value-of
  387. select="$id"/></xsl:attribute>
  388. <xsl:call-template name="sect2.titlepage"/>
  389. <xsl:variable name="toc.params">
  390. <xsl:call-template name="find.path.params">
  391. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  392. </xsl:call-template>
  393. </xsl:variable>
  394. <xsl:if test="contains($toc.params, 'toc')
  395. and $generate.section.toc.level &gt;= 2">
  396. <xsl:call-template name="section.toc">
  397. <xsl:with-param name="toc.title.p"
  398. select="contains($toc.params, 'title')"/>
  399. </xsl:call-template>
  400. <xsl:call-template name="section.toc.separator"/>
  401. </xsl:if>
  402. <xsl:apply-templates/>
  403. </xsl:element>
  404. </xsl:template>
  405. <xsl:template match="sect3">
  406. <xsl:variable name="id">
  407. <xsl:call-template name="object.id"/>
  408. </xsl:variable>
  409. <xsl:element name="fo:{$section.container.element}"
  410. use-attribute-sets="section.level3.properties">
  411. <xsl:attribute name="id"><xsl:value-of
  412. select="$id"/></xsl:attribute>
  413. <xsl:call-template name="sect3.titlepage"/>
  414. <xsl:variable name="toc.params">
  415. <xsl:call-template name="find.path.params">
  416. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  417. </xsl:call-template>
  418. </xsl:variable>
  419. <xsl:if test="contains($toc.params, 'toc')
  420. and $generate.section.toc.level &gt;= 3">
  421. <xsl:call-template name="section.toc">
  422. <xsl:with-param name="toc.title.p"
  423. select="contains($toc.params, 'title')"/>
  424. </xsl:call-template>
  425. <xsl:call-template name="section.toc.separator"/>
  426. </xsl:if>
  427. <xsl:apply-templates/>
  428. </xsl:element>
  429. </xsl:template>
  430. <xsl:template match="sect4">
  431. <xsl:variable name="id">
  432. <xsl:call-template name="object.id"/>
  433. </xsl:variable>
  434. <xsl:element name="fo:{$section.container.element}"
  435. use-attribute-sets="section.level4.properties">
  436. <xsl:attribute name="id"><xsl:value-of
  437. select="$id"/></xsl:attribute>
  438. <xsl:call-template name="sect4.titlepage"/>
  439. <xsl:variable name="toc.params">
  440. <xsl:call-template name="find.path.params">
  441. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  442. </xsl:call-template>
  443. </xsl:variable>
  444. <xsl:if test="contains($toc.params, 'toc')
  445. and $generate.section.toc.level &gt;= 4">
  446. <xsl:call-template name="section.toc">
  447. <xsl:with-param name="toc.title.p"
  448. select="contains($toc.params, 'title')"/>
  449. </xsl:call-template>
  450. <xsl:call-template name="section.toc.separator"/>
  451. </xsl:if>
  452. <xsl:apply-templates/>
  453. </xsl:element>
  454. </xsl:template>
  455. <xsl:template match="sect5">
  456. <xsl:variable name="id">
  457. <xsl:call-template name="object.id"/>
  458. </xsl:variable>
  459. <xsl:element name="fo:{$section.container.element}"
  460. use-attribute-sets="section.level5.properties">
  461. <xsl:attribute name="id"><xsl:value-of
  462. select="$id"/></xsl:attribute>
  463. <xsl:call-template name="sect5.titlepage"/>
  464. <xsl:variable name="toc.params">
  465. <xsl:call-template name="find.path.params">
  466. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  467. </xsl:call-template>
  468. </xsl:variable>
  469. <xsl:if test="contains($toc.params, 'toc')
  470. and $generate.section.toc.level &gt;= 5">
  471. <xsl:call-template name="section.toc">
  472. <xsl:with-param name="toc.title.p"
  473. select="contains($toc.params, 'title')"/>
  474. </xsl:call-template>
  475. <xsl:call-template name="section.toc.separator"/>
  476. </xsl:if>
  477. <xsl:apply-templates/>
  478. </xsl:element>
  479. </xsl:template>
  480. <xsl:template match="simplesect">
  481. <xsl:variable name="id">
  482. <xsl:call-template name="object.id"/>
  483. </xsl:variable>
  484. <xsl:element name="fo:{$section.container.element}">
  485. <xsl:attribute name="id"><xsl:value-of
  486. select="$id"/></xsl:attribute>
  487. <xsl:call-template name="simplesect.titlepage"/>
  488. <xsl:apply-templates/>
  489. </xsl:element>
  490. </xsl:template>
  491. <xsl:template match="sectioninfo"></xsl:template>
  492. <xsl:template match="section/info"></xsl:template>
  493. <xsl:template match="section/title"></xsl:template>
  494. <xsl:template match="section/titleabbrev"></xsl:template>
  495. <xsl:template match="section/subtitle"></xsl:template>
  496. <xsl:template match="sect1info"></xsl:template>
  497. <xsl:template match="sect1/info"></xsl:template>
  498. <xsl:template match="sect1/title"></xsl:template>
  499. <xsl:template match="sect1/titleabbrev"></xsl:template>
  500. <xsl:template match="sect1/subtitle"></xsl:template>
  501. <xsl:template match="sect2info"></xsl:template>
  502. <xsl:template match="sect2/info"></xsl:template>
  503. <xsl:template match="sect2/title"></xsl:template>
  504. <xsl:template match="sect2/titleabbrev"></xsl:template>
  505. <xsl:template match="sect2/subtitle"></xsl:template>
  506. <xsl:template match="sect3info"></xsl:template>
  507. <xsl:template match="sect3/info"></xsl:template>
  508. <xsl:template match="sect3/title"></xsl:template>
  509. <xsl:template match="sect3/titleabbrev"></xsl:template>
  510. <xsl:template match="sect3/subtitle"></xsl:template>
  511. <xsl:template match="sect4info"></xsl:template>
  512. <xsl:template match="sect4/info"></xsl:template>
  513. <xsl:template match="sect4/title"></xsl:template>
  514. <xsl:template match="sect4/titleabbrev"></xsl:template>
  515. <xsl:template match="sect4/subtitle"></xsl:template>
  516. <xsl:template match="sect5info"></xsl:template>
  517. <xsl:template match="sect5/info"></xsl:template>
  518. <xsl:template match="sect5/title"></xsl:template>
  519. <xsl:template match="sect5/titleabbrev"></xsl:template>
  520. <xsl:template match="sect5/subtitle"></xsl:template>
  521. <xsl:template match="simplesect/info"></xsl:template>
  522. <xsl:template match="simplesect/title"></xsl:template>
  523. <xsl:template match="simplesect/titleabbrev"></xsl:template>
  524. <xsl:template match="simplesect/subtitle"></xsl:template>
  525. <!-- ==================================================================== -->
  526. <xsl:template name="section.heading">
  527. <xsl:param name="level" select="1"/>
  528. <xsl:param name="marker" select="1"/>
  529. <xsl:param name="title"/>
  530. <xsl:param name="marker.title"/>
  531. <fo:block xsl:use-attribute-sets="section.title.properties">
  532. <xsl:if test="$marker != 0">
  533. <fo:marker marker-class-name="section.head.marker">
  534. <xsl:copy-of select="$marker.title"/>
  535. </fo:marker>
  536. </xsl:if>
  537. <xsl:choose>
  538. <xsl:when test="$level=1">
  539. <fo:block xsl:use-attribute-sets="section.title.level1.properties">
  540. <xsl:copy-of select="$title"/>
  541. </fo:block>
  542. </xsl:when>
  543. <xsl:when test="$level=2">
  544. <fo:block xsl:use-attribute-sets="section.title.level2.properties">
  545. <xsl:copy-of select="$title"/>
  546. </fo:block>
  547. </xsl:when>
  548. <xsl:when test="$level=3">
  549. <fo:block xsl:use-attribute-sets="section.title.level3.properties">
  550. <xsl:copy-of select="$title"/>
  551. </fo:block>
  552. </xsl:when>
  553. <xsl:when test="$level=4">
  554. <fo:block xsl:use-attribute-sets="section.title.level4.properties">
  555. <xsl:copy-of select="$title"/>
  556. </fo:block>
  557. </xsl:when>
  558. <xsl:when test="$level=5">
  559. <fo:block xsl:use-attribute-sets="section.title.level5.properties">
  560. <xsl:copy-of select="$title"/>
  561. </fo:block>
  562. </xsl:when>
  563. <xsl:otherwise>
  564. <fo:block xsl:use-attribute-sets="section.title.level6.properties">
  565. <xsl:copy-of select="$title"/>
  566. </fo:block>
  567. </xsl:otherwise>
  568. </xsl:choose>
  569. </fo:block>
  570. </xsl:template>
  571. <!-- ==================================================================== -->
  572. <xsl:template match="bridgehead">
  573. <xsl:variable name="container"
  574. select="(ancestor::appendix
  575. |ancestor::article
  576. |ancestor::bibliography
  577. |ancestor::chapter
  578. |ancestor::glossary
  579. |ancestor::glossdiv
  580. |ancestor::index
  581. |ancestor::partintro
  582. |ancestor::preface
  583. |ancestor::refsect1
  584. |ancestor::refsect2
  585. |ancestor::refsect3
  586. |ancestor::sect1
  587. |ancestor::sect2
  588. |ancestor::sect3
  589. |ancestor::sect4
  590. |ancestor::sect5
  591. |ancestor::section
  592. |ancestor::setindex
  593. |ancestor::simplesect)[last()]"/>
  594. <xsl:variable name="clevel">
  595. <xsl:choose>
  596. <xsl:when test="local-name($container) = 'appendix'
  597. or local-name($container) = 'chapter'
  598. or local-name($container) = 'article'
  599. or local-name($container) = 'bibliography'
  600. or local-name($container) = 'glossary'
  601. or local-name($container) = 'index'
  602. or local-name($container) = 'partintro'
  603. or local-name($container) = 'preface'
  604. or local-name($container) = 'setindex'">2</xsl:when>
  605. <xsl:when test="local-name($container) = 'glossdiv'">
  606. <xsl:value-of select="count(ancestor::glossdiv)+2"/>
  607. </xsl:when>
  608. <xsl:when test="local-name($container) = 'sect1'
  609. or local-name($container) = 'sect2'
  610. or local-name($container) = 'sect3'
  611. or local-name($container) = 'sect4'
  612. or local-name($container) = 'sect5'
  613. or local-name($container) = 'refsect1'
  614. or local-name($container) = 'refsect2'
  615. or local-name($container) = 'refsect3'
  616. or local-name($container) = 'section'
  617. or local-name($container) = 'simplesect'">
  618. <xsl:variable name="slevel">
  619. <xsl:call-template name="section.level">
  620. <xsl:with-param name="node" select="$container"/>
  621. </xsl:call-template>
  622. </xsl:variable>
  623. <xsl:value-of select="$slevel + 1"/>
  624. </xsl:when>
  625. <xsl:otherwise>2</xsl:otherwise>
  626. </xsl:choose>
  627. </xsl:variable>
  628. <xsl:variable name="level">
  629. <xsl:choose>
  630. <xsl:when test="@renderas = 'sect1'">1</xsl:when>
  631. <xsl:when test="@renderas = 'sect2'">2</xsl:when>
  632. <xsl:when test="@renderas = 'sect3'">3</xsl:when>
  633. <xsl:when test="@renderas = 'sect4'">4</xsl:when>
  634. <xsl:when test="@renderas = 'sect5'">5</xsl:when>
  635. <xsl:otherwise>
  636. <xsl:value-of select="$clevel"/>
  637. </xsl:otherwise>
  638. </xsl:choose>
  639. </xsl:variable>
  640. <xsl:variable name="marker">
  641. <xsl:choose>
  642. <xsl:when test="$level &lt;= $marker.section.level">1</xsl:when>
  643. <xsl:otherwise>0</xsl:otherwise>
  644. </xsl:choose>
  645. </xsl:variable>
  646. <xsl:variable name="marker.title">
  647. <xsl:apply-templates/>
  648. </xsl:variable>
  649. <xsl:variable name="id">
  650. <xsl:call-template name="object.id"/>
  651. </xsl:variable>
  652. <fo:block id="{$id}">
  653. <xsl:call-template name="section.heading">
  654. <xsl:with-param name="level" select="$level"/>
  655. <xsl:with-param name="title">
  656. <xsl:apply-templates/>
  657. </xsl:with-param>
  658. <xsl:with-param name="marker" select="$marker"/>
  659. <xsl:with-param name="marker.title" select="$marker.title"/>
  660. </xsl:call-template>
  661. </fo:block>
  662. </xsl:template>
  663. </xsl:stylesheet>