refentry.xsl 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  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: refentry.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="reference">
  15. <!-- If there is a partintro, it triggers the page sequence -->
  16. <xsl:if test="not(partintro)">
  17. <xsl:variable name="id">
  18. <xsl:call-template name="object.id"/>
  19. </xsl:variable>
  20. <xsl:variable name="master-reference">
  21. <xsl:call-template name="select.pagemaster"/>
  22. </xsl:variable>
  23. <fo:page-sequence hyphenate="{$hyphenate}"
  24. master-reference="{$master-reference}">
  25. <xsl:attribute name="language">
  26. <xsl:call-template name="l10n.language"/>
  27. </xsl:attribute>
  28. <xsl:attribute name="format">
  29. <xsl:call-template name="page.number.format">
  30. <xsl:with-param name="master-reference" select="$master-reference"/>
  31. </xsl:call-template>
  32. </xsl:attribute>
  33. <xsl:attribute name="initial-page-number">
  34. <xsl:call-template name="initial.page.number">
  35. <xsl:with-param name="master-reference" select="$master-reference"/>
  36. </xsl:call-template>
  37. </xsl:attribute>
  38. <xsl:attribute name="force-page-count">
  39. <xsl:call-template name="force.page.count">
  40. <xsl:with-param name="master-reference" select="$master-reference"/>
  41. </xsl:call-template>
  42. </xsl:attribute>
  43. <xsl:attribute name="hyphenation-character">
  44. <xsl:call-template name="gentext">
  45. <xsl:with-param name="key" select="'hyphenation-character'"/>
  46. </xsl:call-template>
  47. </xsl:attribute>
  48. <xsl:attribute name="hyphenation-push-character-count">
  49. <xsl:call-template name="gentext">
  50. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  51. </xsl:call-template>
  52. </xsl:attribute>
  53. <xsl:attribute name="hyphenation-remain-character-count">
  54. <xsl:call-template name="gentext">
  55. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  56. </xsl:call-template>
  57. </xsl:attribute>
  58. <xsl:apply-templates select="." mode="running.head.mode">
  59. <xsl:with-param name="master-reference" select="$master-reference"/>
  60. </xsl:apply-templates>
  61. <xsl:apply-templates select="." mode="running.foot.mode">
  62. <xsl:with-param name="master-reference" select="$master-reference"/>
  63. </xsl:apply-templates>
  64. <fo:flow flow-name="xsl-region-body">
  65. <xsl:call-template name="set.flow.properties">
  66. <xsl:with-param name="element" select="local-name(.)"/>
  67. <xsl:with-param name="master-reference" select="$master-reference"/>
  68. </xsl:call-template>
  69. <fo:block id="{$id}">
  70. <xsl:call-template name="reference.titlepage"/>
  71. </fo:block>
  72. <xsl:variable name="toc.params">
  73. <xsl:call-template name="find.path.params">
  74. <xsl:with-param name="table"
  75. select="normalize-space($generate.toc)"/>
  76. </xsl:call-template>
  77. </xsl:variable>
  78. <xsl:if test="contains($toc.params, 'toc')">
  79. <xsl:call-template name="component.toc">
  80. <xsl:with-param name="toc.title.p"
  81. select="contains($toc.params, 'title')"/>
  82. </xsl:call-template>
  83. <xsl:call-template name="component.toc.separator"/>
  84. </xsl:if>
  85. <!-- Create one page sequence if no pagebreaks needed -->
  86. <xsl:if test="$refentry.pagebreak = 0">
  87. <xsl:apply-templates select="refentry"/>
  88. </xsl:if>
  89. </fo:flow>
  90. </fo:page-sequence>
  91. </xsl:if>
  92. <xsl:apply-templates select="partintro"/>
  93. <xsl:if test="$refentry.pagebreak != 0">
  94. <xsl:apply-templates select="refentry"/>
  95. </xsl:if>
  96. </xsl:template>
  97. <xsl:template match="reference" mode="reference.titlepage.mode">
  98. <xsl:call-template name="reference.titlepage"/>
  99. </xsl:template>
  100. <xsl:template match="reference/partintro">
  101. <xsl:variable name="id">
  102. <xsl:call-template name="object.id">
  103. <xsl:with-param name="object" select="ancestor::reference"/>
  104. </xsl:call-template>
  105. </xsl:variable>
  106. <xsl:variable name="master-reference">
  107. <xsl:call-template name="select.pagemaster"/>
  108. </xsl:variable>
  109. <fo:page-sequence hyphenate="{$hyphenate}"
  110. master-reference="{$master-reference}">
  111. <xsl:attribute name="language">
  112. <xsl:call-template name="l10n.language"/>
  113. </xsl:attribute>
  114. <xsl:attribute name="format">
  115. <xsl:call-template name="page.number.format">
  116. <xsl:with-param name="master-reference" select="$master-reference"/>
  117. </xsl:call-template>
  118. </xsl:attribute>
  119. <xsl:attribute name="initial-page-number">
  120. <xsl:call-template name="initial.page.number">
  121. <xsl:with-param name="master-reference" select="$master-reference"/>
  122. </xsl:call-template>
  123. </xsl:attribute>
  124. <xsl:attribute name="force-page-count">
  125. <xsl:call-template name="force.page.count">
  126. <xsl:with-param name="master-reference" select="$master-reference"/>
  127. </xsl:call-template>
  128. </xsl:attribute>
  129. <xsl:attribute name="hyphenation-character">
  130. <xsl:call-template name="gentext">
  131. <xsl:with-param name="key" select="'hyphenation-character'"/>
  132. </xsl:call-template>
  133. </xsl:attribute>
  134. <xsl:attribute name="hyphenation-push-character-count">
  135. <xsl:call-template name="gentext">
  136. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  137. </xsl:call-template>
  138. </xsl:attribute>
  139. <xsl:attribute name="hyphenation-remain-character-count">
  140. <xsl:call-template name="gentext">
  141. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  142. </xsl:call-template>
  143. </xsl:attribute>
  144. <xsl:apply-templates select="." mode="running.head.mode">
  145. <xsl:with-param name="master-reference" select="$master-reference"/>
  146. </xsl:apply-templates>
  147. <xsl:apply-templates select="." mode="running.foot.mode">
  148. <xsl:with-param name="master-reference" select="$master-reference"/>
  149. </xsl:apply-templates>
  150. <fo:flow flow-name="xsl-region-body">
  151. <xsl:call-template name="set.flow.properties">
  152. <xsl:with-param name="element" select="local-name(.)"/>
  153. <xsl:with-param name="master-reference" select="$master-reference"/>
  154. </xsl:call-template>
  155. <fo:block id="{$id}">
  156. <xsl:apply-templates select=".." mode="reference.titlepage.mode"/>
  157. </fo:block>
  158. <xsl:if test="title">
  159. <xsl:call-template name="partintro.titlepage"/>
  160. </xsl:if>
  161. <xsl:apply-templates/>
  162. <!-- switch contexts to generate any toc -->
  163. <xsl:for-each select="..">
  164. <xsl:variable name="toc.params">
  165. <xsl:call-template name="find.path.params">
  166. <xsl:with-param name="table"
  167. select="normalize-space($generate.toc)"/>
  168. </xsl:call-template>
  169. </xsl:variable>
  170. <xsl:if test="contains($toc.params, 'toc')">
  171. <xsl:call-template name="component.toc">
  172. <xsl:with-param name="toc.title.p"
  173. select="contains($toc.params, 'title')"/>
  174. </xsl:call-template>
  175. <xsl:call-template name="component.toc.separator"/>
  176. </xsl:if>
  177. </xsl:for-each>
  178. <!-- Create one page sequence if no pagebreaks needed -->
  179. <xsl:if test="$refentry.pagebreak = 0">
  180. <xsl:apply-templates select="../refentry"/>
  181. </xsl:if>
  182. </fo:flow>
  183. </fo:page-sequence>
  184. </xsl:template>
  185. <xsl:template match="reference/docinfo|refentry/refentryinfo"></xsl:template>
  186. <xsl:template match="reference/info"></xsl:template>
  187. <xsl:template match="reference/title"></xsl:template>
  188. <xsl:template match="reference/subtitle"></xsl:template>
  189. <!-- ==================================================================== -->
  190. <xsl:template match="refentry">
  191. <xsl:variable name="id">
  192. <xsl:call-template name="object.id"/>
  193. </xsl:variable>
  194. <xsl:variable name="master-reference">
  195. <xsl:call-template name="select.pagemaster"/>
  196. </xsl:variable>
  197. <xsl:variable name="refentry.content">
  198. <fo:block id="{$id}">
  199. <xsl:apply-templates/>
  200. </fo:block>
  201. </xsl:variable>
  202. <xsl:choose>
  203. <xsl:when test="not(parent::*) or
  204. (parent::reference and $refentry.pagebreak != 0) or
  205. parent::part">
  206. <!-- make a page sequence -->
  207. <fo:page-sequence hyphenate="{$hyphenate}"
  208. master-reference="{$master-reference}">
  209. <xsl:attribute name="language">
  210. <xsl:call-template name="l10n.language"/>
  211. </xsl:attribute>
  212. <xsl:attribute name="format">
  213. <xsl:call-template name="page.number.format">
  214. <xsl:with-param name="master-reference" select="$master-reference"/>
  215. </xsl:call-template>
  216. </xsl:attribute>
  217. <xsl:attribute name="initial-page-number">
  218. <xsl:call-template name="initial.page.number">
  219. <xsl:with-param name="master-reference" select="$master-reference"/>
  220. </xsl:call-template>
  221. </xsl:attribute>
  222. <xsl:attribute name="force-page-count">
  223. <xsl:call-template name="force.page.count">
  224. <xsl:with-param name="master-reference" select="$master-reference"/>
  225. </xsl:call-template>
  226. </xsl:attribute>
  227. <xsl:attribute name="hyphenation-character">
  228. <xsl:call-template name="gentext">
  229. <xsl:with-param name="key" select="'hyphenation-character'"/>
  230. </xsl:call-template>
  231. </xsl:attribute>
  232. <xsl:attribute name="hyphenation-push-character-count">
  233. <xsl:call-template name="gentext">
  234. <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
  235. </xsl:call-template>
  236. </xsl:attribute>
  237. <xsl:attribute name="hyphenation-remain-character-count">
  238. <xsl:call-template name="gentext">
  239. <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
  240. </xsl:call-template>
  241. </xsl:attribute>
  242. <xsl:apply-templates select="." mode="running.head.mode">
  243. <xsl:with-param name="master-reference" select="$master-reference"/>
  244. </xsl:apply-templates>
  245. <xsl:apply-templates select="." mode="running.foot.mode">
  246. <xsl:with-param name="master-reference" select="$master-reference"/>
  247. </xsl:apply-templates>
  248. <fo:flow flow-name="xsl-region-body">
  249. <xsl:call-template name="set.flow.properties">
  250. <xsl:with-param name="element" select="local-name(.)"/>
  251. <xsl:with-param name="master-reference" select="$master-reference"/>
  252. </xsl:call-template>
  253. <xsl:copy-of select="$refentry.content"/>
  254. </fo:flow>
  255. </fo:page-sequence>
  256. </xsl:when>
  257. <xsl:otherwise>
  258. <fo:block>
  259. <xsl:if test="$refentry.pagebreak != 0">
  260. <xsl:attribute name="break-before">page</xsl:attribute>
  261. </xsl:if>
  262. <xsl:copy-of select="$refentry.content"/>
  263. </fo:block>
  264. </xsl:otherwise>
  265. </xsl:choose>
  266. </xsl:template>
  267. <xsl:template match="refmeta">
  268. <xsl:apply-templates select=".//indexterm"/>
  269. </xsl:template>
  270. <xsl:template match="manvolnum">
  271. <xsl:if test="$refentry.xref.manvolnum != 0">
  272. <xsl:text>(</xsl:text>
  273. <xsl:apply-templates/>
  274. <xsl:text>)</xsl:text>
  275. </xsl:if>
  276. </xsl:template>
  277. <xsl:template match="refmiscinfo">
  278. </xsl:template>
  279. <xsl:template match="refentrytitle">
  280. <xsl:call-template name="inline.charseq"/>
  281. </xsl:template>
  282. <xsl:template match="refnamediv">
  283. <xsl:variable name="id">
  284. <xsl:call-template name="object.id"/>
  285. </xsl:variable>
  286. <fo:block id="{$id}">
  287. <!-- if refentry.generate.name is non-zero, then we need to generate a -->
  288. <!-- localized "Name" subheading for this refnamdiv (unless it has a -->
  289. <!-- preceding sibling that is a refnamediv, in which case we have already -->
  290. <!-- generated a "Name" subheading, so we don't need to do it again -->
  291. <xsl:if test="$refentry.generate.name != 0">
  292. <xsl:choose>
  293. <xsl:when test="preceding-sibling::refnamediv">
  294. <!-- no generated title on secondary refnamedivs! -->
  295. </xsl:when>
  296. <xsl:otherwise>
  297. <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
  298. xsl:use-attribute-sets="refnamediv.titlepage.recto.style"
  299. font-family="{$title.fontset}">
  300. <!-- Contents of what is now the format.refentry.subheading -->
  301. <!-- template were formerly intended to be used only to -->
  302. <!-- process those subsections of Refentry that have "real" -->
  303. <!-- title children. So as a kludge to get around the fact -->
  304. <!-- that the template still basically "expects" to be -->
  305. <!-- processing that kind of a node, when we call the -->
  306. <!-- template to process generated titles, we must call it -->
  307. <!-- with values for the "offset" and "section" parameters -->
  308. <!-- that are different from the default values in the -->
  309. <!-- format.refentry.subheading template itself. Because -->
  310. <!-- those defaults are the values appropriate for processing -->
  311. <!-- "real" title nodes. -->
  312. <xsl:call-template name="format.refentry.subheading">
  313. <xsl:with-param name="section" select="self::*"/>
  314. <xsl:with-param name="offset" select="1"/>
  315. <xsl:with-param name="gentext.key" select="'RefName'"/>
  316. </xsl:call-template>
  317. </fo:block>
  318. </xsl:otherwise>
  319. </xsl:choose>
  320. </xsl:if>
  321. <xsl:if test="$refentry.generate.title != 0">
  322. <xsl:variable name="section.level">
  323. <xsl:call-template name="refentry.level">
  324. <xsl:with-param name="node" select="ancestor::refentry"/>
  325. </xsl:call-template>
  326. </xsl:variable>
  327. <xsl:variable name="reftitle">
  328. <xsl:choose>
  329. <xsl:when test="../refmeta/refentrytitle">
  330. <xsl:apply-templates select="../refmeta/refentrytitle"/>
  331. </xsl:when>
  332. <xsl:otherwise>
  333. <xsl:apply-templates select="refname[1]"/>
  334. </xsl:otherwise>
  335. </xsl:choose>
  336. </xsl:variable>
  337. <!-- xsl:use-attribute-sets takes only a Qname, not a variable -->
  338. <xsl:choose>
  339. <xsl:when test="preceding-sibling::refnamediv">
  340. <!-- no title on secondary refnamedivs! -->
  341. </xsl:when>
  342. <xsl:when test="$section.level = 1">
  343. <fo:block xsl:use-attribute-sets="refentry.title.properties">
  344. <fo:block xsl:use-attribute-sets="section.title.level1.properties">
  345. <xsl:value-of select="$reftitle"/>
  346. </fo:block>
  347. </fo:block>
  348. </xsl:when>
  349. <xsl:when test="$section.level = 2">
  350. <fo:block xsl:use-attribute-sets="refentry.title.properties">
  351. <fo:block xsl:use-attribute-sets="section.title.level2.properties">
  352. <xsl:value-of select="$reftitle"/>
  353. </fo:block>
  354. </fo:block>
  355. </xsl:when>
  356. <xsl:when test="$section.level = 3">
  357. <fo:block xsl:use-attribute-sets="refentry.title.properties">
  358. <fo:block xsl:use-attribute-sets="section.title.level3.properties">
  359. <xsl:value-of select="$reftitle"/>
  360. </fo:block>
  361. </fo:block>
  362. </xsl:when>
  363. <xsl:when test="$section.level = 4">
  364. <fo:block xsl:use-attribute-sets="refentry.title.properties">
  365. <fo:block xsl:use-attribute-sets="section.title.level4.properties">
  366. <xsl:value-of select="$reftitle"/>
  367. </fo:block>
  368. </fo:block>
  369. </xsl:when>
  370. <xsl:when test="$section.level = 5">
  371. <fo:block xsl:use-attribute-sets="refentry.title.properties">
  372. <fo:block xsl:use-attribute-sets="section.title.level5.properties">
  373. <xsl:value-of select="$reftitle"/>
  374. </fo:block>
  375. </fo:block>
  376. </xsl:when>
  377. <xsl:otherwise>
  378. <fo:block xsl:use-attribute-sets="refentry.title.properties">
  379. <fo:block xsl:use-attribute-sets="section.title.level6.properties">
  380. <xsl:value-of select="$reftitle"/>
  381. </fo:block>
  382. </fo:block>
  383. </xsl:otherwise>
  384. </xsl:choose>
  385. </xsl:if>
  386. <fo:block>
  387. <xsl:if test="not(following-sibling::refnamediv)">
  388. <xsl:attribute name="space-after">1em</xsl:attribute>
  389. </xsl:if>
  390. <xsl:apply-templates/>
  391. </fo:block>
  392. </fo:block>
  393. </xsl:template>
  394. <xsl:template match="refname">
  395. <xsl:if test="not(preceding-sibling::refdescriptor)">
  396. <xsl:apply-templates/>
  397. <xsl:if test="following-sibling::refname">
  398. <xsl:text>, </xsl:text>
  399. </xsl:if>
  400. </xsl:if>
  401. </xsl:template>
  402. <xsl:template match="refpurpose">
  403. <xsl:if test="node()">
  404. <xsl:text> </xsl:text>
  405. <xsl:call-template name="dingbat">
  406. <xsl:with-param name="dingbat">em-dash</xsl:with-param>
  407. </xsl:call-template>
  408. <xsl:text> </xsl:text>
  409. <xsl:apply-templates/>
  410. </xsl:if>
  411. </xsl:template>
  412. <xsl:template match="refdescriptor">
  413. <xsl:apply-templates/>
  414. </xsl:template>
  415. <xsl:template match="refclass">
  416. <xsl:if test="$refclass.suppress = 0">
  417. <fo:block font-weight="bold">
  418. <xsl:if test="@role">
  419. <xsl:value-of select="@role"/>
  420. <xsl:text>: </xsl:text>
  421. </xsl:if>
  422. <xsl:apply-templates/>
  423. </fo:block>
  424. </xsl:if>
  425. </xsl:template>
  426. <xsl:template match="refsynopsisdiv">
  427. <xsl:variable name="id">
  428. <xsl:call-template name="object.id"/>
  429. </xsl:variable>
  430. <fo:block id="{$id}">
  431. <xsl:if test="not(refsynopsisdivinfo/title|docinfo/title|info/title|title)">
  432. <!-- * if we there is no appropriate title for this Refsynopsisdiv, -->
  433. <!-- * then we need to call format.refentry.subheading to generate one -->
  434. <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
  435. xsl:use-attribute-sets="refsynopsisdiv.titlepage.recto.style"
  436. font-family="{$title.fontset}">
  437. <!-- Contents of what is now the format.refentry.subheading -->
  438. <!-- template were formerly intended to be used only to -->
  439. <!-- process those subsections of Refentry that have "real" -->
  440. <!-- title children. So as a kludge to get around the fact -->
  441. <!-- that the template still basically "expects" to be -->
  442. <!-- processing that kind of a node, when we call the -->
  443. <!-- template to process generated titles, we must call it -->
  444. <!-- with values for the "offset" and "section" parameters -->
  445. <!-- that are different from the default values in the -->
  446. <!-- format.refentry.subheading template itself. Because -->
  447. <!-- those defaults are the values appropriate for processing -->
  448. <!-- "real" title nodes. -->
  449. <xsl:call-template name="format.refentry.subheading">
  450. <xsl:with-param name="section" select="parent::*"/>
  451. <xsl:with-param name="offset" select="1"/>
  452. <xsl:with-param name="gentext.key" select="'RefSynopsisDiv'"/>
  453. </xsl:call-template>
  454. </fo:block>
  455. </xsl:if>
  456. <xsl:call-template name="refsynopsisdiv.titlepage"/>
  457. <xsl:apply-templates/>
  458. </fo:block>
  459. </xsl:template>
  460. <xsl:template match="refsection">
  461. <xsl:variable name="id">
  462. <xsl:call-template name="object.id"/>
  463. </xsl:variable>
  464. <fo:block id="{$id}">
  465. <xsl:call-template name="refsection.titlepage"/>
  466. <xsl:apply-templates/>
  467. </fo:block>
  468. </xsl:template>
  469. <xsl:template match="refsect1">
  470. <xsl:variable name="id">
  471. <xsl:call-template name="object.id"/>
  472. </xsl:variable>
  473. <fo:block id="{$id}">
  474. <xsl:call-template name="refsect1.titlepage"/>
  475. <xsl:apply-templates/>
  476. </fo:block>
  477. </xsl:template>
  478. <xsl:template match="refsect2">
  479. <xsl:variable name="id">
  480. <xsl:call-template name="object.id"/>
  481. </xsl:variable>
  482. <fo:block id="{$id}">
  483. <xsl:call-template name="refsect2.titlepage"/>
  484. <xsl:apply-templates/>
  485. </fo:block>
  486. </xsl:template>
  487. <xsl:template match="refsect3">
  488. <xsl:variable name="id">
  489. <xsl:call-template name="object.id"/>
  490. </xsl:variable>
  491. <fo:block id="{$id}">
  492. <xsl:call-template name="refsect3.titlepage"/>
  493. <xsl:apply-templates/>
  494. </fo:block>
  495. </xsl:template>
  496. <xsl:template match="refsynopsisdiv/title
  497. |refsection/title
  498. |refsect1/title
  499. |refsect2/title
  500. |refsect3/title">
  501. <!-- nop; titlepage.mode instead -->
  502. </xsl:template>
  503. <xsl:template match="refsynopsisdiv/title
  504. |refsection/title
  505. |refsect1/title
  506. |refsect2/title
  507. |refsect3/title
  508. |refsynopsisdiv/info/title
  509. |refsection/info/title
  510. |refsect1/info/title
  511. |refsect2/info/title
  512. |refsect3/info/title"
  513. mode="titlepage.mode"
  514. priority="2">
  515. <xsl:call-template name="format.refentry.subheading"/>
  516. </xsl:template>
  517. <xsl:template name="format.refentry.subheading">
  518. <!-- This template is now called to process generated titles for -->
  519. <!-- Refnamediv and Refsynopsisdiv, as well as "real" titles for -->
  520. <!-- Refsynopsisdiv, Refsection, and Refsect[1-3]. -->
  521. <!-- -->
  522. <!-- But the contents of this template were formerly intended to be used -->
  523. <!-- only to process those subsections of Refentry that have "real" title -->
  524. <!-- children. So as a kludge to get around the fact that the template -->
  525. <!-- still basically "expects" to be processing that kind of a node, the -->
  526. <!-- "offset" parameter was added and the "section" variable was changed to -->
  527. <!-- a parameter so that when called for a generated title on a Refnamediv -->
  528. <!-- or Refsynopsisdiv, we can call it like this: -->
  529. <!-- -->
  530. <!-- <xsl:call-template name="format.refentry.subheading"> -->
  531. <!-- <xsl:with-param name="section" select="self::*"/> -->
  532. <!-- <xsl:with-param name="offset" select="1"/> -->
  533. <!-- <xsl:with-param name="gentext.key" select="'RefName'"/> -->
  534. <!-- </xsl:call-template> -->
  535. <!-- -->
  536. <xsl:param name="section"
  537. select="(ancestor::refsynopsisdiv
  538. |ancestor::refsection
  539. |ancestor::refsect1
  540. |ancestor::refsect2
  541. |ancestor::refsect3)[last()]"/>
  542. <xsl:param name="offset" select="0"/>
  543. <xsl:param name="gentext.key"/>
  544. <fo:block keep-with-next.within-column="always">
  545. <xsl:variable name="id">
  546. <xsl:call-template name="object.id">
  547. <xsl:with-param name="object" select="$section"/>
  548. </xsl:call-template>
  549. </xsl:variable>
  550. <xsl:variable name="level">
  551. <xsl:call-template name="section.level">
  552. <xsl:with-param name="node" select="$section"/>
  553. </xsl:call-template>
  554. </xsl:variable>
  555. <xsl:variable name="title">
  556. <!-- If we have a non-empty value for the $gentext.key param, then we -->
  557. <!-- generate an appropriate title here. Otherwise, we have a real -->
  558. <!-- title child, so we copy contents of that to the result tree. -->
  559. <xsl:choose>
  560. <xsl:when test="$gentext.key != ''">
  561. <xsl:call-template name="gentext">
  562. <xsl:with-param name="key" select="$gentext.key"/>
  563. </xsl:call-template>
  564. </xsl:when>
  565. <xsl:otherwise>
  566. <xsl:apply-templates select="$section" mode="object.title.markup">
  567. <xsl:with-param name="allow-anchors" select="1"/>
  568. </xsl:apply-templates>
  569. </xsl:otherwise>
  570. </xsl:choose>
  571. </xsl:variable>
  572. <xsl:if test="$axf.extensions != 0">
  573. <xsl:attribute name="axf:outline-level">
  574. <xsl:value-of select="count(ancestor::*)-1 + $offset"/>
  575. </xsl:attribute>
  576. <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
  577. <xsl:attribute name="axf:outline-title">
  578. <xsl:value-of select="$title"/>
  579. </xsl:attribute>
  580. </xsl:if>
  581. <xsl:call-template name="section.heading">
  582. <xsl:with-param name="level" select="$level + $offset"/>
  583. <xsl:with-param name="title" select="$title"/>
  584. </xsl:call-template>
  585. </fo:block>
  586. </xsl:template>
  587. <xsl:template match="refsectioninfo|refsection/info"></xsl:template>
  588. <xsl:template match="refsect1info|refsect1/info"></xsl:template>
  589. <xsl:template match="refsect2info|refsect2/info"></xsl:template>
  590. <xsl:template match="refsect3info|refsect3/info"></xsl:template>
  591. <!-- ==================================================================== -->
  592. </xsl:stylesheet>