Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

xml2pdf.xsl 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <!-- $Id$ -->
  16. <xsl:stylesheet
  17. xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  18. xmlns:fo="http://www.w3.org/1999/XSL/Format">
  19. <xsl:template match ="root">
  20. <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  21. <!-- defines page layout -->
  22. <fo:layout-master-set>
  23. <fo:simple-page-master master-name="simple"
  24. page-height="29.7cm"
  25. page-width="21cm"
  26. margin-top="1.5cm"
  27. margin-bottom="1.5cm"
  28. margin-left="2.5cm"
  29. margin-right="2.5cm">
  30. <fo:region-body margin-top="1.5cm"/>
  31. <fo:region-before extent="1.5cm"/>
  32. <fo:region-after extent="1.5cm"/>
  33. </fo:simple-page-master>
  34. </fo:layout-master-set>
  35. <fo:page-sequence master-reference="simple">
  36. <fo:static-content flow-name="xsl-region-before">
  37. <fo:block text-align="end"
  38. font-size="10pt"
  39. font-family="serif"
  40. line-height="14pt" >
  41. xsl:fo short reference - p. <fo:page-number/>
  42. </fo:block>
  43. </fo:static-content>
  44. <fo:flow flow-name="xsl-region-body">
  45. <fo:block font-size="18pt"
  46. font-family="sans-serif"
  47. line-height="24pt"
  48. space-after.optimum="15pt"
  49. background-color="blue"
  50. color="white"
  51. text-align="center">
  52. xsl:fo short reference
  53. </fo:block>
  54. <!-- generates table of contents and puts it into a table -->
  55. <fo:block font-size="10pt"
  56. font-family="sans-serif"
  57. line-height="10pt"
  58. space-after.optimum="3pt"
  59. font-weight="bold"
  60. start-indent="15pt">
  61. Content
  62. </fo:block>
  63. <fo:table space-after.optimum="15pt">
  64. <fo:table-column column-width="1cm"/>
  65. <fo:table-column column-width="15cm"/>
  66. <fo:table-body font-size="10pt"
  67. font-family="sans-serif">
  68. <xsl:for-each select="div0/head">
  69. <fo:table-row line-height="12pt">
  70. <fo:table-cell>
  71. <fo:block text-align="end" >
  72. <xsl:number value="position()" format="1"/>)
  73. </fo:block>
  74. </fo:table-cell>
  75. <fo:table-cell>
  76. <fo:block text-align="start" >
  77. <xsl:value-of select="."/>
  78. </fo:block>
  79. </fo:table-cell>
  80. </fo:table-row>
  81. </xsl:for-each>
  82. </fo:table-body>
  83. </fo:table>
  84. <xsl:apply-templates/>
  85. <fo:block font-size="10pt"
  86. font-family="sans-serif"
  87. line-height="11pt"
  88. space-before.optimum="2cm">
  89. The explanation of the flow objects is based (mostly verbatim) on the section
  90. 6.2 of the XSL W3C Candidate Recommendation 21 November 2000. More info at the beginning
  91. of the file xslfoRef.xml.
  92. </fo:block>
  93. </fo:flow>
  94. </fo:page-sequence>
  95. </fo:root>
  96. </xsl:template>
  97. <xsl:template match ="div">
  98. <fo:block font-size="14pt"
  99. font-family="sans-serif"
  100. space-before.optimum="3pt"
  101. space-after.optimum="3pt"
  102. text-align="center"
  103. padding-top="3pt"
  104. >
  105. <xsl:apply-templates/>
  106. </fo:block>
  107. </xsl:template>
  108. <xsl:template match ="div0/head">
  109. <fo:block font-size="16pt"
  110. line-height="18pt"
  111. text-align="center"
  112. padding-top="3pt"
  113. start-indent="2cm"
  114. end-indent="2cm"
  115. background-color="blue"
  116. color="white"
  117. space-before.optimum="5pt"
  118. space-after.optimum="5pt"
  119. >
  120. <xsl:value-of select="."/>
  121. </fo:block>
  122. </xsl:template>
  123. <xsl:template match ="div/fo">
  124. <fo:block font-size="13pt"
  125. line-height="14pt"
  126. text-align="start"
  127. >
  128. <xsl:value-of select="."/>
  129. </fo:block>
  130. </xsl:template>
  131. <xsl:template match ="explanation">
  132. <fo:block font-size="11pt"
  133. font-family="sans-serif"
  134. line-height="12pt"
  135. text-align="start"
  136. start-indent="0.5cm"
  137. >
  138. <xsl:apply-templates/>
  139. </fo:block>
  140. </xsl:template>
  141. <xsl:template match ="div/content">
  142. <fo:block font-size="10pt"
  143. font-family="Courier"
  144. start-indent="0.5cm"
  145. line-height="11pt"
  146. text-align="start"
  147. wrap-option="wrap">
  148. Content: <xsl:value-of select="."/>
  149. </fo:block>
  150. </xsl:template>
  151. <xsl:template match ="div/properties">
  152. <fo:block font-size="10pt"
  153. font-family="Courier"
  154. line-height="11pt"
  155. text-align="start"
  156. start-indent="0.5cm">
  157. Properties:
  158. </fo:block>
  159. <fo:block space-after.optimum="3pt">
  160. <xsl:apply-templates/>
  161. </fo:block>
  162. </xsl:template>
  163. <xsl:template match ="properties/property">
  164. <fo:block font-size="9pt"
  165. font-family="sans-serif"
  166. line-height="10pt"
  167. text-align="start"
  168. start-indent="1cm">
  169. <xsl:value-of select="."/>
  170. </fo:block>
  171. </xsl:template>
  172. <xsl:template match ="div/property-def">
  173. <fo:block font-size="13pt"
  174. line-height="14pt"
  175. text-align="start"
  176. >
  177. <xsl:value-of select="."/>
  178. </fo:block>
  179. </xsl:template>
  180. <xsl:template match ="div/values">
  181. <fo:block font-size="11pt"
  182. text-align="start"
  183. line-height="12pt">Values: <xsl:value-of select="."/>
  184. </fo:block>
  185. </xsl:template>
  186. </xsl:stylesheet>