Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / docxml2 / pdf / genPDF.xsl
1 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
2 <xsl:output method="xml" indent="yes" />
3 <xsl:include href="file.xsl" />
4
5 <!-- ######################################################### -->
6 <!-- # Pagination # -->
7 <!-- ######################################################### -->
8
9 <xsl:template match="/">
10 <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
11 <xsl:call-template name="page-sequence-def" />
12 <xsl:call-template name="bookmarks" />
13 <xsl:call-template name="first-page" />
14 <xsl:call-template name="doc-introduction" />
15 <xsl:call-template name="book" />
16 </fo:root>
17 </xsl:template>
18
19 <!-- Document Page Setup -->
20 <xsl:template name="page-sequence-def">
21 <fo:layout-master-set>
22 <fo:simple-page-master master-name="cover" page-height="29.7cm" page-width="21cm" margin-top="0.5cm" margin-bottom="0.5cm"
23 margin-left="2cm" margin-right="2cm">
24 <fo:region-body margin-top="2cm" />
25 </fo:simple-page-master>
26 <fo:simple-page-master master-name="leftPage" page-height="29.7cm" page-width="21cm" margin-top="1.2cm" margin-bottom="1.4cm"
27 margin-left="2cm" margin-right="2cm">
28 <fo:region-body margin-top="2cm" margin-bottom="1.5cm" />
29 <fo:region-before extent="1.2cm" />
30 <fo:region-after extent="1.3cm" />
31 </fo:simple-page-master>
32 <fo:simple-page-master master-name="rightPage" page-height="29.7cm" page-width="21cm" margin-top="1.2cm" margin-bottom="1.4cm"
33 margin-left="2cm" margin-right="2cm">
34 <fo:region-body margin-top="2cm" margin-bottom="1.5cm" />
35 <fo:region-before extent="1.2cm" />
36 <fo:region-after extent="1.3cm" />
37 </fo:simple-page-master>
38 <fo:page-sequence-master master-name="contents">
39 <fo:repeatable-page-master-alternatives>
40 <fo:conditional-page-master-reference master-reference="leftPage" odd-or-even="even" />
41 <fo:conditional-page-master-reference master-reference="rightPage" odd-or-even="odd" />
42 </fo:repeatable-page-master-alternatives>
43 </fo:page-sequence-master>
44 </fo:layout-master-set>
45 </xsl:template>
46
47 <!-- ######################################################### -->
48 <!-- # BOOKMARKS # -->
49 <!-- ######################################################### -->
50
51 <xsl:template name="bookmarks">
52 <fo:bookmark-tree>
53 <xsl:apply-templates select="//section[@niv='1']/title" mode="book" />
54 </fo:bookmark-tree>
55 </xsl:template>
56 <xsl:template mode="book" match="section/title">
57 <xsl:variable name="doc_level" select="../@niv" />
58 <fo:bookmark internal-destination="{generate-id(.)}">
59 <fo:bookmark-title>
60 <xsl:call-template name="title_num">
61 <xsl:with-param name="level" select="$doc_level" />
62 <xsl:with-param name="type" select="doc" />
63 </xsl:call-template>
64 </fo:bookmark-title>
65 <xsl:call-template name="title_bookmarks">
66 <xsl:with-param name="book_level">
67 <xsl:number value="$doc_level + 1" />
68 </xsl:with-param>
69 </xsl:call-template>
70 </fo:bookmark>
71 </xsl:template>
72 <xsl:template name="title_bookmarks">
73 <xsl:param name="book_level" select="2" />
74 <xsl:if test="..//section[@niv = $book_level]/title">
75 <xsl:for-each select="..//section[@niv = $book_level]/title">
76 <fo:bookmark internal-destination="{generate-id(.)}">
77 <fo:bookmark-title>
78 <xsl:call-template name="title_num">
79 <xsl:with-param name="level" select="../@niv" />
80 <xsl:with-param name="type" select="doc" />
81 </xsl:call-template>
82 </fo:bookmark-title>
83 <xsl:call-template name="title_bookmarks">
84 <xsl:with-param name="book_level">
85 <xsl:number value="$book_level + 1" />
86 </xsl:with-param>
87 </xsl:call-template>
88 </fo:bookmark>
89 </xsl:for-each>
90 </xsl:if>
91 </xsl:template>
92
93 <!-- ######################################################### -->
94 <!-- # FIRST PAGE # -->
95 <!-- ######################################################### -->
96
97 <!-- Release version -->
98 <xsl:template match="version">
99 <fo:block font-family="Helvetica" font-style="normal" font-weight="normal" font-size="20pt" text-align="right" space-after="5mm">
100 Software Release
101 <xsl:value-of select="$release_num" />
102 <xsl:apply-templates /></fo:block>
103 </xsl:template>
104
105 <!-- Information copyright / footer -->
106 <xsl:template mode="footer" match="legal">
107 <fo:block font-family="Helvetica" font-size="8pt" text-align="right">
108 <xsl:apply-templates />
109 </fo:block>
110 </xsl:template>
111
112 <!-- Tool name -->
113 <xsl:template match="tool">
114 <fo:block font-family="Helvetica" font-style="normal" font-weight="normal" font-size="18pt" text-align="right">
115 <xsl:apply-templates />
116 </fo:block>
117 </xsl:template>
118
119 <!-- Logo -->
120 <xsl:template match="logo">
121 <xsl:call-template name="image">
122 <xsl:with-param name="name" select="@namepdf" />
123 <xsl:with-param name="height">41pt</xsl:with-param>
124 <xsl:with-param name="width">61pt</xsl:with-param>
125 <xsl:with-param name="align">left</xsl:with-param>
126 </xsl:call-template>
127 </xsl:template>
128
129 <!-- Cover Title -->
130 <xsl:template mode="page" match="booktitle">
131 <fo:block font-family="Helvetica" font-style="normal" font-weight="bold" font-size="36pt">
132 <xsl:apply-templates />
133 </fo:block>
134 <xsl:if test="../titleextension">
135 <fo:block font-family="Helvetica" font-style="normal" font-weight="bold" font-size="36pt">
136 <xsl:apply-templates select="../titleextension" />
137 </fo:block>
138 </xsl:if>
139 </xsl:template>
140
141 <!-- Date -->
142 <xsl:template match="date">
143 <fo:block font-family="Helvetica" font-style="normal" font-weight="normal" font-size="20pt" text-align="right">
144 <xsl:value-of select="$date" />
145 </fo:block>
146 </xsl:template>
147
148 <!-- Cover page -->
149 <xsl:template name="first-page">
150 <fo:page-sequence master-reference="cover">
151 <fo:flow flow-name="xsl-region-body">
152 <fo:block font-family="Helvetica" font-style="normal" font-weight="bold" font-size="36pt" text-align="center">Avertec
153 Tools</fo:block>
154 <fo:block space-after="3cm">
155 <fo:leader leader-pattern="rule" leader-length="17cm" rule-thickness="1pt" />
156 </fo:block>
157 <fo:table table-layout="fixed" width="17cm">
158 <fo:table-column column-width="17cm" />
159 <fo:table-body>
160 <fo:table-row>
161 <fo:table-cell>
162 <fo:block text-align="right">
163 <xsl:apply-templates mode="page" select="//booktitle" />
164 </fo:block>
165 <fo:block text-align="right" space-before="0.8cm" space-after="1.4cm">
166 <fo:external-graphic src="file:{$pictpdf}/Photo_yagle.jpg" height="260pt" width="auto"
167 content-height="220pt" content-width="auto" />
168 </fo:block>
169 </fo:table-cell>
170 </fo:table-row>
171 </fo:table-body>
172 </fo:table>
173 <fo:block space-after="0.1cm">
174 <xsl:apply-templates select="//tool" />
175 </fo:block>
176 <fo:block space-after="2pt">
177 <xsl:apply-templates select="//version" />
178 </fo:block>
179 <fo:block space-after="2.7cm">
180 <xsl:apply-templates select="//date" />
181 </fo:block>
182 <fo:block space-after="0.6cm">
183 <xsl:apply-templates select="//logo" />
184 </fo:block>
185 <fo:block font-family="Helvetica" font-size="14pt" font-style="normal" font-weight="normal" text-align="left"
186 space-after="2pt" break-after="page">
187 <xsl:value-of select="//legal" />
188 </fo:block>
189 </fo:flow>
190 </fo:page-sequence>
191 </xsl:template>
192
193 <!-- ######################################################### -->
194 <!-- # INTRODUCTION # -->
195 <!-- ######################################################### -->
196
197 <!-- page break -->
198 <xsl:template match="introduction">
199 <fo:block break-before="page">
200 <xsl:apply-templates />
201 </fo:block>
202 </xsl:template>
203
204 <xsl:template match="intro">
205 <fo:block font-size="15pt" font-family="Times" font-style="normal" font-weight="normal" text-align="justify">
206 <xsl:apply-templates />
207 </fo:block>
208 <fo:block space-before="12.5cm" text-align="center" font-family="Helvetica" font-size="12pt" font-style="normal"
209 font-weight="normal">Documentation issued and compliant with Avertec Tools Release
210 <xsl:value-of select="$release_num" />.</fo:block>
211 <fo:block space-before="1cm" text-align="center" font-family="Helvetica" font-size="12pt" font-style="normal" font-weight="normal">
212 Please contact support@avertec.com for comments relating to this manual.</fo:block>
213 </xsl:template>
214 <xsl:template match="intro_title">
215 <fo:block text-align="right" space-after="40pt" font-family="Helvetica" font-style="normal" font-weight="bold" font-size="26pt"
216 color="grey">
217 <xsl:apply-templates />
218 </fo:block>
219 </xsl:template>
220
221 <!-- Introduction page -->
222 <xsl:template name="doc-introduction">
223 <fo:page-sequence master-reference="contents" initial-page-number="0">
224 <fo:static-content flow-name="xsl-region-before">
225 <fo:block font-family="Helvetica" font-size="10pt" text-align="right">
226 <xsl:apply-templates mode="banner" select="//booktitle" />
227 </fo:block>
228 <fo:block text-align='center'>
229 <fo:leader leader-pattern="rule" leader-length="17cm" />
230 </fo:block>
231 </fo:static-content>
232 <fo:static-content flow-name="xsl-region-after">
233 <fo:block text-align='center'>
234 <fo:leader leader-pattern="rule" leader-length="17cm" />
235 </fo:block>
236 <fo:block text-align="center">
237 <fo:page-number />
238 </fo:block>
239 </fo:static-content>
240 <fo:flow flow-name="xsl-region-body">
241 <xsl:apply-templates select="//intro_title" />
242 <xsl:apply-templates select="//intro" />
243 </fo:flow>
244 </fo:page-sequence>
245 </xsl:template>
246
247 <!-- ######################################################### -->
248 <!-- # Table of Contents # -->
249 <!-- ######################################################### -->
250
251 <xsl:template name="toc">
252 <fo:block text-align="right" space-after="52pt" id="tof" font-family="Helvetica" font-size="26pt" font-weight="bold" color="grey">
253 Table of Contents</fo:block>
254 <fo:block text-align="justify">
255 <xsl:apply-templates mode="toc" select="//title" />
256 <fo:block space-after="12pt" text-indent="0.3in" text-align-last="justify">
257 <fo:basic-link internal-destination="{generate-id(.)}">Index</fo:basic-link>
258 <fo:leader leader-pattern="dots" />
259 <fo:page-number-citation ref-id="{generate-id(.)}" />
260 </fo:block>
261 </fo:block>
262 </xsl:template>
263
264 <!-- titles -->
265 <xsl:template mode="toc" match="section/title">
266 <xsl:variable name="doc_level" select="../@niv" />
267 <fo:block text-indent="0.3in" text-align-last="justify">
268 <fo:basic-link internal-destination="{generate-id(.)}">
269 <xsl:call-template name="title_num">
270 <xsl:with-param name="level" select="$doc_level" />
271 <xsl:with-param name="type" select="toc" />
272 </xsl:call-template>
273 </fo:basic-link>
274 <fo:leader leader-pattern="dots" />
275 <fo:page-number-citation ref-id="{generate-id(.)}" />
276 </fo:block>
277 </xsl:template>
278
279 <!-- ######################################################### -->
280 <!-- # Title Numbering # -->
281 <!-- ######################################################### -->
282
283 <xsl:template name="title_num">
284 <xsl:param name="level" select="1" />
285 <xsl:param name="type" select="doc" />
286 <xsl:choose>
287 <xsl:when test="$level = 1"><xsl:number count="//section[@niv='1']/title" level="any"/>.<xsl:text> </xsl:text></xsl:when>
288 <xsl:when test="$level = 2"><xsl:number count="//section[@niv='1']/title" level="any"/>.<xsl:number count="//section[@niv='2']/title" from="//section[@niv='1']" level="any"/>. </xsl:when>
289 <xsl:when test="$level = 3"><xsl:number count="//section[@niv='1']/title" level="any"/>.<xsl:number count="//section[@niv='2']/title" from="//section[@niv='1']" level="any"/>.<xsl:number count="//section[@niv='3']/title" from="//section[@niv='2']" level="any" format="1"/>. </xsl:when>
290 </xsl:choose>
291 <xsl:choose>
292 <xsl:when test="$type = toc">
293 <xsl:choose>
294 <xsl:when test="not(./index)">
295 <xsl:apply-templates />
296 </xsl:when>
297 <xsl:otherwise>
298 <xsl:apply-templates mode="toc" select="./index" />
299 </xsl:otherwise>
300 </xsl:choose>
301 </xsl:when>
302 <xsl:otherwise>
303 <xsl:choose>
304 <xsl:when test="not(./index)">
305 <xsl:value-of select="." />
306 </xsl:when>
307 <xsl:otherwise>
308 <xsl:apply-templates mode="title" select="./index" />
309 </xsl:otherwise>
310 </xsl:choose>
311 </xsl:otherwise>
312 </xsl:choose>
313 </xsl:template>
314
315 <!-- ######################################################### -->
316 <!-- # Index # -->
317 <!-- ######################################################### -->
318
319 <!-- Index des variables dans le document / plusieurs mod disponibles -->
320 <xsl:template mode="title" match="//index">
321 <xsl:value-of select="text()" />
322 </xsl:template>
323 <xsl:template mode="toc" match="//index">
324 <fo:block text-indent="0.3in" text-align-last="justify">
325 <fo:basic-link internal-destination="{generate-id(.)}">
326 <xsl:value-of select="text()" />
327 </fo:basic-link>
328 <fo:leader leader-pattern="dots" />
329 <fo:page-number-citation ref-id="{generate-id(.)}" />
330 </fo:block>
331 </xsl:template>
332 <xsl:template mode="iov" match="//index">
333 <fo:block space-after="10pt" text-align-last="justify" text-indent="0.6in" font-weight="bold" font-style="normal">
334 <xsl:choose>
335 <xsl:when test="../../title">
336 <fo:basic-link internal-destination="{generate-id(..)}">
337 <xsl:apply-templates />
338 </fo:basic-link>
339 <fo:leader leader-pattern="dots" />
340 <fo:page-number-citation ref-id="{generate-id(..)}" />
341 </xsl:when>
342 <xsl:otherwise>
343 <fo:basic-link internal-destination="{generate-id(.)}">
344 <xsl:apply-templates />
345 </fo:basic-link>
346 <fo:leader leader-pattern="dots" />
347 <fo:page-number-citation ref-id="{generate-id(.)}" />
348 </xsl:otherwise>
349 </xsl:choose>
350 </fo:block>
351 </xsl:template>
352 <xsl:template match="//index">
353 <xsl:param name="in">
354 <fo:page-number />
355 </xsl:param>
356 <xsl:value-of select="item[number($in)]" />
357 <fo:block id="{generate-id(.)}">
358 <xsl:apply-templates />
359 </fo:block>
360 </xsl:template>
361
362 <!-- Mise en forme de l'index -->
363 <xsl:template name="doc_index">
364 <fo:block break-before="page" text-align="right" space-after="52pt" id="iov" font-family="Helvetica" font-size="16pt"
365 font-weight="bold">
366 <fo:block font-family="Times" font-style="normal" font-weight="bold" id="{generate-id(.)}">Index</fo:block>
367 </fo:block>
368 <xsl:if test="//index">
369 <fo:block text-align="justify">
370 <xsl:apply-templates mode="iov" select="//index">
371 <xsl:sort order="ascending" data-type="text" case-order="upper-first" lang="en" />
372 </xsl:apply-templates>
373 </fo:block>
374 </xsl:if>
375 <xsl:if test="not(//index)">
376 <fo:block space-before="4.5cm" text-align="center" font-family="Helvetica" font-style="normal" font-weight="bold"
377 font-size="12pt">No index for this document.</fo:block>
378 </xsl:if>
379 </xsl:template>
380
381 <!-- ######################################################### -->
382 <!-- # MAIN PART # -->
383 <!-- ######################################################### -->
384
385 <xsl:template name="book">
386 <fo:page-sequence master-reference="contents">
387 <fo:static-content flow-name="xsl-region-before">
388 <fo:block font-family="Helvetica" font-size="10pt" text-align="right">
389 <xsl:apply-templates mode="banner" select="//booktitle" />
390 </fo:block>
391 <fo:block text-align='center'>
392 <fo:leader leader-pattern="rule" leader-length="17cm" />
393 </fo:block>
394 </fo:static-content>
395 <fo:static-content flow-name="xsl-region-after">
396 <fo:block text-align='center'>
397 <fo:leader leader-pattern="rule" leader-length="17cm" />
398 </fo:block>
399 <fo:block text-align="center">
400 <fo:page-number />
401 </fo:block>
402 </fo:static-content>
403 <fo:flow flow-name="xsl-region-body">
404 <xsl:call-template name="toc" />
405 <xsl:apply-templates select="//chapter" />
406 <xsl:call-template name="doc_index" />
407 </fo:flow>
408 </fo:page-sequence>
409 </xsl:template>
410
411 <!-- ######################################################### -->
412 <!-- # HEADINGS # -->
413 <!-- ######################################################### -->
414
415 <!-- pagebreak on new chapter -->
416 <xsl:template match="chapter">
417 <fo:block break-before="page">
418 <xsl:apply-templates />
419 </fo:block>
420 </xsl:template>
421
422 <!-- sections -->
423 <xsl:template match="section">
424 <xsl:choose>
425 <xsl:when test="@niv &lt; 6">
426 <fo:block>
427 <xsl:apply-templates />
428 </fo:block>
429 </xsl:when>
430 <xsl:otherwise>
431 <fo:block keep-together.within-page="always">
432 <xsl:apply-templates />
433 </fo:block>
434 </xsl:otherwise>
435 </xsl:choose>
436 </xsl:template>
437
438 <!-- titles -->
439 <xsl:template match="section/title">
440 <xsl:param name="n">
441 <fo:page-number />
442 </xsl:param>
443 <xsl:variable name="doc_level" select="../@niv" />
444 <xsl:choose>
445 <xsl:when test="$doc_level = 1">
446 <fo:block id="{generate-id(.)}" space-before="18pt" space-after="36pt" font-family="Helvetica" color="grey"
447 font-size="26pt" font-style="normal" font-weight="bold" text-align="left" keep-with-next.within-page="always">Chapter
448 <xsl:call-template name="title_num">
449 <xsl:with-param name="level" select="$doc_level" />
450 <xsl:with-param name="type" select="doc" />
451 </xsl:call-template></fo:block>
452 <xsl:value-of select="item[number($n)]" />
453 </xsl:when>
454 <xsl:when test="$doc_level = 2">
455 <fo:block id="{generate-id(.)}" space-before="14pt" space-after="14pt" font-family="Helvetica" color="grey"
456 font-size="20pt" font-style="normal" font-weight="bold" text-align="left" keep-with-next.within-page="always">
457 <xsl:call-template name="title_num">
458 <xsl:with-param name="level" select="$doc_level" />
459 <xsl:with-param name="type" select="doc" />
460 </xsl:call-template>
461 </fo:block>
462 </xsl:when>
463 <xsl:when test="$doc_level = 3">
464 <fo:block id="{generate-id(.)}" space-before="10pt" space-after="10pt" font-family="Helvetica" font-size="16pt"
465 font-style="normal" font-weight="bold" text-align="left" keep-with-next.within-page="always">
466 <xsl:call-template name="title_num">
467 <xsl:with-param name="level" select="$doc_level" />
468 <xsl:with-param name="type" select="doc" />
469 </xsl:call-template>
470 </fo:block>
471 </xsl:when>
472 <xsl:when test="$doc_level = 4">
473 <fo:block id="{generate-id(.)}" space-before="8pt" space-after="8pt" font-family="Helvetica" font-size="12pt"
474 font-style="normal" font-weight="bold" text-align="left" keep-with-next.within-page="always">
475 <xsl:call-template name="title_num">
476 <xsl:with-param name="level" select="$doc_level" />
477 <xsl:with-param name="type" select="doc" />
478 </xsl:call-template>
479 </fo:block>
480 </xsl:when>
481 </xsl:choose>
482 </xsl:template>
483
484 <!-- ######################################################### -->
485 <!-- # List Styles # -->
486 <!-- ######################################################### -->
487
488 <!-- Array with article and 2-line definition -->
489 <xsl:template priority="1" match="//row[@type='split']">
490 <fo:table-row start-indent="0cm" keep-with-next.within-page="always">
491 <fo:table-cell number-columns-spanned="2">
492 <fo:block font-family="Times" text-align="justify" font-style="normal" font-weight="bold">
493 <xsl:apply-templates select="article" />
494 </fo:block>
495 </fo:table-cell>
496 </fo:table-row>
497 <fo:table-row start-indent="0cm">
498 <fo:table-cell column-number="2" padding-after="10pt">
499 <fo:block font-family="Times" text-align="justify" font-style="normal" font-weight="normal" space-after.optimum="10pt">
500 <xsl:apply-templates select="def" />
501 </fo:block>
502 </fo:table-cell>
503 </fo:table-row>
504 </xsl:template>
505
506 <!-- Defaulted array lines -->
507 <xsl:template match="//row">
508 <fo:table-row start-indent="0cm">
509 <fo:table-cell padding-after="10pt">
510 <fo:block font-family="Times" text-align="justify" font-style="normal" font-weight="bold">
511 <xsl:apply-templates select="article" />
512 </fo:block>
513 </fo:table-cell>
514 <fo:table-cell padding-after="10pt">
515 <fo:block font-family="Times" text-align="justify" font-style="normal" font-weight="normal" space-after.optimum="10pt">
516 <xsl:apply-templates select="def" />
517 </fo:block>
518 </fo:table-cell>
519 </fo:table-row>
520 </xsl:template>
521
522 <!-- Array lines displaying a picture as article -->
523 <xsl:template mode="button" match="//row">
524 <fo:table-row start-indent="0cm">
525 <fo:table-cell>
526 <fo:block text-align="right" font-family="Times" font-style="normal" font-weight="bold" vertical-align="middle">
527 <xsl:apply-templates select="article" />
528 </fo:block>
529 </fo:table-cell>
530 <fo:table-cell>
531 <fo:block text-align="justify" font-family="Times" font-style="normal" font-weight="normal" space-before="12pt"
532 vertical-align="middle">
533 <xsl:apply-templates select="def" />
534 </fo:block>
535 </fo:table-cell>
536 </fo:table-row>
537 </xsl:template>
538
539 <!-- List -->
540 <xsl:template match="//list">
541 <fo:block space-before="6pt" space-after="6pt">
542 <xsl:apply-templates select="article" />
543 <fo:list-block start-indent="1cm">
544 <xsl:apply-templates select="item" />
545 </fo:list-block>
546 </fo:block>
547 </xsl:template>
548
549 <!-- List within a array -->
550 <xsl:template mode="table" match="//list">
551 <fo:block space-before="6pt" space-after="6pt" keep-together="always">
552 <xsl:apply-templates select="article" />
553 <fo:list-block>
554 <xsl:apply-templates mode="table" select="item" />
555 </fo:list-block>
556 </fo:block>
557 </xsl:template>
558
559 <!-- Items of a list within a array -->
560 <xsl:template mode="table" match="item">
561 <fo:list-item space-before="4pt">
562 <fo:list-item-label>
563 <fo:block>
564 <xsl:text>&#8226;</xsl:text>
565 </fo:block>
566 </fo:list-item-label>
567 <fo:list-item-body>
568 <fo:block font-family="Times" text-align="justify" font-weight="normal" font-style="normal">
569 <xsl:apply-templates />
570 </fo:block>
571 </fo:list-item-body>
572 </fo:list-item>
573 </xsl:template>
574
575 <!-- Items of an indented list -->
576 <xsl:template match="item">
577 <fo:list-item space-before="4pt">
578 <fo:list-item-label>
579 <fo:block>
580 <xsl:text>&#8226;</xsl:text>
581 </fo:block>
582 </fo:list-item-label>
583 <fo:list-item-body>
584 <fo:block start-indent="0.6in" font-family="Times" text-align="justify" font-weight="normal" font-style="normal">
585 <xsl:apply-templates />
586 </fo:block>
587 </fo:list-item-body>
588 </fo:list-item>
589 </xsl:template>
590
591 <!-- Glossary -->
592 <xsl:template match="//glossary">
593 <xsl:if test="./row[@type='half']">
594 <fo:block space-before="12pt">
595 <fo:table table-layout="fixed" width="16cm" start-indent="1cm">
596 <fo:table-column column-width="8cm" />
597 <fo:table-column column-width="8cm" />
598 <fo:table-body>
599 <xsl:apply-templates />
600 </fo:table-body>
601 </fo:table>
602 </fo:block>
603 </xsl:if>
604 <xsl:if test="./row[@type='split']">
605 <fo:block space-before="6pt" space-after="6pt">
606 <fo:table table-layout="fixed" width="16cm" start-indent="1cm">
607 <fo:table-column column-width="1.5cm" />
608 <fo:table-column column-width="14.5cm" />
609 <fo:table-body>
610 <xsl:apply-templates />
611 </fo:table-body>
612 </fo:table>
613 </fo:block>
614 </xsl:if>
615 <xsl:if test="not(./row[@type='half']) and not (./row[@type='split'])">
616 <fo:block space-before="6pt" space-after="6pt">
617 <fo:table table-layout="fixed" width="16cm" start-indent="1cm">
618 <fo:table-column column-width="6cm" />
619 <fo:table-column column-width="10cm" />
620 <fo:table-body>
621 <xsl:apply-templates />
622 </fo:table-body>
623 </fo:table>
624 </fo:block>
625 </xsl:if>
626 </xsl:template>
627
628 <!-- Definition de table / format reduit -->
629 <xsl:template priority="1" match="//glossary[@width='small']">
630 <fo:block space-before="6pt" keep-together.within-page="always">
631 <fo:table table-layout="fixed" width="14.5cm">
632 <fo:table-column column-width="3.5cm" />
633 <fo:table-column column-width="11cm" />
634 <fo:table-body>
635 <xsl:apply-templates />
636 </fo:table-body>
637 </fo:table>
638 </fo:block>
639 </xsl:template>
640 <xsl:template priority="1" match="//glossary[@width='small2']">
641 <fo:block space-before="6pt" keep-together.within-page="always">
642 <fo:table table-layout="fixed" width="14.5cm">
643 <fo:table-column column-width="5.5cm" />
644 <fo:table-column column-width="9cm" />
645 <fo:table-body>
646 <xsl:apply-templates />
647 </fo:table-body>
648 </fo:table>
649 </fo:block>
650 </xsl:template>
651
652 <!-- article d'un tableau -->
653 <xsl:template match="article">
654 <fo:block id="{generate-id(.)}" font-family="Times" font-style="normal" font-weight="bold">
655 <xsl:apply-templates />
656 </fo:block>
657 </xsl:template>
658
659 <!-- partie gauche d'un tableau -->
660 <xsl:template match="def">
661 <fo:block font-family="Times" font-style="normal" font-weight="normal">
662 <xsl:apply-templates />
663 </fo:block>
664 </xsl:template>
665
666 <!-- ######################################################### -->
667 <!-- # Text Styles # -->
668 <!-- ######################################################### -->
669
670 <!-- page blanche en fin de document -->
671 <xsl:template match="//last">
672 <fo:block break-before="page" text-align="center">
673 <xsl:apply-templates />
674 </fo:block>
675 </xsl:template>
676
677 <!-- Saut de page force -->
678 <xsl:template match="//pagebreak">
679 <fo:block break-after="page">
680 <xsl:apply-templates />
681 </fo:block>
682 </xsl:template>
683
684 <!-- Paragraphe -->
685 <xsl:template match="//d">
686 <fo:block start-indent="0.4in" space-after="12pt" space-before="12pt" font-family="Times" font-size="12pt" font-style="normal"
687 font-weight="normal" text-align="justify" keep-together.within-page="always">
688 <xsl:apply-templates />
689 </fo:block>
690 </xsl:template>
691
692 <!-- Paragraphe -->
693 <xsl:template match="//p">
694 <fo:block space-after="6pt" font-family="Times" font-size="12pt" font-style="normal" font-weight="normal" text-align="justify"
695 keep-together.within-page="always">
696 <xsl:apply-templates />
697 </fo:block>
698 </xsl:template>
699
700 <!-- Paragraphe -->
701 <xsl:template match="//br">
702 <fo:block></fo:block>
703 <xsl:apply-templates />
704 </xsl:template>
705
706 <!-- Titre de l'ouvrage en-tete/pied de page -->
707 <xsl:template mode="banner" match="booktitle">
708 <fo:block font-family="Helvetica" font-style="normal" font-weight="normal" font-size="12pt">
709 <xsl:apply-templates />
710 <xsl:if test="../titleextension">&#160;
711 <xsl:apply-templates select="../titleextension" /></xsl:if>
712 </fo:block>
713 </xsl:template>
714
715 <!-- ligne d'un code / conserve la mise en forme -->
716 <xsl:template match="//cl">
717 <fo:block white-space="pre">
718 <xsl:apply-templates />
719 </fo:block>
720 </xsl:template>
721
722 <!-- Delimite une partie de code deja mis en forme / defaut est identique a type=box -->
723 <xsl:template match="//bnf">
724 <fo:block font-family="Courier" font-size="10pt" space-after="12pt" font-style="normal" font-weight="normal" color="blue"
725 start-indent="0.4in" space-before="12pt" keep-together="always">
726 <fo:block>
727 <xsl:apply-templates />
728 </fo:block>
729 </fo:block>
730 </xsl:template>
731
732 <!-- Delimite une partie de code deja mis en forme / defaut est identique a type=box -->
733 <xsl:template match="//code">
734 <fo:block font-family="Courier" font-size="9pt" space-after="12pt" font-style="normal" font-weight="normal" start-indent="0.4in"
735 space-before="12pt" widows="4" orphans="4">
736 <fo:block>
737 <xsl:apply-templates />
738 </fo:block>
739 </fo:block>
740 </xsl:template>
741
742 <!-- Delimite une partie de code deja mis en forme / defaut est identique a type=box -->
743 <xsl:template match="//smallcode">
744 <fo:block font-family="Courier" font-size="8pt" space-after="12pt" font-style="normal" font-weight="normal" space-before="12pt"
745 widows="4" orphans="4">
746 <fo:block>
747 <xsl:apply-templates />
748 </fo:block>
749 </fo:block>
750 </xsl:template>
751
752 <!-- partie document / positionnement d'indentation et de font size par defaut du document -->
753 <xsl:template match="document">
754 <xsl:apply-templates />
755 </xsl:template>
756
757 <!-- mise en forme dans une ligne -->
758 <xsl:template match="//f">
759 <fo:inline font-family="Courier" font-size="10pt" font-style="normal" font-weight="normal">
760 <xsl:apply-templates />
761 </fo:inline>
762 </xsl:template>
763
764 <!-- mise en forme dans une ligne -->
765 <xsl:template match="//b">
766 <fo:inline font-family="Helvetica" font-size="11pt" font-style="normal" font-weight="bold">
767 <xsl:apply-templates />
768 </fo:inline>
769 </xsl:template>
770
771 <!-- ######################################################### -->
772 <!-- # FUNCTIONS # -->
773 <!-- ######################################################### -->
774
775 <xsl:template match="//functions">
776 <fo:block space-before="12pt">
777 <fo:table table-layout="fixed" width="17cm">
778 <fo:table-column column-width="17cm" />
779 <fo:table-body>
780 <xsl:for-each select="func">
781 <!-- funcname -->
782 <fo:table-row>
783 <fo:table-cell padding-before="12pt">
784 <fo:block font-family="Courier" font-style="normal" font-size="13pt" font-weight="bold"
785 text-align="left" space-before="12pt">
786 <xsl:apply-templates select="funcname" />
787 </fo:block>
788 </fo:table-cell>
789 </fo:table-row>
790 <!-- proto -->
791 <fo:table-row>
792 <fo:table-cell padding-before="12pt">
793 <fo:block font-family="Courier" font-style="normal" font-size="11pt" font-weight="normal"
794 text-align="left" space-before="12pt">
795 <xsl:apply-templates select="proto" />
796 </fo:block>
797 </fo:table-cell>
798 </fo:table-row>
799 <!-- desc -->
800 <fo:table-row>
801 <fo:table-cell>
802 <fo:table table-layout="fixed" width="17cm">
803 <fo:table-column column-width="4.5cm" />
804 <fo:table-column column-width="12.5cm" />
805 <fo:table-body>
806 <fo:table-row>
807 <fo:table-cell column-number="2" padding-before="12pt">
808 <fo:block font-family="Times" font-style="italic" font-weight="normal" text-align="justify"
809 space-before="12pt">
810 <xsl:apply-templates select="desc" />
811 </fo:block>
812 </fo:table-cell>
813 </fo:table-row>
814 </fo:table-body>
815 </fo:table>
816 </fo:table-cell>
817 </fo:table-row>
818 <!-- arg + argdef-->
819 <xsl:for-each select="arg">
820 <fo:table-row>
821 <fo:table-cell>
822 <fo:table table-layout="fixed" width="17cm">
823 <fo:table-column column-width="4.5cm" />
824 <fo:table-column column-width="12.5cm" />
825 <fo:table-body>
826 <fo:table-row>
827 <fo:table-cell padding-before="12pt">
828 <fo:block font-family="Courier" font-size="11pt" font-style="normal"
829 font-weight="normal" text-align="justify" space-before="12pt">
830 <xsl:apply-templates select="argn" />
831 </fo:block>
832 </fo:table-cell>
833 <fo:table-cell padding-before="12pt">
834 <fo:block font-family="Times" font-style="normal" font-weight="normal"
835 text-align="justify" space-before="12pt">
836 <xsl:apply-templates select="argdef" />
837 </fo:block>
838 </fo:table-cell>
839 </fo:table-row>
840 </fo:table-body>
841 </fo:table>
842 </fo:table-cell>
843 </fo:table-row>
844 </xsl:for-each>
845 <!-- line -->
846 <fo:table-row>
847 <fo:table-cell>
848 <fo:block text-align='right' space-after="12pt">
849 <fo:leader leader-pattern="rule" leader-length="17cm" />
850 </fo:block>
851 </fo:table-cell>
852 </fo:table-row>
853 </xsl:for-each>
854 </fo:table-body>
855 </fo:table>
856 </fo:block>
857 </xsl:template>
858
859 <!-- ######################################################### -->
860 <!-- # ERROR MESSAGES # -->
861 <!-- ######################################################### -->
862 <!-- Delimite un message d'erreur -->
863 <xsl:template match="//messages">
864 <xsl:choose>
865 <xsl:when test="./err/num = ''">
866 <fo:block space-before="12pt" font-family="Times" font-style="italic" font-weight="normal" text-align="center">Error
867 messages description not available yet.</fo:block>
868 </xsl:when>
869 <xsl:otherwise>
870 <fo:block space-before="12pt">
871 <fo:table table-layout="fixed" width="17cm">
872 <fo:table-column column-width="17cm" />
873 <fo:table-body>
874 <xsl:for-each select="err">
875 <xsl:variable name="msg_buf" select="msg" />
876 <fo:table-row>
877 <fo:table-cell>
878 <fo:table table-layout="fixed" width="17cm">
879 <fo:table-column column-width="3cm" />
880 <fo:table-column column-width="14cm" />
881 <fo:table-body>
882 <fo:table-row>
883 <fo:table-cell>
884 <fo:block font-family="Courier" font-size="10pt" font-style="normal"
885 font-weight="normal" text-align="justify">
886 <xsl:apply-templates select="lib" />
887 <xsl:apply-templates select="num" />
888 </fo:block>
889 </fo:table-cell>
890 <fo:table-cell>
891 <fo:block font-family="Courier" font-size="10pt" font-style="normal"
892 font-weight="normal" text-align="justify">
893 <xsl:for-each select="tokenize(msg,'\\n')">
894 <fo:block>
895 <xsl:for-each select="tokenize(.,'\\t')">
896 <xsl:for-each select="replace(.,'%s','&lt;string&gt;')">
897 <xsl:for-each select="replace(.,'%d','&lt;decimal&gt;')">
898 <xsl:for-each select="replace(.,'%i','&lt;integer&gt;')">
899 <xsl:for-each select="replace(.,'%c','&lt;character&gt;')">
900 <xsl:value-of select="." />
901 </xsl:for-each>
902 </xsl:for-each>
903 </xsl:for-each>
904 </xsl:for-each>
905 </xsl:for-each>
906 </fo:block>
907 </xsl:for-each>
908 </fo:block>
909 </fo:table-cell>
910 </fo:table-row>
911 </fo:table-body>
912 </fo:table>
913 </fo:table-cell>
914 </fo:table-row>
915 <fo:table-row>
916 <fo:table-cell>
917 <fo:table table-layout="fixed" width="17cm">
918 <fo:table-column column-width="3cm" />
919 <fo:table-column column-width="14cm" />
920 <fo:table-body>
921 <fo:table-row>
922 <fo:table-cell column-number="2">
923 <fo:block font-family="Times" font-style="normal" font-weight="normal"
924 text-align="justify" space-before="12pt">
925 <xsl:apply-templates select="doc" />
926 </fo:block>
927 </fo:table-cell>
928 </fo:table-row>
929 </fo:table-body>
930 </fo:table>
931 </fo:table-cell>
932 </fo:table-row>
933 <fo:table-row>
934 <fo:table-cell>
935 <fo:block text-align='right' space-after="12pt">
936 <fo:leader leader-pattern="rule" leader-length="17cm" />
937 </fo:block>
938 </fo:table-cell>
939 </fo:table-row>
940 </xsl:for-each>
941 </fo:table-body>
942 </fo:table>
943 </fo:block>
944 </xsl:otherwise>
945 </xsl:choose>
946 </xsl:template>
947
948 <!-- ######################################################### -->
949 <!-- # Images # -->
950 <!-- ######################################################### -->
951
952 <!-- Image hauteur (H) imposee -->
953 <xsl:template match="//imgHsize">
954 <xsl:call-template name="image">
955 <xsl:with-param name="name" select="@namepdf" />
956 <xsl:with-param name="height" select="@hpdf" />
957 <xsl:with-param name="align">center</xsl:with-param>
958 </xsl:call-template>
959 </xsl:template>
960
961 <!-- Images avec tailles predefinie en fonction des attributs -->
962 <xsl:template match="//imgfix">
963 <xsl:call-template name="image">
964 <xsl:with-param name="name" select="@ref" />
965 <xsl:with-param name="height">39pt</xsl:with-param>
966 <xsl:with-param name="width">39pt</xsl:with-param>
967 <xsl:with-param name="align">center</xsl:with-param>
968 </xsl:call-template>
969 </xsl:template>
970
971 <!-- Image hauteur (H) et largeur (W) imposees -->
972 <xsl:template match="//imgsize">
973 <xsl:call-template name="image">
974 <xsl:with-param name="name" select="@namepdf" />
975 <xsl:with-param name="height" select="@hpdf" />
976 <xsl:with-param name="width" select="@wpdf" />
977 <xsl:with-param name="align">center</xsl:with-param>
978 </xsl:call-template>
979 </xsl:template>
980
981 <!-- Affichage des images en fonction des attributs disponibles -->
982 <xsl:template name="image">
983 <xsl:param name="name" />
984 <xsl:param name="width" />
985 <xsl:param name="height" />
986 <xsl:param name="align" select="center" />
987 <fo:block text-align="{$align}" space-before="12pt" space-after="12pt">
988 <xsl:choose>
989 <xsl:when test="not( $width and $height )">
990 <xsl:choose>
991 <xsl:when test="$width">
992 <fo:external-graphic src="file:{$pictpdf}/{$name}" scaling="uniform" height="auto" width="{$width}"
993 content-height="auto" content-width="{$width}" />
994 </xsl:when>
995 <xsl:when test="$height">
996 <fo:external-graphic src="file:{$pictpdf}/{$name}" scaling="uniform" height="{$height}" width="auto"
997 content-height="{$height}" content-width="auto" />
998 </xsl:when>
999 <xsl:otherwise>
1000 <fo:external-graphic src="file:{$pictpdf}/{$name}" scaling="uniform" height="auto" width="auto"
1001 content-height="auto" content-width="auto" />
1002 </xsl:otherwise>
1003 </xsl:choose>
1004 </xsl:when>
1005 <xsl:otherwise>
1006 <fo:external-graphic src="file:{$pictpdf}/{$name}" height="{$height}" width="{$width}" content-height="{$height}"
1007 content-width="{$width}" />
1008 </xsl:otherwise>
1009 </xsl:choose>
1010 </fo:block>
1011 </xsl:template>
1012
1013 <!-- ######################################################### -->
1014 <!-- # FAQ # -->
1015 <!-- ######################################################### -->
1016
1017 <xsl:template match="//faq[@link]">
1018 <xsl:variable name="itarget"><xsl:value-of select="./@link"/></xsl:variable>
1019 <xsl:for-each select="//faq[@id]">
1020 <xsl:variable name="faqid"><xsl:number count="index" from="//glossary" level="any"/></xsl:variable>
1021 <xsl:if test="number($itarget) = number($faqid)">
1022 <fo:basic-link internal-destination="{generate-id(..)}">
1023 <fo:inline font-family="Times" font-style="normal" font-weight="bold">Q<xsl:value-of select="$faqid"/></fo:inline>
1024 </fo:basic-link>
1025 </xsl:if>
1026 </xsl:for-each>
1027 </xsl:template>
1028
1029 <xsl:template match="faq">
1030 <xsl:variable name="locid"><xsl:number count="index" from="//glossary" level="any"/></xsl:variable>
1031 Q<xsl:value-of select="$locid"/> :
1032 </xsl:template>
1033
1034 </xsl:stylesheet>