component.xsl 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  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: component.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 name="component.title">
  15. <xsl:param name="node" select="."/>
  16. <xsl:param name="pagewide" select="0"/>
  17. <xsl:variable name="id">
  18. <xsl:call-template name="object.id">
  19. <xsl:with-param name="object" select="$node"/>
  20. </xsl:call-template>
  21. </xsl:variable>
  22. <xsl:variable name="title">
  23. <xsl:apply-templates select="$node" mode="object.title.markup">
  24. <xsl:with-param name="allow-anchors" select="1"/>
  25. </xsl:apply-templates>
  26. </xsl:variable>
  27. <xsl:variable name="titleabbrev">
  28. <xsl:apply-templates select="$node" mode="titleabbrev.markup"/>
  29. </xsl:variable>
  30. <xsl:variable name="level">
  31. <xsl:choose>
  32. <xsl:when test="ancestor::section">
  33. <xsl:value-of select="count(ancestor::section)+1"/>
  34. </xsl:when>
  35. <xsl:when test="ancestor::sect5">6</xsl:when>
  36. <xsl:when test="ancestor::sect4">5</xsl:when>
  37. <xsl:when test="ancestor::sect3">4</xsl:when>
  38. <xsl:when test="ancestor::sect2">3</xsl:when>
  39. <xsl:when test="ancestor::sect1">2</xsl:when>
  40. <xsl:otherwise>1</xsl:otherwise>
  41. </xsl:choose>
  42. </xsl:variable>
  43. <fo:block xsl:use-attribute-sets="component.title.properties">
  44. <xsl:if test="$pagewide != 0">
  45. <!-- Doesn't work to use 'all' here since not a child of fo:flow -->
  46. <xsl:attribute name="span">inherit</xsl:attribute>
  47. </xsl:if>
  48. <xsl:attribute name="hyphenation-character">
  49. <xsl:call-template name="gentext">
  50. <xsl:with-param name="key" select="'hyphenation-character'"/>
  51. </xsl:call-template>
  52. </xsl:attribute>
  53. <xsl:attribute name="hyphenation-push-character-count">
  54. <xsl:call-template name="gentext">
  55. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  56. </xsl:call-template>
  57. </xsl:attribute>
  58. <xsl:attribute name="hyphenation-remain-character-count">
  59. <xsl:call-template name="gentext">
  60. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  61. </xsl:call-template>
  62. </xsl:attribute>
  63. <xsl:if test="$axf.extensions != 0">
  64. <xsl:attribute name="axf:outline-level">
  65. <xsl:value-of select="count($node/ancestor::*)"/>
  66. </xsl:attribute>
  67. <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
  68. <xsl:attribute name="axf:outline-title">
  69. <xsl:value-of select="normalize-space($title)"/>
  70. </xsl:attribute>
  71. </xsl:if>
  72. <!-- Let's handle the case where a component (bibliography, for example)
  73. occurs inside a section; will we need parameters for this?
  74. Danger Will Robinson: using section.title.level*.properties here
  75. runs the risk that someone will set something other than
  76. font-size there... -->
  77. <xsl:choose>
  78. <xsl:when test="$level=2">
  79. <fo:block xsl:use-attribute-sets="section.title.level2.properties">
  80. <xsl:copy-of select="$title"/>
  81. </fo:block>
  82. </xsl:when>
  83. <xsl:when test="$level=3">
  84. <fo:block xsl:use-attribute-sets="section.title.level3.properties">
  85. <xsl:copy-of select="$title"/>
  86. </fo:block>
  87. </xsl:when>
  88. <xsl:when test="$level=4">
  89. <fo:block xsl:use-attribute-sets="section.title.level4.properties">
  90. <xsl:copy-of select="$title"/>
  91. </fo:block>
  92. </xsl:when>
  93. <xsl:when test="$level=5">
  94. <fo:block xsl:use-attribute-sets="section.title.level5.properties">
  95. <xsl:copy-of select="$title"/>
  96. </fo:block>
  97. </xsl:when>
  98. <xsl:when test="$level=6">
  99. <fo:block xsl:use-attribute-sets="section.title.level6.properties">
  100. <xsl:copy-of select="$title"/>
  101. </fo:block>
  102. </xsl:when>
  103. <xsl:otherwise>
  104. <!-- not in a section: do nothing special -->
  105. <xsl:copy-of select="$title"/>
  106. </xsl:otherwise>
  107. </xsl:choose>
  108. </fo:block>
  109. </xsl:template>
  110. <!-- ==================================================================== -->
  111. <xsl:template match="dedication" mode="dedication">
  112. <xsl:variable name="id">
  113. <xsl:call-template name="object.id"/>
  114. </xsl:variable>
  115. <xsl:variable name="master-reference">
  116. <xsl:call-template name="select.pagemaster"/>
  117. </xsl:variable>
  118. <fo:page-sequence hyphenate="{$hyphenate}"
  119. master-reference="{$master-reference}">
  120. <xsl:attribute name="language">
  121. <xsl:call-template name="l10n.language"/>
  122. </xsl:attribute>
  123. <xsl:attribute name="format">
  124. <xsl:call-template name="page.number.format">
  125. <xsl:with-param name="master-reference" select="$master-reference"/>
  126. </xsl:call-template>
  127. </xsl:attribute>
  128. <xsl:attribute name="initial-page-number">
  129. <xsl:call-template name="initial.page.number">
  130. <xsl:with-param name="master-reference" select="$master-reference"/>
  131. </xsl:call-template>
  132. </xsl:attribute>
  133. <xsl:attribute name="force-page-count">
  134. <xsl:call-template name="force.page.count">
  135. <xsl:with-param name="master-reference" select="$master-reference"/>
  136. </xsl:call-template>
  137. </xsl:attribute>
  138. <xsl:attribute name="hyphenation-character">
  139. <xsl:call-template name="gentext">
  140. <xsl:with-param name="key" select="'hyphenation-character'"/>
  141. </xsl:call-template>
  142. </xsl:attribute>
  143. <xsl:attribute name="hyphenation-push-character-count">
  144. <xsl:call-template name="gentext">
  145. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  146. </xsl:call-template>
  147. </xsl:attribute>
  148. <xsl:attribute name="hyphenation-remain-character-count">
  149. <xsl:call-template name="gentext">
  150. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  151. </xsl:call-template>
  152. </xsl:attribute>
  153. <xsl:apply-templates select="." mode="running.head.mode">
  154. <xsl:with-param name="master-reference" select="$master-reference"/>
  155. </xsl:apply-templates>
  156. <xsl:apply-templates select="." mode="running.foot.mode">
  157. <xsl:with-param name="master-reference" select="$master-reference"/>
  158. </xsl:apply-templates>
  159. <fo:flow flow-name="xsl-region-body">
  160. <xsl:call-template name="set.flow.properties">
  161. <xsl:with-param name="element" select="local-name(.)"/>
  162. <xsl:with-param name="master-reference" select="$master-reference"/>
  163. </xsl:call-template>
  164. <fo:block id="{$id}"
  165. xsl:use-attribute-sets="component.titlepage.properties">
  166. <xsl:call-template name="dedication.titlepage"/>
  167. </fo:block>
  168. <xsl:apply-templates/>
  169. </fo:flow>
  170. </fo:page-sequence>
  171. </xsl:template>
  172. <xsl:template match="dedication"></xsl:template> <!-- see mode="dedication" -->
  173. <xsl:template match="dedication/docinfo"></xsl:template>
  174. <xsl:template match="dedication/title"></xsl:template>
  175. <xsl:template match="dedication/subtitle"></xsl:template>
  176. <xsl:template match="dedication/titleabbrev"></xsl:template>
  177. <!-- ==================================================================== -->
  178. <xsl:template match="acknowledgements" mode="acknowledgements">
  179. <xsl:variable name="id">
  180. <xsl:call-template name="object.id"/>
  181. </xsl:variable>
  182. <xsl:variable name="master-reference">
  183. <xsl:call-template name="select.pagemaster"/>
  184. </xsl:variable>
  185. <fo:page-sequence hyphenate="{$hyphenate}"
  186. master-reference="{$master-reference}">
  187. <xsl:attribute name="language">
  188. <xsl:call-template name="l10n.language"/>
  189. </xsl:attribute>
  190. <xsl:attribute name="format">
  191. <xsl:call-template name="page.number.format">
  192. <xsl:with-param name="master-reference" select="$master-reference"/>
  193. </xsl:call-template>
  194. </xsl:attribute>
  195. <xsl:attribute name="initial-page-number">
  196. <xsl:call-template name="initial.page.number">
  197. <xsl:with-param name="master-reference" select="$master-reference"/>
  198. </xsl:call-template>
  199. </xsl:attribute>
  200. <xsl:attribute name="force-page-count">
  201. <xsl:call-template name="force.page.count">
  202. <xsl:with-param name="master-reference" select="$master-reference"/>
  203. </xsl:call-template>
  204. </xsl:attribute>
  205. <xsl:attribute name="hyphenation-character">
  206. <xsl:call-template name="gentext">
  207. <xsl:with-param name="key" select="'hyphenation-character'"/>
  208. </xsl:call-template>
  209. </xsl:attribute>
  210. <xsl:attribute name="hyphenation-push-character-count">
  211. <xsl:call-template name="gentext">
  212. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  213. </xsl:call-template>
  214. </xsl:attribute>
  215. <xsl:attribute name="hyphenation-remain-character-count">
  216. <xsl:call-template name="gentext">
  217. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  218. </xsl:call-template>
  219. </xsl:attribute>
  220. <xsl:apply-templates select="." mode="running.head.mode">
  221. <xsl:with-param name="master-reference" select="$master-reference"/>
  222. </xsl:apply-templates>
  223. <xsl:apply-templates select="." mode="running.foot.mode">
  224. <xsl:with-param name="master-reference" select="$master-reference"/>
  225. </xsl:apply-templates>
  226. <fo:flow flow-name="xsl-region-body">
  227. <xsl:call-template name="set.flow.properties">
  228. <xsl:with-param name="element" select="local-name(.)"/>
  229. <xsl:with-param name="master-reference" select="$master-reference"/>
  230. </xsl:call-template>
  231. <fo:block id="{$id}"
  232. xsl:use-attribute-sets="component.titlepage.properties">
  233. <xsl:call-template name="acknowledgements.titlepage"/>
  234. </fo:block>
  235. <xsl:apply-templates/>
  236. </fo:flow>
  237. </fo:page-sequence>
  238. </xsl:template>
  239. <xsl:template match="acknowledgements"></xsl:template>
  240. <xsl:template match="acknowledgements/info"></xsl:template>
  241. <xsl:template match="acknowledgements/title"></xsl:template>
  242. <xsl:template match="acknowledgements/titleabbrev"></xsl:template>
  243. <xsl:template match="acknowledgements/subtitle"></xsl:template>
  244. <!-- ==================================================================== -->
  245. <xsl:template match="colophon">
  246. <xsl:variable name="id">
  247. <xsl:call-template name="object.id"/>
  248. </xsl:variable>
  249. <xsl:variable name="master-reference">
  250. <xsl:call-template name="select.pagemaster"/>
  251. </xsl:variable>
  252. <fo:page-sequence hyphenate="{$hyphenate}"
  253. master-reference="{$master-reference}">
  254. <xsl:attribute name="language">
  255. <xsl:call-template name="l10n.language"/>
  256. </xsl:attribute>
  257. <xsl:attribute name="format">
  258. <xsl:call-template name="page.number.format">
  259. <xsl:with-param name="master-reference" select="$master-reference"/>
  260. </xsl:call-template>
  261. </xsl:attribute>
  262. <xsl:attribute name="initial-page-number">
  263. <xsl:call-template name="initial.page.number">
  264. <xsl:with-param name="master-reference" select="$master-reference"/>
  265. </xsl:call-template>
  266. </xsl:attribute>
  267. <xsl:attribute name="force-page-count">
  268. <xsl:call-template name="force.page.count">
  269. <xsl:with-param name="master-reference" select="$master-reference"/>
  270. </xsl:call-template>
  271. </xsl:attribute>
  272. <xsl:attribute name="hyphenation-character">
  273. <xsl:call-template name="gentext">
  274. <xsl:with-param name="key" select="'hyphenation-character'"/>
  275. </xsl:call-template>
  276. </xsl:attribute>
  277. <xsl:attribute name="hyphenation-push-character-count">
  278. <xsl:call-template name="gentext">
  279. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  280. </xsl:call-template>
  281. </xsl:attribute>
  282. <xsl:attribute name="hyphenation-remain-character-count">
  283. <xsl:call-template name="gentext">
  284. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  285. </xsl:call-template>
  286. </xsl:attribute>
  287. <xsl:apply-templates select="." mode="running.head.mode">
  288. <xsl:with-param name="master-reference" select="$master-reference"/>
  289. </xsl:apply-templates>
  290. <xsl:apply-templates select="." mode="running.foot.mode">
  291. <xsl:with-param name="master-reference" select="$master-reference"/>
  292. </xsl:apply-templates>
  293. <fo:flow flow-name="xsl-region-body">
  294. <xsl:call-template name="set.flow.properties">
  295. <xsl:with-param name="element" select="local-name(.)"/>
  296. <xsl:with-param name="master-reference" select="$master-reference"/>
  297. </xsl:call-template>
  298. <fo:block id="{$id}"
  299. xsl:use-attribute-sets="component.titlepage.properties">
  300. <xsl:call-template name="colophon.titlepage"/>
  301. </fo:block>
  302. <xsl:apply-templates/>
  303. </fo:flow>
  304. </fo:page-sequence>
  305. </xsl:template>
  306. <xsl:template match="colophon/title"></xsl:template>
  307. <xsl:template match="colophon/subtitle"></xsl:template>
  308. <xsl:template match="colophon/titleabbrev"></xsl:template>
  309. <!-- article/colophon has no page sequence -->
  310. <xsl:template match="article/colophon">
  311. <xsl:variable name="id">
  312. <xsl:call-template name="object.id"/>
  313. </xsl:variable>
  314. <fo:block id="{$id}">
  315. <fo:block xsl:use-attribute-sets="component.titlepage.properties">
  316. <xsl:call-template name="colophon.titlepage"/>
  317. </fo:block>
  318. <xsl:apply-templates/>
  319. </fo:block>
  320. </xsl:template>
  321. <!-- ==================================================================== -->
  322. <xsl:template match="preface">
  323. <xsl:variable name="id">
  324. <xsl:call-template name="object.id"/>
  325. </xsl:variable>
  326. <xsl:variable name="master-reference">
  327. <xsl:call-template name="select.pagemaster"/>
  328. </xsl:variable>
  329. <fo:page-sequence hyphenate="{$hyphenate}"
  330. master-reference="{$master-reference}">
  331. <xsl:attribute name="language">
  332. <xsl:call-template name="l10n.language"/>
  333. </xsl:attribute>
  334. <xsl:attribute name="format">
  335. <xsl:call-template name="page.number.format">
  336. <xsl:with-param name="master-reference" select="$master-reference"/>
  337. </xsl:call-template>
  338. </xsl:attribute>
  339. <xsl:attribute name="initial-page-number">
  340. <xsl:call-template name="initial.page.number">
  341. <xsl:with-param name="master-reference" select="$master-reference"/>
  342. </xsl:call-template>
  343. </xsl:attribute>
  344. <xsl:attribute name="force-page-count">
  345. <xsl:call-template name="force.page.count">
  346. <xsl:with-param name="master-reference" select="$master-reference"/>
  347. </xsl:call-template>
  348. </xsl:attribute>
  349. <xsl:attribute name="hyphenation-character">
  350. <xsl:call-template name="gentext">
  351. <xsl:with-param name="key" select="'hyphenation-character'"/>
  352. </xsl:call-template>
  353. </xsl:attribute>
  354. <xsl:attribute name="hyphenation-push-character-count">
  355. <xsl:call-template name="gentext">
  356. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  357. </xsl:call-template>
  358. </xsl:attribute>
  359. <xsl:attribute name="hyphenation-remain-character-count">
  360. <xsl:call-template name="gentext">
  361. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  362. </xsl:call-template>
  363. </xsl:attribute>
  364. <xsl:apply-templates select="." mode="running.head.mode">
  365. <xsl:with-param name="master-reference" select="$master-reference"/>
  366. </xsl:apply-templates>
  367. <xsl:apply-templates select="." mode="running.foot.mode">
  368. <xsl:with-param name="master-reference" select="$master-reference"/>
  369. </xsl:apply-templates>
  370. <fo:flow flow-name="xsl-region-body">
  371. <xsl:call-template name="set.flow.properties">
  372. <xsl:with-param name="element" select="local-name(.)"/>
  373. <xsl:with-param name="master-reference" select="$master-reference"/>
  374. </xsl:call-template>
  375. <fo:block id="{$id}"
  376. xsl:use-attribute-sets="component.titlepage.properties">
  377. <xsl:call-template name="preface.titlepage"/>
  378. </fo:block>
  379. <xsl:call-template name="make.component.tocs"/>
  380. <xsl:apply-templates/>
  381. </fo:flow>
  382. </fo:page-sequence>
  383. </xsl:template>
  384. <xsl:template match="preface/docinfo|prefaceinfo"></xsl:template>
  385. <xsl:template match="preface/info"></xsl:template>
  386. <xsl:template match="preface/title"></xsl:template>
  387. <xsl:template match="preface/titleabbrev"></xsl:template>
  388. <xsl:template match="preface/subtitle"></xsl:template>
  389. <!-- ==================================================================== -->
  390. <xsl:template match="chapter">
  391. <xsl:variable name="id">
  392. <xsl:call-template name="object.id"/>
  393. </xsl:variable>
  394. <xsl:variable name="master-reference">
  395. <xsl:call-template name="select.pagemaster"/>
  396. </xsl:variable>
  397. <fo:page-sequence hyphenate="{$hyphenate}"
  398. master-reference="{$master-reference}">
  399. <xsl:attribute name="language">
  400. <xsl:call-template name="l10n.language"/>
  401. </xsl:attribute>
  402. <xsl:attribute name="format">
  403. <xsl:call-template name="page.number.format">
  404. <xsl:with-param name="master-reference" select="$master-reference"/>
  405. </xsl:call-template>
  406. </xsl:attribute>
  407. <xsl:attribute name="initial-page-number">
  408. <xsl:call-template name="initial.page.number">
  409. <xsl:with-param name="master-reference" select="$master-reference"/>
  410. </xsl:call-template>
  411. </xsl:attribute>
  412. <xsl:attribute name="force-page-count">
  413. <xsl:call-template name="force.page.count">
  414. <xsl:with-param name="master-reference" select="$master-reference"/>
  415. </xsl:call-template>
  416. </xsl:attribute>
  417. <xsl:attribute name="hyphenation-character">
  418. <xsl:call-template name="gentext">
  419. <xsl:with-param name="key" select="'hyphenation-character'"/>
  420. </xsl:call-template>
  421. </xsl:attribute>
  422. <xsl:attribute name="hyphenation-push-character-count">
  423. <xsl:call-template name="gentext">
  424. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  425. </xsl:call-template>
  426. </xsl:attribute>
  427. <xsl:attribute name="hyphenation-remain-character-count">
  428. <xsl:call-template name="gentext">
  429. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  430. </xsl:call-template>
  431. </xsl:attribute>
  432. <xsl:apply-templates select="." mode="running.head.mode">
  433. <xsl:with-param name="master-reference" select="$master-reference"/>
  434. </xsl:apply-templates>
  435. <xsl:apply-templates select="." mode="running.foot.mode">
  436. <xsl:with-param name="master-reference" select="$master-reference"/>
  437. </xsl:apply-templates>
  438. <fo:flow flow-name="xsl-region-body">
  439. <xsl:call-template name="set.flow.properties">
  440. <xsl:with-param name="element" select="local-name(.)"/>
  441. <xsl:with-param name="master-reference" select="$master-reference"/>
  442. </xsl:call-template>
  443. <fo:block id="{$id}"
  444. xsl:use-attribute-sets="component.titlepage.properties">
  445. <xsl:call-template name="chapter.titlepage"/>
  446. </fo:block>
  447. <xsl:call-template name="make.component.tocs"/>
  448. <xsl:apply-templates/>
  449. </fo:flow>
  450. </fo:page-sequence>
  451. </xsl:template>
  452. <xsl:template match="chapter/docinfo|chapterinfo"></xsl:template>
  453. <xsl:template match="chapter/info"></xsl:template>
  454. <xsl:template match="chapter/title"></xsl:template>
  455. <xsl:template match="chapter/titleabbrev"></xsl:template>
  456. <xsl:template match="chapter/subtitle"></xsl:template>
  457. <!-- ==================================================================== -->
  458. <xsl:template match="appendix">
  459. <xsl:variable name="id">
  460. <xsl:call-template name="object.id"/>
  461. </xsl:variable>
  462. <xsl:variable name="master-reference">
  463. <xsl:call-template name="select.pagemaster"/>
  464. </xsl:variable>
  465. <fo:page-sequence hyphenate="{$hyphenate}"
  466. master-reference="{$master-reference}">
  467. <xsl:attribute name="language">
  468. <xsl:call-template name="l10n.language"/>
  469. </xsl:attribute>
  470. <xsl:attribute name="format">
  471. <xsl:call-template name="page.number.format">
  472. <xsl:with-param name="master-reference" select="$master-reference"/>
  473. </xsl:call-template>
  474. </xsl:attribute>
  475. <xsl:attribute name="initial-page-number">
  476. <xsl:call-template name="initial.page.number">
  477. <xsl:with-param name="master-reference" select="$master-reference"/>
  478. </xsl:call-template>
  479. </xsl:attribute>
  480. <xsl:attribute name="force-page-count">
  481. <xsl:call-template name="force.page.count">
  482. <xsl:with-param name="master-reference" select="$master-reference"/>
  483. </xsl:call-template>
  484. </xsl:attribute>
  485. <xsl:attribute name="hyphenation-character">
  486. <xsl:call-template name="gentext">
  487. <xsl:with-param name="key" select="'hyphenation-character'"/>
  488. </xsl:call-template>
  489. </xsl:attribute>
  490. <xsl:attribute name="hyphenation-push-character-count">
  491. <xsl:call-template name="gentext">
  492. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  493. </xsl:call-template>
  494. </xsl:attribute>
  495. <xsl:attribute name="hyphenation-remain-character-count">
  496. <xsl:call-template name="gentext">
  497. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  498. </xsl:call-template>
  499. </xsl:attribute>
  500. <xsl:apply-templates select="." mode="running.head.mode">
  501. <xsl:with-param name="master-reference" select="$master-reference"/>
  502. </xsl:apply-templates>
  503. <xsl:apply-templates select="." mode="running.foot.mode">
  504. <xsl:with-param name="master-reference" select="$master-reference"/>
  505. </xsl:apply-templates>
  506. <fo:flow flow-name="xsl-region-body">
  507. <xsl:call-template name="set.flow.properties">
  508. <xsl:with-param name="element" select="local-name(.)"/>
  509. <xsl:with-param name="master-reference" select="$master-reference"/>
  510. </xsl:call-template>
  511. <fo:block id="{$id}"
  512. xsl:use-attribute-sets="component.titlepage.properties">
  513. <xsl:call-template name="appendix.titlepage"/>
  514. </fo:block>
  515. <xsl:call-template name="make.component.tocs"/>
  516. <xsl:apply-templates/>
  517. </fo:flow>
  518. </fo:page-sequence>
  519. </xsl:template>
  520. <xsl:template match="appendix/docinfo|appendixinfo"></xsl:template>
  521. <xsl:template match="appendix/info"></xsl:template>
  522. <xsl:template match="appendix/title"></xsl:template>
  523. <xsl:template match="appendix/titleabbrev"></xsl:template>
  524. <xsl:template match="appendix/subtitle"></xsl:template>
  525. <!-- ==================================================================== -->
  526. <xsl:template match="article">
  527. <xsl:variable name="id">
  528. <xsl:call-template name="object.id"/>
  529. </xsl:variable>
  530. <xsl:variable name="master-reference">
  531. <xsl:call-template name="select.pagemaster"/>
  532. </xsl:variable>
  533. <fo:page-sequence hyphenate="{$hyphenate}"
  534. master-reference="{$master-reference}">
  535. <xsl:attribute name="language">
  536. <xsl:call-template name="l10n.language"/>
  537. </xsl:attribute>
  538. <xsl:attribute name="format">
  539. <xsl:call-template name="page.number.format">
  540. <xsl:with-param name="master-reference" select="$master-reference"/>
  541. </xsl:call-template>
  542. </xsl:attribute>
  543. <xsl:attribute name="initial-page-number">
  544. <xsl:call-template name="initial.page.number">
  545. <xsl:with-param name="master-reference" select="$master-reference"/>
  546. </xsl:call-template>
  547. </xsl:attribute>
  548. <xsl:attribute name="force-page-count">
  549. <xsl:call-template name="force.page.count">
  550. <xsl:with-param name="master-reference" select="$master-reference"/>
  551. </xsl:call-template>
  552. </xsl:attribute>
  553. <xsl:attribute name="hyphenation-character">
  554. <xsl:call-template name="gentext">
  555. <xsl:with-param name="key" select="'hyphenation-character'"/>
  556. </xsl:call-template>
  557. </xsl:attribute>
  558. <xsl:attribute name="hyphenation-push-character-count">
  559. <xsl:call-template name="gentext">
  560. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  561. </xsl:call-template>
  562. </xsl:attribute>
  563. <xsl:attribute name="hyphenation-remain-character-count">
  564. <xsl:call-template name="gentext">
  565. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  566. </xsl:call-template>
  567. </xsl:attribute>
  568. <xsl:apply-templates select="." mode="running.head.mode">
  569. <xsl:with-param name="master-reference" select="$master-reference"/>
  570. </xsl:apply-templates>
  571. <xsl:apply-templates select="." mode="running.foot.mode">
  572. <xsl:with-param name="master-reference" select="$master-reference"/>
  573. </xsl:apply-templates>
  574. <fo:flow flow-name="xsl-region-body">
  575. <xsl:call-template name="set.flow.properties">
  576. <xsl:with-param name="element" select="local-name(.)"/>
  577. <xsl:with-param name="master-reference" select="$master-reference"/>
  578. </xsl:call-template>
  579. <fo:block id="{$id}"
  580. xsl:use-attribute-sets="component.titlepage.properties">
  581. <xsl:call-template name="article.titlepage"/>
  582. </fo:block>
  583. <xsl:call-template name="make.component.tocs"/>
  584. <xsl:apply-templates/>
  585. </fo:flow>
  586. </fo:page-sequence>
  587. </xsl:template>
  588. <xsl:template match="article/artheader"></xsl:template>
  589. <xsl:template match="article/articleinfo"></xsl:template>
  590. <xsl:template match="article/info"></xsl:template>
  591. <xsl:template match="article/title"></xsl:template>
  592. <xsl:template match="article/subtitle"></xsl:template>
  593. <xsl:template match="article/titleabbrev"></xsl:template>
  594. <xsl:template match="article/appendix">
  595. <xsl:variable name="id">
  596. <xsl:call-template name="object.id"/>
  597. </xsl:variable>
  598. <xsl:variable name="title">
  599. <xsl:apply-templates select="." mode="object.title.markup"/>
  600. </xsl:variable>
  601. <xsl:variable name="titleabbrev">
  602. <xsl:apply-templates select="." mode="titleabbrev.markup"/>
  603. </xsl:variable>
  604. <fo:block id='{$id}'>
  605. <xsl:if test="$axf.extensions != 0">
  606. <xsl:attribute name="axf:outline-level">
  607. <xsl:value-of select="count(ancestor::*)+2"/>
  608. </xsl:attribute>
  609. <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
  610. <xsl:attribute name="axf:outline-title">
  611. <xsl:value-of select="normalize-space($titleabbrev)"/>
  612. </xsl:attribute>
  613. </xsl:if>
  614. <fo:block xsl:use-attribute-sets="article.appendix.title.properties">
  615. <fo:marker marker-class-name="section.head.marker">
  616. <xsl:choose>
  617. <xsl:when test="$titleabbrev = ''">
  618. <xsl:value-of select="$title"/>
  619. </xsl:when>
  620. <xsl:otherwise>
  621. <xsl:value-of select="$titleabbrev"/>
  622. </xsl:otherwise>
  623. </xsl:choose>
  624. </fo:marker>
  625. <xsl:copy-of select="$title"/>
  626. </fo:block>
  627. <xsl:call-template name="make.component.tocs"/>
  628. <xsl:apply-templates/>
  629. </fo:block>
  630. </xsl:template>
  631. <!-- ==================================================================== -->
  632. <!-- Utility template to create a page sequence for an element -->
  633. <xsl:template match="*" mode="page.sequence" name="page.sequence">
  634. <xsl:param name="content">
  635. <xsl:apply-templates/>
  636. </xsl:param>
  637. <xsl:param name="master-reference">
  638. <xsl:call-template name="select.pagemaster"/>
  639. </xsl:param>
  640. <xsl:param name="element" select="local-name(.)"/>
  641. <xsl:param name="gentext-key" select="local-name(.)"/>
  642. <xsl:param name="language">
  643. <xsl:call-template name="l10n.language"/>
  644. </xsl:param>
  645. <xsl:param name="format">
  646. <xsl:call-template name="page.number.format">
  647. <xsl:with-param name="master-reference" select="$master-reference"/>
  648. <xsl:with-param name="element" select="$element"/>
  649. </xsl:call-template>
  650. </xsl:param>
  651. <xsl:param name="initial-page-number">
  652. <xsl:call-template name="initial.page.number">
  653. <xsl:with-param name="master-reference" select="$master-reference"/>
  654. <xsl:with-param name="element" select="$element"/>
  655. </xsl:call-template>
  656. </xsl:param>
  657. <xsl:param name="force-page-count">
  658. <xsl:call-template name="force.page.count">
  659. <xsl:with-param name="master-reference" select="$master-reference"/>
  660. <xsl:with-param name="element" select="$element"/>
  661. </xsl:call-template>
  662. </xsl:param>
  663. <fo:page-sequence hyphenate="{$hyphenate}"
  664. master-reference="{$master-reference}">
  665. <xsl:attribute name="language">
  666. <xsl:value-of select="$language"/>
  667. </xsl:attribute>
  668. <xsl:attribute name="format">
  669. <xsl:value-of select="$format"/>
  670. </xsl:attribute>
  671. <xsl:attribute name="initial-page-number">
  672. <xsl:value-of select="$initial-page-number"/>
  673. </xsl:attribute>
  674. <xsl:attribute name="force-page-count">
  675. <xsl:value-of select="$force-page-count"/>
  676. </xsl:attribute>
  677. <xsl:attribute name="hyphenation-character">
  678. <xsl:call-template name="gentext">
  679. <xsl:with-param name="key" select="'hyphenation-character'"/>
  680. </xsl:call-template>
  681. </xsl:attribute>
  682. <xsl:attribute name="hyphenation-push-character-count">
  683. <xsl:call-template name="gentext">
  684. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  685. </xsl:call-template>
  686. </xsl:attribute>
  687. <xsl:attribute name="hyphenation-remain-character-count">
  688. <xsl:call-template name="gentext">
  689. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  690. </xsl:call-template>
  691. </xsl:attribute>
  692. <xsl:apply-templates select="." mode="running.head.mode">
  693. <xsl:with-param name="master-reference" select="$master-reference"/>
  694. <xsl:with-param name="gentext-key" select="$gentext-key"/>
  695. </xsl:apply-templates>
  696. <xsl:apply-templates select="." mode="running.foot.mode">
  697. <xsl:with-param name="master-reference" select="$master-reference"/>
  698. <xsl:with-param name="gentext-key" select="$gentext-key"/>
  699. </xsl:apply-templates>
  700. <fo:flow flow-name="xsl-region-body">
  701. <xsl:call-template name="set.flow.properties">
  702. <xsl:with-param name="element" select="local-name(.)"/>
  703. <xsl:with-param name="master-reference" select="$master-reference"/>
  704. </xsl:call-template>
  705. <xsl:copy-of select="$content"/>
  706. </fo:flow>
  707. </fo:page-sequence>
  708. </xsl:template>
  709. <xsl:template name="make.component.tocs">
  710. <xsl:variable name="toc.params">
  711. <xsl:call-template name="find.path.params">
  712. <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  713. </xsl:call-template>
  714. </xsl:variable>
  715. <xsl:if test="contains($toc.params, 'toc')">
  716. <xsl:call-template name="component.toc">
  717. <xsl:with-param name="toc.title.p"
  718. select="contains($toc.params, 'title')"/>
  719. </xsl:call-template>
  720. </xsl:if>
  721. <xsl:if test="contains($toc.params,'figure') and .//figure">
  722. <xsl:call-template name="component.list.of.titles">
  723. <xsl:with-param name="titles" select="'figure'"/>
  724. <xsl:with-param name="nodes" select=".//figure"/>
  725. </xsl:call-template>
  726. </xsl:if>
  727. <xsl:if test="contains($toc.params,'table') and .//table">
  728. <xsl:call-template name="component.list.of.titles">
  729. <xsl:with-param name="titles" select="'table'"/>
  730. <xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
  731. </xsl:call-template>
  732. </xsl:if>
  733. <xsl:if test="contains($toc.params,'example') and .//example">
  734. <xsl:call-template name="component.list.of.titles">
  735. <xsl:with-param name="titles" select="'example'"/>
  736. <xsl:with-param name="nodes" select=".//example"/>
  737. </xsl:call-template>
  738. </xsl:if>
  739. <xsl:if test="contains($toc.params,'equation') and
  740. .//equation[title or info/title]">
  741. <xsl:call-template name="component.list.of.titles">
  742. <xsl:with-param name="titles" select="'equation'"/>
  743. <xsl:with-param name="nodes"
  744. select=".//equation[title or info/title]"/>
  745. </xsl:call-template>
  746. </xsl:if>
  747. <xsl:if test="contains($toc.params,'procedure') and
  748. .//procedure[title or info/title]">
  749. <xsl:call-template name="component.list.of.titles">
  750. <xsl:with-param name="titles" select="'procedure'"/>
  751. <xsl:with-param name="nodes"
  752. select=".//procedure[title or info/title]"/>
  753. </xsl:call-template>
  754. </xsl:if>
  755. <xsl:choose>
  756. <xsl:when test="$toc.params = ''">
  757. </xsl:when>
  758. <xsl:when test="$toc.params = 'nop'">
  759. </xsl:when>
  760. <xsl:otherwise>
  761. <xsl:call-template name="component.toc.separator"/>
  762. </xsl:otherwise>
  763. </xsl:choose>
  764. </xsl:template>
  765. <xsl:template match="topic">
  766. <xsl:variable name="id">
  767. <xsl:call-template name="object.id"/>
  768. </xsl:variable>
  769. <xsl:element name="fo:{$section.container.element}">
  770. <xsl:attribute name="id"><xsl:value-of
  771. select="$id"/></xsl:attribute>
  772. <xsl:call-template name="topic.titlepage"/>
  773. <xsl:apply-templates/>
  774. </xsl:element>
  775. </xsl:template>
  776. <xsl:template match="/topic | book/topic" name="topic.page.sequence">
  777. <xsl:variable name="master-reference">
  778. <xsl:call-template name="select.pagemaster"/>
  779. </xsl:variable>
  780. <xsl:variable name="id">
  781. <xsl:call-template name="object.id"/>
  782. </xsl:variable>
  783. <xsl:apply-templates select="." mode="page.sequence">
  784. <xsl:with-param name="master-reference" select="$master-reference"/>
  785. <xsl:with-param name="content">
  786. <xsl:element name="fo:{$section.container.element}">
  787. <xsl:attribute name="id"><xsl:value-of
  788. select="$id"/></xsl:attribute>
  789. <xsl:call-template name="topic.titlepage"/>
  790. <xsl:apply-templates/>
  791. </xsl:element>
  792. </xsl:with-param>
  793. </xsl:apply-templates>
  794. </xsl:template>
  795. <xsl:template match="topic/info"></xsl:template>
  796. <xsl:template match="topic/title"></xsl:template>
  797. <xsl:template match="topic/subtitle"></xsl:template>
  798. <xsl:template match="topic/titleabbrev"></xsl:template>
  799. </xsl:stylesheet>