sections.xsl 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  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$
  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="$passivetex.extensions != 0">
  265. <fotex:bookmark xmlns:fotex="http://www.tug.org/fotex"
  266. fotex-bookmark-level="{$level + 2}"
  267. fotex-bookmark-label="{$id}">
  268. <xsl:value-of select="$marker.title"/>
  269. </fotex:bookmark>
  270. </xsl:if>
  271. <xsl:if test="$axf.extensions != 0">
  272. <xsl:attribute name="axf:outline-level">
  273. <xsl:value-of select="count(ancestor::*)-1"/>
  274. </xsl:attribute>
  275. <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
  276. <xsl:attribute name="axf:outline-title">
  277. <xsl:value-of select="normalize-space($title)"/>
  278. </xsl:attribute>
  279. </xsl:if>
  280. <xsl:call-template name="section.heading">
  281. <xsl:with-param name="level" select="$level"/>
  282. <xsl:with-param name="title" select="$title"/>
  283. <xsl:with-param name="marker" select="$marker"/>
  284. <xsl:with-param name="marker.title" select="$marker.title"/>
  285. </xsl:call-template>
  286. </fo:block>
  287. </xsl:template>
  288. <xsl:template match="sect1">
  289. <xsl:variable name="id">
  290. <xsl:call-template name="object.id"/>
  291. </xsl:variable>
  292. <xsl:element name="fo:{$section.container.element}"
  293. use-attribute-sets="section.level1.properties">
  294. <xsl:attribute name="id"><xsl:value-of
  295. select="$id"/></xsl:attribute>
  296. <xsl:call-template name="sect1.titlepage"/>
  297. <xsl:variable name="toc.params">
  298. <xsl:call-template name="find.path.params">
  299. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  300. </xsl:call-template>
  301. </xsl:variable>
  302. <xsl:if test="contains($toc.params, 'toc')
  303. and $generate.section.toc.level &gt;= 1">
  304. <xsl:call-template name="section.toc">
  305. <xsl:with-param name="toc.title.p"
  306. select="contains($toc.params, 'title')"/>
  307. </xsl:call-template>
  308. <xsl:call-template name="section.toc.separator"/>
  309. </xsl:if>
  310. <xsl:apply-templates/>
  311. </xsl:element>
  312. </xsl:template>
  313. <xsl:template match="/sect1">
  314. <xsl:variable name="id">
  315. <xsl:call-template name="object.id"/>
  316. </xsl:variable>
  317. <xsl:variable name="master-reference">
  318. <xsl:call-template name="select.pagemaster"/>
  319. </xsl:variable>
  320. <fo:page-sequence hyphenate="{$hyphenate}"
  321. master-reference="{$master-reference}">
  322. <xsl:attribute name="language">
  323. <xsl:call-template name="l10n.language"/>
  324. </xsl:attribute>
  325. <xsl:attribute name="format">
  326. <xsl:call-template name="page.number.format">
  327. <xsl:with-param name="master-reference" select="$master-reference"/>
  328. </xsl:call-template>
  329. </xsl:attribute>
  330. <xsl:attribute name="initial-page-number">
  331. <xsl:call-template name="initial.page.number">
  332. <xsl:with-param name="master-reference" select="$master-reference"/>
  333. </xsl:call-template>
  334. </xsl:attribute>
  335. <xsl:attribute name="force-page-count">
  336. <xsl:call-template name="force.page.count">
  337. <xsl:with-param name="master-reference" select="$master-reference"/>
  338. </xsl:call-template>
  339. </xsl:attribute>
  340. <xsl:attribute name="hyphenation-character">
  341. <xsl:call-template name="gentext">
  342. <xsl:with-param name="key" select="'hyphenation-character'"/>
  343. </xsl:call-template>
  344. </xsl:attribute>
  345. <xsl:attribute name="hyphenation-push-character-count">
  346. <xsl:call-template name="gentext">
  347. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  348. </xsl:call-template>
  349. </xsl:attribute>
  350. <xsl:attribute name="hyphenation-remain-character-count">
  351. <xsl:call-template name="gentext">
  352. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  353. </xsl:call-template>
  354. </xsl:attribute>
  355. <xsl:apply-templates select="." mode="running.head.mode">
  356. <xsl:with-param name="master-reference" select="$master-reference"/>
  357. </xsl:apply-templates>
  358. <xsl:apply-templates select="." mode="running.foot.mode">
  359. <xsl:with-param name="master-reference" select="$master-reference"/>
  360. </xsl:apply-templates>
  361. <fo:flow flow-name="xsl-region-body">
  362. <xsl:call-template name="set.flow.properties">
  363. <xsl:with-param name="element" select="local-name(.)"/>
  364. <xsl:with-param name="master-reference" select="$master-reference"/>
  365. </xsl:call-template>
  366. <fo:block id="{$id}"
  367. xsl:use-attribute-sets="section.level1.properties">
  368. <xsl:call-template name="sect1.titlepage"/>
  369. </fo:block>
  370. <xsl:variable name="toc.params">
  371. <xsl:call-template name="find.path.params">
  372. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  373. </xsl:call-template>
  374. </xsl:variable>
  375. <xsl:if test="contains($toc.params, 'toc')
  376. and $generate.section.toc.level &gt;= 1">
  377. <xsl:call-template name="section.toc">
  378. <xsl:with-param name="toc.title.p"
  379. select="contains($toc.params, 'title')"/>
  380. </xsl:call-template>
  381. <xsl:call-template name="section.toc.separator"/>
  382. </xsl:if>
  383. <xsl:apply-templates/>
  384. </fo:flow>
  385. </fo:page-sequence>
  386. </xsl:template>
  387. <xsl:template match="sect2">
  388. <xsl:variable name="id">
  389. <xsl:call-template name="object.id"/>
  390. </xsl:variable>
  391. <xsl:element name="fo:{$section.container.element}"
  392. use-attribute-sets="section.level2.properties">
  393. <xsl:attribute name="id"><xsl:value-of
  394. select="$id"/></xsl:attribute>
  395. <xsl:call-template name="sect2.titlepage"/>
  396. <xsl:variable name="toc.params">
  397. <xsl:call-template name="find.path.params">
  398. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  399. </xsl:call-template>
  400. </xsl:variable>
  401. <xsl:if test="contains($toc.params, 'toc')
  402. and $generate.section.toc.level &gt;= 2">
  403. <xsl:call-template name="section.toc">
  404. <xsl:with-param name="toc.title.p"
  405. select="contains($toc.params, 'title')"/>
  406. </xsl:call-template>
  407. <xsl:call-template name="section.toc.separator"/>
  408. </xsl:if>
  409. <xsl:apply-templates/>
  410. </xsl:element>
  411. </xsl:template>
  412. <xsl:template match="sect3">
  413. <xsl:variable name="id">
  414. <xsl:call-template name="object.id"/>
  415. </xsl:variable>
  416. <xsl:element name="fo:{$section.container.element}"
  417. use-attribute-sets="section.level3.properties">
  418. <xsl:attribute name="id"><xsl:value-of
  419. select="$id"/></xsl:attribute>
  420. <xsl:call-template name="sect3.titlepage"/>
  421. <xsl:variable name="toc.params">
  422. <xsl:call-template name="find.path.params">
  423. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  424. </xsl:call-template>
  425. </xsl:variable>
  426. <xsl:if test="contains($toc.params, 'toc')
  427. and $generate.section.toc.level &gt;= 3">
  428. <xsl:call-template name="section.toc">
  429. <xsl:with-param name="toc.title.p"
  430. select="contains($toc.params, 'title')"/>
  431. </xsl:call-template>
  432. <xsl:call-template name="section.toc.separator"/>
  433. </xsl:if>
  434. <xsl:apply-templates/>
  435. </xsl:element>
  436. </xsl:template>
  437. <xsl:template match="sect4">
  438. <xsl:variable name="id">
  439. <xsl:call-template name="object.id"/>
  440. </xsl:variable>
  441. <xsl:element name="fo:{$section.container.element}"
  442. use-attribute-sets="section.level4.properties">
  443. <xsl:attribute name="id"><xsl:value-of
  444. select="$id"/></xsl:attribute>
  445. <xsl:call-template name="sect4.titlepage"/>
  446. <xsl:variable name="toc.params">
  447. <xsl:call-template name="find.path.params">
  448. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  449. </xsl:call-template>
  450. </xsl:variable>
  451. <xsl:if test="contains($toc.params, 'toc')
  452. and $generate.section.toc.level &gt;= 4">
  453. <xsl:call-template name="section.toc">
  454. <xsl:with-param name="toc.title.p"
  455. select="contains($toc.params, 'title')"/>
  456. </xsl:call-template>
  457. <xsl:call-template name="section.toc.separator"/>
  458. </xsl:if>
  459. <xsl:apply-templates/>
  460. </xsl:element>
  461. </xsl:template>
  462. <xsl:template match="sect5">
  463. <xsl:variable name="id">
  464. <xsl:call-template name="object.id"/>
  465. </xsl:variable>
  466. <xsl:element name="fo:{$section.container.element}"
  467. use-attribute-sets="section.level5.properties">
  468. <xsl:attribute name="id"><xsl:value-of
  469. select="$id"/></xsl:attribute>
  470. <xsl:call-template name="sect5.titlepage"/>
  471. <xsl:variable name="toc.params">
  472. <xsl:call-template name="find.path.params">
  473. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  474. </xsl:call-template>
  475. </xsl:variable>
  476. <xsl:if test="contains($toc.params, 'toc')
  477. and $generate.section.toc.level &gt;= 5">
  478. <xsl:call-template name="section.toc">
  479. <xsl:with-param name="toc.title.p"
  480. select="contains($toc.params, 'title')"/>
  481. </xsl:call-template>
  482. <xsl:call-template name="section.toc.separator"/>
  483. </xsl:if>
  484. <xsl:apply-templates/>
  485. </xsl:element>
  486. </xsl:template>
  487. <xsl:template match="simplesect">
  488. <xsl:variable name="id">
  489. <xsl:call-template name="object.id"/>
  490. </xsl:variable>
  491. <xsl:element name="fo:{$section.container.element}">
  492. <xsl:attribute name="id"><xsl:value-of
  493. select="$id"/></xsl:attribute>
  494. <xsl:call-template name="simplesect.titlepage"/>
  495. <xsl:apply-templates/>
  496. </xsl:element>
  497. </xsl:template>
  498. <xsl:template match="sectioninfo"></xsl:template>
  499. <xsl:template match="section/info"></xsl:template>
  500. <xsl:template match="section/title"></xsl:template>
  501. <xsl:template match="section/titleabbrev"></xsl:template>
  502. <xsl:template match="section/subtitle"></xsl:template>
  503. <xsl:template match="sect1info"></xsl:template>
  504. <xsl:template match="sect1/info"></xsl:template>
  505. <xsl:template match="sect1/title"></xsl:template>
  506. <xsl:template match="sect1/titleabbrev"></xsl:template>
  507. <xsl:template match="sect1/subtitle"></xsl:template>
  508. <xsl:template match="sect2info"></xsl:template>
  509. <xsl:template match="sect2/info"></xsl:template>
  510. <xsl:template match="sect2/title"></xsl:template>
  511. <xsl:template match="sect2/titleabbrev"></xsl:template>
  512. <xsl:template match="sect2/subtitle"></xsl:template>
  513. <xsl:template match="sect3info"></xsl:template>
  514. <xsl:template match="sect3/info"></xsl:template>
  515. <xsl:template match="sect3/title"></xsl:template>
  516. <xsl:template match="sect3/titleabbrev"></xsl:template>
  517. <xsl:template match="sect3/subtitle"></xsl:template>
  518. <xsl:template match="sect4info"></xsl:template>
  519. <xsl:template match="sect4/info"></xsl:template>
  520. <xsl:template match="sect4/title"></xsl:template>
  521. <xsl:template match="sect4/titleabbrev"></xsl:template>
  522. <xsl:template match="sect4/subtitle"></xsl:template>
  523. <xsl:template match="sect5info"></xsl:template>
  524. <xsl:template match="sect5/info"></xsl:template>
  525. <xsl:template match="sect5/title"></xsl:template>
  526. <xsl:template match="sect5/titleabbrev"></xsl:template>
  527. <xsl:template match="sect5/subtitle"></xsl:template>
  528. <xsl:template match="simplesect/info"></xsl:template>
  529. <xsl:template match="simplesect/title"></xsl:template>
  530. <xsl:template match="simplesect/titleabbrev"></xsl:template>
  531. <xsl:template match="simplesect/subtitle"></xsl:template>
  532. <!-- ==================================================================== -->
  533. <xsl:template name="section.heading">
  534. <xsl:param name="level" select="1"/>
  535. <xsl:param name="marker" select="1"/>
  536. <xsl:param name="title"/>
  537. <xsl:param name="marker.title"/>
  538. <fo:block xsl:use-attribute-sets="section.title.properties">
  539. <xsl:if test="$marker != 0">
  540. <fo:marker marker-class-name="section.head.marker">
  541. <xsl:copy-of select="$marker.title"/>
  542. </fo:marker>
  543. </xsl:if>
  544. <xsl:choose>
  545. <xsl:when test="$level=1">
  546. <fo:block xsl:use-attribute-sets="section.title.level1.properties">
  547. <xsl:copy-of select="$title"/>
  548. </fo:block>
  549. </xsl:when>
  550. <xsl:when test="$level=2">
  551. <fo:block xsl:use-attribute-sets="section.title.level2.properties">
  552. <xsl:copy-of select="$title"/>
  553. </fo:block>
  554. </xsl:when>
  555. <xsl:when test="$level=3">
  556. <fo:block xsl:use-attribute-sets="section.title.level3.properties">
  557. <xsl:copy-of select="$title"/>
  558. </fo:block>
  559. </xsl:when>
  560. <xsl:when test="$level=4">
  561. <fo:block xsl:use-attribute-sets="section.title.level4.properties">
  562. <xsl:copy-of select="$title"/>
  563. </fo:block>
  564. </xsl:when>
  565. <xsl:when test="$level=5">
  566. <fo:block xsl:use-attribute-sets="section.title.level5.properties">
  567. <xsl:copy-of select="$title"/>
  568. </fo:block>
  569. </xsl:when>
  570. <xsl:otherwise>
  571. <fo:block xsl:use-attribute-sets="section.title.level6.properties">
  572. <xsl:copy-of select="$title"/>
  573. </fo:block>
  574. </xsl:otherwise>
  575. </xsl:choose>
  576. </fo:block>
  577. </xsl:template>
  578. <!-- ==================================================================== -->
  579. <xsl:template match="bridgehead">
  580. <xsl:variable name="container"
  581. select="(ancestor::appendix
  582. |ancestor::article
  583. |ancestor::bibliography
  584. |ancestor::chapter
  585. |ancestor::glossary
  586. |ancestor::glossdiv
  587. |ancestor::index
  588. |ancestor::partintro
  589. |ancestor::preface
  590. |ancestor::refsect1
  591. |ancestor::refsect2
  592. |ancestor::refsect3
  593. |ancestor::sect1
  594. |ancestor::sect2
  595. |ancestor::sect3
  596. |ancestor::sect4
  597. |ancestor::sect5
  598. |ancestor::section
  599. |ancestor::setindex
  600. |ancestor::simplesect)[last()]"/>
  601. <xsl:variable name="clevel">
  602. <xsl:choose>
  603. <xsl:when test="local-name($container) = 'appendix'
  604. or local-name($container) = 'chapter'
  605. or local-name($container) = 'article'
  606. or local-name($container) = 'bibliography'
  607. or local-name($container) = 'glossary'
  608. or local-name($container) = 'index'
  609. or local-name($container) = 'partintro'
  610. or local-name($container) = 'preface'
  611. or local-name($container) = 'setindex'">2</xsl:when>
  612. <xsl:when test="local-name($container) = 'glossdiv'">
  613. <xsl:value-of select="count(ancestor::glossdiv)+2"/>
  614. </xsl:when>
  615. <xsl:when test="local-name($container) = 'sect1'
  616. or local-name($container) = 'sect2'
  617. or local-name($container) = 'sect3'
  618. or local-name($container) = 'sect4'
  619. or local-name($container) = 'sect5'
  620. or local-name($container) = 'refsect1'
  621. or local-name($container) = 'refsect2'
  622. or local-name($container) = 'refsect3'
  623. or local-name($container) = 'section'
  624. or local-name($container) = 'simplesect'">
  625. <xsl:variable name="slevel">
  626. <xsl:call-template name="section.level">
  627. <xsl:with-param name="node" select="$container"/>
  628. </xsl:call-template>
  629. </xsl:variable>
  630. <xsl:value-of select="$slevel + 1"/>
  631. </xsl:when>
  632. <xsl:otherwise>2</xsl:otherwise>
  633. </xsl:choose>
  634. </xsl:variable>
  635. <xsl:variable name="level">
  636. <xsl:choose>
  637. <xsl:when test="@renderas = 'sect1'">1</xsl:when>
  638. <xsl:when test="@renderas = 'sect2'">2</xsl:when>
  639. <xsl:when test="@renderas = 'sect3'">3</xsl:when>
  640. <xsl:when test="@renderas = 'sect4'">4</xsl:when>
  641. <xsl:when test="@renderas = 'sect5'">5</xsl:when>
  642. <xsl:otherwise>
  643. <xsl:value-of select="$clevel"/>
  644. </xsl:otherwise>
  645. </xsl:choose>
  646. </xsl:variable>
  647. <xsl:variable name="marker">
  648. <xsl:choose>
  649. <xsl:when test="$level &lt;= $marker.section.level">1</xsl:when>
  650. <xsl:otherwise>0</xsl:otherwise>
  651. </xsl:choose>
  652. </xsl:variable>
  653. <xsl:variable name="marker.title">
  654. <xsl:apply-templates/>
  655. </xsl:variable>
  656. <xsl:variable name="id">
  657. <xsl:call-template name="object.id"/>
  658. </xsl:variable>
  659. <fo:block id="{$id}">
  660. <xsl:call-template name="section.heading">
  661. <xsl:with-param name="level" select="$level"/>
  662. <xsl:with-param name="title">
  663. <xsl:apply-templates/>
  664. </xsl:with-param>
  665. <xsl:with-param name="marker" select="$marker"/>
  666. <xsl:with-param name="marker.title" select="$marker.title"/>
  667. </xsl:call-template>
  668. </fo:block>
  669. </xsl:template>
  670. </xsl:stylesheet>