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