You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <?xml version="1.0"?>
  2. <!-- XSLT stylesheet to convert the Fop documentation collected in one xml file into a fo file
  3. for use in FOP
  4. TBD: - The faq doesn't show in the content
  5. - check why margin-bottom on the page with properties is too large
  6. - check why keep-next not only doesn't work, but leads to repeating already printed lines
  7. - make lines containing only code look nicer (smaller line height)
  8. - replace bullets in ordered lists with numbers
  9. - correct the hack replacing nbsp with '-'
  10. - handle the links correctly which have been external in the html doc and are now internal
  11. -->
  12. <xsl:stylesheet
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  14. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  15. >
  16. <xsl:template match ="/">
  17. <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  18. <!-- defines page layout -->
  19. <fo:layout-master-set>
  20. <fo:simple-page-master master-name="first"
  21. page-height="29.7cm"
  22. page-width="21cm"
  23. margin-top="1.5cm"
  24. margin-bottom="2cm"
  25. margin-left="2.5cm"
  26. margin-right="2.5cm">
  27. <fo:region-body margin-top="3cm"/>
  28. <fo:region-before extent="1.5cm"/>
  29. <fo:region-after extent="1.5cm"/>
  30. </fo:simple-page-master>
  31. <fo:simple-page-master master-name="rest"
  32. page-height="29.7cm"
  33. page-width="21cm"
  34. margin-top="1.5cm"
  35. margin-bottom="2cm"
  36. margin-left="2.5cm"
  37. margin-right="2.5cm">
  38. <fo:region-body margin-top="2.5cm"/>
  39. <fo:region-before extent="1.5cm"/>
  40. <fo:region-after extent="1.5cm"/>
  41. </fo:simple-page-master>
  42. <fo:page-sequence-master master-name="all">
  43. <fo:single-page-master-reference master-name="first"/>
  44. <fo:repeatable-page-master-reference master-name="rest"/>
  45. </fo:page-sequence-master>
  46. </fo:layout-master-set>
  47. <fo:page-sequence master-name="all">
  48. <fo:static-content flow-name="xsl-region-before">
  49. <fo:block text-align="end"
  50. font-size="10pt"
  51. font-family="serif"
  52. line-height="14pt" >
  53. FOP documentation - p. <fo:page-number/>
  54. </fo:block>
  55. </fo:static-content>
  56. <fo:flow flow-name="xsl-region-body">
  57. <fo:block font-size="18pt"
  58. font-family="sans-serif"
  59. line-height="24pt"
  60. space-after.optimum="15pt"
  61. background-color="blue"
  62. color="white"
  63. text-align="center">
  64. FOP - an xsl:fo renderer
  65. </fo:block>
  66. <!-- generates table of contents and puts it into a table -->
  67. <fo:block font-size="14pt"
  68. font-family="sans-serif"
  69. line-height="18pt"
  70. space-after.optimum="10pt"
  71. font-weight="bold"
  72. start-indent="15pt">
  73. Content
  74. </fo:block>
  75. <fo:table>
  76. <fo:table-column column-width="1cm"/>
  77. <fo:table-column column-width="15cm"/>
  78. <fo:table-body font-size="12pt"
  79. line-height="16pt"
  80. font-family="sans-serif">
  81. <xsl:for-each select="//s1"> <!-- An dieser Stelle muesste noch ein "oder finde faqs" stehen -->
  82. <fo:table-row>
  83. <fo:table-cell>
  84. <fo:block text-align="end" >
  85. <xsl:number value="position()" format="1"/>)
  86. </fo:block>
  87. </fo:table-cell>
  88. <fo:table-cell>
  89. <fo:block text-align="start" >
  90. <fo:simple-link color="blue">
  91. <xsl:attribute name="internal-destination">
  92. <xsl:value-of select="translate(.,' ),-.(','____')"/>
  93. </xsl:attribute>
  94. <xsl:value-of select="@title"/>
  95. </fo:simple-link>
  96. </fo:block>
  97. </fo:table-cell>
  98. </fo:table-row>
  99. </xsl:for-each>
  100. </fo:table-body>
  101. </fo:table>
  102. <xsl:apply-templates select="documentation"/>
  103. </fo:flow>
  104. </fo:page-sequence>
  105. </fo:root>
  106. </xsl:template>
  107. <!-- s1 -->
  108. <xsl:template match ="s1">
  109. <fo:block font-size="18pt"
  110. font-family="sans-serif"
  111. line-height="24pt"
  112. space-before.optimum="15pt"
  113. space-after.optimum="15pt"
  114. background-color="blue"
  115. color="white"
  116. text-align="center"
  117. >
  118. <xsl:attribute name="id">
  119. <xsl:value-of select="translate(.,' ),-.(','____')"/>
  120. </xsl:attribute>
  121. <xsl:value-of select="@title"/>
  122. </fo:block>
  123. <xsl:apply-templates/>
  124. </xsl:template>
  125. <!-- s2 -->
  126. <xsl:template match ="s2">
  127. <fo:block font-size="16pt"
  128. font-family="sans-serif"
  129. line-height="20pt"
  130. space-before.optimum="15pt"
  131. space-after.optimum="12pt"
  132. text-align="center"
  133. padding-top="3pt"
  134. >
  135. <xsl:value-of select="@title"/>
  136. </fo:block>
  137. <xsl:apply-templates/>
  138. </xsl:template>
  139. <!-- s3 -->
  140. <xsl:template match ="s3">
  141. <fo:block font-size="14pt"
  142. font-family="sans-serif"
  143. line-height="18pt"
  144. space-before.optimum="10pt"
  145. space-after.optimum="9pt"
  146. text-align="center"
  147. padding-top="3pt">
  148. <xsl:value-of select="@title"/>
  149. </fo:block>
  150. <xsl:apply-templates/>
  151. </xsl:template>
  152. <!-- p [not(code)] -->
  153. <xsl:template match ="p">
  154. <fo:block font-size="11pt"
  155. font-family="sans-serif"
  156. line-height="13pt"
  157. space-after.optimum="3pt"
  158. space-before.optimum="3pt"
  159. text-align="justify">
  160. <xsl:apply-templates/>
  161. </fo:block>
  162. </xsl:template>
  163. <!-- p + code
  164. <xsl:template match ="p[code]">
  165. <fo:block font-size="11pt"
  166. font-family="sans-serif"
  167. line-height="11pt"
  168. space-after.optimum="0pt"
  169. space-before.optimum="0pt"
  170. text-align="start">
  171. <xsl:apply-templates/>
  172. </fo:block>
  173. </xsl:template>
  174. -->
  175. <!-- faqs -->
  176. <xsl:template match ="faqs">
  177. <fo:block font-size="18pt"
  178. font-family="sans-serif"
  179. line-height="24pt"
  180. space-before.optimum="15pt"
  181. space-after.optimum="15pt"
  182. background-color="blue"
  183. color="white"
  184. text-align="center"
  185. >
  186. <xsl:attribute name="id">
  187. <xsl:value-of select="translate(.,' ),-.(','____')"/>
  188. </xsl:attribute>
  189. <xsl:value-of select="@title"/>
  190. </fo:block>
  191. <xsl:apply-templates/>
  192. </xsl:template>
  193. <!-- faq -->
  194. <xsl:template match ="faq">
  195. <xsl:apply-templates/>
  196. </xsl:template>
  197. <!-- q in faq -->
  198. <xsl:template match ="q">
  199. <fo:block font-size="11pt"
  200. font-family="sans-serif"
  201. line-height="13pt"
  202. space-after.optimum="3pt"
  203. space-before.optimum="3pt"
  204. text-align="justify">
  205. <xsl:apply-templates/>
  206. </fo:block>
  207. </xsl:template>
  208. <!-- a in faq -->
  209. <xsl:template match ="a">
  210. <xsl:apply-templates/>
  211. </xsl:template>
  212. <!-- jump (links) -->
  213. <xsl:template match ="*/jump">
  214. <fo:simple-link color="blue" external-destination="{@href}">
  215. <xsl:apply-templates/>
  216. </fo:simple-link>
  217. </xsl:template>
  218. <!-- code -->
  219. <xsl:template match ="*/code">
  220. <fo:inline font-size="10pt"
  221. font-family="Courier">
  222. <xsl:apply-templates/>
  223. </fo:inline>
  224. </xsl:template>
  225. <!-- ul (unordered list) -->
  226. <xsl:template match ="ul">
  227. <fo:list-block start-indent="1cm"
  228. provisional-distance-between-starts="12pt"
  229. font-family="sans-serif"
  230. font-size="11pt"
  231. line-height="11pt">
  232. <xsl:apply-templates/>
  233. </fo:list-block>
  234. </xsl:template>
  235. <!-- ol (ordered list) -->
  236. <xsl:template match ="ol">
  237. <fo:list-block start-indent="1cm"
  238. provisional-distance-between-starts="12pt"
  239. font-family="sans-serif"
  240. font-size="11pt"
  241. line-height="11pt">
  242. <xsl:apply-templates/>
  243. </fo:list-block>
  244. </xsl:template>
  245. <!-- li (list item) in unordered list -->
  246. <xsl:template match ="ul/li">
  247. <fo:list-item>
  248. <fo:list-item-label>
  249. <fo:block><fo:inline font-family="Symbol">&#183;</fo:inline></fo:block>
  250. </fo:list-item-label>
  251. <fo:list-item-body>
  252. <fo:block space-after.optimum="4pt"
  253. text-align="justify"
  254. padding-top="3pt">
  255. <xsl:apply-templates/>
  256. </fo:block>
  257. </fo:list-item-body>
  258. </fo:list-item>
  259. </xsl:template>
  260. <!-- li (list item) in ordered list -->
  261. <xsl:template match ="ol/li">
  262. <fo:list-item>
  263. <fo:list-item-label>
  264. <fo:block>
  265. <xsl:number level="multiple" count="li" format="1"/>)
  266. </fo:block>
  267. </fo:list-item-label>
  268. <fo:list-item-body>
  269. <fo:block space-after.optimum="4pt"
  270. text-align="justify"
  271. padding-top="3pt">
  272. <xsl:apply-templates/>
  273. </fo:block>
  274. </fo:list-item-body>
  275. </fo:list-item>
  276. </xsl:template>
  277. <!-- end body -->
  278. </xsl:stylesheet>