fo.xsl.in 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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. version='1.0'>
  5. <xsl:import href="${DOCBOOK_XSL}/fo/profile-docbook.xsl"/>
  6. <xsl:import href="${CMAKE_CURRENT_SOURCE_DIR}/mytitlepage.xsl"/>
  7. <xsl:param name="img.src.path">${DOC_IMAGES}</xsl:param>
  8. <xsl:param name="admon.graphics" select="1"/>
  9. <xsl:param name="admon.graphics.path" select="icons"/>
  10. <xsl:param name="chapter.autolabel" select="0"/>
  11. <xsl:param name="shade.verbatim" select="1"/>
  12. <!--xsl:param name="body.font.family" select="serif"/-->
  13. <xsl:param name="body.start.indent" select="0"/>
  14. <xsl:param name="callout.graphics" select="0"/>
  15. <xsl:param name="footer.column.widths" select="'0 3 0'"/>
  16. <!--xsl:param name="use.extensions" select="1"/-->
  17. <xsl:param name="fop1.extensions" select="1"/>
  18. <xsl:param name="generate.index" select="3"/>
  19. <xsl:param name="generate.section.toc.level" select="1"/>
  20. <xsl:param name="generate.toc">book toc</xsl:param>
  21. <xsl:param name="header.column.widths" select="'0 3 0'"/>
  22. <xsl:param name="paper.type" select="letter"/>
  23. <xsl:param name="profile.condition" select="int"/>
  24. <xsl:param name="qanda.inherit.numeration" select="0"/>
  25. <xsl:param name="section.autolabel" select="0"/>
  26. <!--xsl:param name="title.font.family" select="sans-serif"/-->
  27. <xsl:param name="toc.section.depth" select="1"/>
  28. <!--===========================SPECIAL_TOC_SAUCE======================-->
  29. <xsl:template name="page.number.format">
  30. <xsl:param name="element" select="local-name(.)"/>
  31. <xsl:choose>
  32. <xsl:when test="$element = 'toc'">1</xsl:when>
  33. <xsl:otherwise>1</xsl:otherwise>
  34. </xsl:choose>
  35. </xsl:template>
  36. <xsl:template name="initial.page.number">
  37. <xsl:param name="element" select="local-name(.)"/>
  38. <xsl:param name="master-reference" select="''"/>
  39. <!-- Select the first content that the stylesheet places
  40. after the TOC -->
  41. <xsl:variable name="first.book.content"
  42. select="ancestor::book/*[
  43. not(self::title or
  44. self::subtitle or
  45. self::titleabbrev or
  46. self::bookinfo or
  47. self::info or
  48. self::dedication or
  49. self::preface or
  50. self::toc or
  51. self::lot)][1]"/>
  52. <xsl:choose>
  53. <!-- double-sided output -->
  54. <xsl:when test="$double.sided != 0">
  55. <xsl:choose>
  56. <xsl:when test="$element = 'toc'">auto-odd</xsl:when>
  57. <xsl:when test="$element = 'book'">auto</xsl:when>
  58. <!-- preface typically continues TOC roman numerals -->
  59. <!-- Change page.number.format if not -->
  60. <xsl:when test="$element = 'preface'">auto-odd</xsl:when>
  61. <xsl:when test="($element = 'dedication' or $element = 'article')
  62. and not(preceding::chapter
  63. or preceding::preface
  64. or preceding::appendix
  65. or preceding::article
  66. or preceding::dedication
  67. or parent::part
  68. or parent::reference)">auto</xsl:when>
  69. <xsl:when test="generate-id($first.book.content) =
  70. generate-id(.)">auto</xsl:when>
  71. <xsl:otherwise>auto-odd</xsl:otherwise>
  72. </xsl:choose>
  73. </xsl:when>
  74. <!-- single-sided output -->
  75. <xsl:otherwise>
  76. <xsl:choose>
  77. <xsl:when test="$element = 'toc'">auto</xsl:when>
  78. <xsl:when test="$element = 'book'">1</xsl:when>
  79. <xsl:when test="$element = 'preface'">auto</xsl:when>
  80. <xsl:when test="($element = 'dedication' or $element = 'article') and
  81. not(preceding::chapter
  82. or preceding::preface
  83. or preceding::appendix
  84. or preceding::article
  85. or preceding::dedication
  86. or parent::part
  87. or parent::reference)">auto</xsl:when>
  88. <xsl:when test="generate-id($first.book.content) =
  89. generate-id(.)">auto</xsl:when>
  90. <xsl:otherwise>auto</xsl:otherwise>
  91. </xsl:choose>
  92. </xsl:otherwise>
  93. </xsl:choose>
  94. </xsl:template>
  95. <!--================ENDOFSPECIAL_tocSauce==============================-->
  96. <xsl:template match="processing-instruction('hard-pagebreak')">
  97. <fo:block break-after='page'/>
  98. </xsl:template>
  99. <xsl:template match="processing-instruction('linebreak')">
  100. <fo:block/>
  101. </xsl:template>
  102. <xsl:template match="programlisting[@role='tab']">
  103. <fo:block xsl:use-attribute-sets="monospace.verbatim.properties">
  104. <xsl:attribute name="font-family">serif</xsl:attribute>
  105. <xsl:attribute name="font-size">10pt</xsl:attribute>
  106. <xsl:apply-templates/>
  107. </fo:block>
  108. </xsl:template>
  109. <!--sans-serif-para-role-->
  110. <xsl:template match="para[@role='sans']">
  111. <fo:block>
  112. <xsl:attribute name="font-family">sans-serif</xsl:attribute>
  113. <xsl:apply-templates/>
  114. </fo:block>
  115. </xsl:template>
  116. <xsl:template match="para[@role='wsig']">
  117. <fo:block xsl:use-attribute-sets="monospace.verbatim.properties">
  118. <xsl:attribute name="font-size">10pt</xsl:attribute>
  119. <xsl:apply-templates/>
  120. </fo:block>
  121. </xsl:template>
  122. <xsl:template match="programlisting[@role='wsig']">
  123. <fo:block xsl:use-attribute-sets="monospace.verbatim.properties">
  124. <xsl:attribute name="font-size">10pt</xsl:attribute>
  125. <xsl:apply-templates/>
  126. </fo:block>
  127. </xsl:template>
  128. <!--para-syntax-role-elim-hyph-17-->
  129. <xsl:template match="para[@role='syntax']">
  130. <fo:block space-after="6pt" space-before="12pt" space-before.precedence="1">
  131. <xsl:attribute name="hyphenate">false</xsl:attribute>
  132. <xsl:attribute name="text-align">left</xsl:attribute>
  133. <xsl:apply-templates/>
  134. </fo:block>
  135. </xsl:template>
  136. <xsl:attribute-set name="monospace.verbatim.properties">
  137. <xsl:attribute name="font-size">
  138. 0.83em
  139. </xsl:attribute>
  140. </xsl:attribute-set>
  141. <xsl:attribute-set name="section.title.level1.properties">
  142. <xsl:attribute name="font-size">
  143. <xsl:value-of select="$body.font.master * 2.425"></xsl:value-of>
  144. <xsl:text>pt</xsl:text>
  145. </xsl:attribute>
  146. <xsl:attribute name="color">#A91919</xsl:attribute>
  147. <xsl:attribute name="text-decoration">underline</xsl:attribute>
  148. </xsl:attribute-set>
  149. <xsl:attribute-set name="section.title.level2.properties">
  150. <xsl:attribute name="color">#A91919</xsl:attribute>
  151. </xsl:attribute-set>
  152. <xsl:attribute-set name="section.level1.properties">
  153. <xsl:attribute name="break-before">
  154. <xsl:choose>
  155. <xsl:when test="@role = 'nobrk'">auto</xsl:when>
  156. <xsl:otherwise>page</xsl:otherwise>
  157. </xsl:choose>
  158. </xsl:attribute>
  159. </xsl:attribute-set>
  160. <xsl:attribute-set name="section.level2.properties">
  161. <xsl:attribute name="break-before">
  162. <xsl:choose>
  163. <xsl:when test="@role = 'brk'">page</xsl:when>
  164. <xsl:otherwise>auto</xsl:otherwise>
  165. </xsl:choose>
  166. </xsl:attribute>
  167. </xsl:attribute-set>
  168. <xsl:attribute-set name="section.level3.properties">
  169. <xsl:attribute name="break-before">
  170. <xsl:choose>
  171. <xsl:when test="@role = 'brk'">page</xsl:when>
  172. <xsl:otherwise>auto</xsl:otherwise>
  173. </xsl:choose>
  174. </xsl:attribute>
  175. </xsl:attribute-set>
  176. <xsl:attribute-set name="header.content.properties">
  177. <xsl:attribute name="font-family">
  178. <xsl:value-of select="$title.font.family"></xsl:value-of>
  179. </xsl:attribute>
  180. </xsl:attribute-set>
  181. <xsl:attribute-set name="footer.content.properties">
  182. <xsl:attribute name="font-family">
  183. <xsl:value-of select="$title.font.family"></xsl:value-of>
  184. </xsl:attribute>
  185. </xsl:attribute-set>
  186. <!--chapter-title-attrib-set-->
  187. <xsl:attribute-set name="component.title.properties">
  188. <xsl:attribute name="text-align">right</xsl:attribute>
  189. </xsl:attribute-set>
  190. <xsl:template name="footer.content">
  191. <xsl:param name="pageclass" select="''"/>
  192. <xsl:param name="sequence" select="''"/>
  193. <xsl:param name="position" select="''"/>
  194. <xsl:param name="gentext-key" select="''"/>
  195. <xsl:choose>
  196. <xsl:when test="$double.sided = 0 and $position='center'">
  197. <fo:block>
  198. <xsl:value-of select="ancestor-or-self::book/bookinfo/releaseinfo"/>
  199. </fo:block>
  200. <fo:block>
  201. <fo:page-number/>
  202. </fo:block>
  203. </xsl:when>
  204. </xsl:choose>
  205. </xsl:template>
  206. <xsl:template name="header.content">
  207. <xsl:param name="pageclass" select="body"/>
  208. <xsl:param name="sequence" select="''"/>
  209. <xsl:param name="position" select="''"/>
  210. <xsl:param name="gentext-key" select="''"/>
  211. <xsl:choose>
  212. <xsl:when test="$pageclass = 'titlepage' and $position='center'">
  213. <!--IFC-HEADER-LOGIC-->
  214. <fo:block>
  215. <xsl:value-of select="ancestor-or-self::book/bookinfo/title"/>
  216. </fo:block>
  217. </xsl:when>
  218. <xsl:when test="$pageclass = 'lot' and $position='center'">
  219. <!--TOC-HEADER-LOGIC-->
  220. <fo:block>
  221. <xsl:value-of select="ancestor-or-self::book/bookinfo/title"/>
  222. </fo:block>
  223. </xsl:when>
  224. <xsl:when test="$double.sided = 0 and $position='center'">
  225. <fo:block>
  226. <xsl:value-of select="ancestor-or-self::book/bookinfo/title"/>
  227. </fo:block>
  228. <fo:block>
  229. <xsl:apply-templates select="." mode="object.title.markup"/>
  230. </fo:block>
  231. </xsl:when>
  232. </xsl:choose>
  233. </xsl:template>
  234. <!--VarListVariation-->
  235. <xsl:template match="varlistentry/term">
  236. <fo:inline font-family="sans-serif" font-weight="bold">
  237. <xsl:apply-templates/>
  238. </fo:inline>
  239. </xsl:template>
  240. <!--COLORING-TEMPLATES-->
  241. <xsl:template match="emphasis[@role='bluebold']">
  242. <fo:inline color="blue" font-weight="bold">
  243. <xsl:apply-templates/>
  244. </fo:inline>
  245. </xsl:template>
  246. <xsl:template match="emphasis[@role='blueital']">
  247. <fo:inline color="blue" font-style="italic">
  248. <xsl:apply-templates/>
  249. </fo:inline>
  250. </xsl:template>
  251. <xsl:template match="emphasis[@role='blue']">
  252. <fo:inline color="blue">
  253. <xsl:apply-templates/>
  254. </fo:inline>
  255. </xsl:template>
  256. <xsl:template match="emphasis[@role='redbold']">
  257. <fo:inline color="red" font-weight="bold">
  258. <xsl:apply-templates/>
  259. </fo:inline>
  260. </xsl:template>
  261. <xsl:template match="emphasis[@role='redital']">
  262. <fo:inline color="red" font-style="italic">
  263. <xsl:apply-templates/>
  264. </fo:inline>
  265. </xsl:template>
  266. <xsl:template match="emphasis[@role='red']">
  267. <fo:inline color="red">
  268. <xsl:apply-templates/>
  269. </fo:inline>
  270. </xsl:template>
  271. <xsl:template match="emphasis[@role='greenbold']">
  272. <fo:inline color="green" font-weight="bold">
  273. <xsl:apply-templates/>
  274. </fo:inline>
  275. </xsl:template>
  276. <xsl:template match="emphasis[@role='greenital']">
  277. <fo:inline color="green" font-style="italic">
  278. <xsl:apply-templates/>
  279. </fo:inline>
  280. </xsl:template>
  281. <xsl:template match="emphasis[@role='green']">
  282. <fo:inline color="green">
  283. <xsl:apply-templates/>
  284. </fo:inline>
  285. </xsl:template>
  286. <xsl:template match="emphasis[@role='whitebold']">
  287. <fo:inline color="white" font-weight="bold">
  288. <xsl:apply-templates/>
  289. </fo:inline>
  290. </xsl:template>
  291. <xsl:template match="emphasis[@role='whiteital']">
  292. <fo:inline color="white" font-style="italic">
  293. <xsl:apply-templates/>
  294. </fo:inline>
  295. </xsl:template>
  296. <xsl:template match="emphasis[@role='white']">
  297. <fo:inline color="white">
  298. <xsl:apply-templates/>
  299. </fo:inline>
  300. </xsl:template>
  301. <xsl:template match="emphasis[@role='underline']">
  302. <fo:inline text-decoration="underline">
  303. <xsl:apply-templates/>
  304. </fo:inline>
  305. </xsl:template>
  306. <!--NEW-inline_monospace-8-12-->
  307. <xsl:template match="emphasis[@role='code']">
  308. <fo:inline font-family="monospace">
  309. <xsl:apply-templates/>
  310. </fo:inline>
  311. </xsl:template>
  312. <xsl:template match="emphasis[@role='codebold']">
  313. <fo:inline font-family="monospace" font-weight="bold">
  314. <xsl:apply-templates/>
  315. </fo:inline>
  316. </xsl:template>
  317. <xsl:template match="ulink">
  318. <fo:inline color="blue" text-decoration="underline">
  319. <xsl:apply-templates/>
  320. </fo:inline>
  321. </xsl:template>
  322. <!--Special-TABLE-Striping-TEMPLATE-->
  323. <xsl:template name="table.row.properties">
  324. <xsl:variable name="tabstyle">
  325. <xsl:call-template name="tabstyle"/>
  326. </xsl:variable>
  327. <xsl:variable name="rownum">
  328. <xsl:number from="tgroup" count="row"/>
  329. </xsl:variable>
  330. <xsl:choose>
  331. <xsl:when test="$tabstyle = 'striped'">
  332. <xsl:if test="$rownum mod 2 = 0">
  333. <xsl:attribute name="background-color">#939598</xsl:attribute>
  334. </xsl:if>
  335. <xsl:if test="$rownum mod 2 != 0">
  336. <xsl:attribute name="background-color">#bcbec0</xsl:attribute>
  337. </xsl:if>
  338. </xsl:when>
  339. </xsl:choose>
  340. </xsl:template>
  341. </xsl:stylesheet>