root/tags/lgt2211/xml/lgtpdfa4.xsl

Revision 1513, 11.1 KB (checked in by pmoura, 4 years ago)

Updated release number to 2.21.1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<xsl:stylesheet
3    version="1.0"
4    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5    xmlns:fo="http://www.w3.org/1999/XSL/Format">
6
7
8<!--
9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10%
11%  Logtalk - Object oriented extension to Prolog
12%  Release 2.21.1
13%
14%  Copyright (c) 1998-2004 Paulo Moura.  All Rights Reserved.
15%
16%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17-->
18
19
20<xsl:output indent="yes"/>
21
22
23<xsl:template match ="/">
24
25    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
26
27        <fo:layout-master-set>
28            <fo:simple-page-master
29                    master-name="simple"
30                    page-height="297mm" 
31                    page-width="210mm"
32                    margin-top="15mm" 
33                    margin-bottom="15mm" 
34                    margin-left="25mm" 
35                    margin-right="25mm">
36                <fo:region-body margin-top="15mm" margin-bottom="15mm"/>
37                <fo:region-before extent="15mm"/>
38                <fo:region-after extent="15mm"/>
39            </fo:simple-page-master>
40        </fo:layout-master-set>
41
42        <fo:page-sequence master-reference="simple">
43       
44            <fo:static-content flow-name="xsl-region-before">
45                <fo:block>
46                    <fo:leader leader-pattern="rule" leader-length.optimum="100%"/>
47                </fo:block>
48                <fo:block
49                        text-align="end" 
50                        font-size="9pt" 
51                        font-family="sans-serif"
52                        font-weight="bold">
53                    <xsl:value-of select="logtalk/entity/type"/>: <xsl:value-of select="logtalk/entity/name"/>
54                </fo:block>
55            </fo:static-content> 
56
57            <fo:static-content flow-name="xsl-region-after">
58                <fo:block>
59                    <fo:leader leader-pattern="rule" leader-length.optimum="100%"/>
60                </fo:block>
61                <fo:block
62                        text-align="end" 
63                        font-size="9pt" 
64                        font-family="sans-serif"
65                        font-weight="bold">
66                    <fo:page-number/> of <fo:page-number-citation ref-id="end"/>
67                </fo:block>
68            </fo:static-content> 
69   
70            <fo:flow flow-name="xsl-region-body">
71                <fo:block
72                        font-size="18pt" 
73                        font-family="sans-serif" 
74                        font-weight="bold"
75                        space-after="8pt">
76                    <xsl:value-of select="logtalk/entity/name"/>
77                </fo:block>
78                <xsl:apply-templates select="logtalk/entity"/>
79                <xsl:apply-templates select="logtalk/relations"/>
80                <xsl:apply-templates select="logtalk/predicates"/>
81                <fo:block id="end"/>
82            </fo:flow>
83
84        </fo:page-sequence>
85
86    </fo:root>
87
88</xsl:template>
89
90
91<xsl:template match="logtalk/entity">
92
93    <xsl:if test="comment">
94        <fo:block
95                margin-left="10mm"
96                font-size="10pt"
97                font-family="serif" 
98                font-style="italic" 
99                space-after="8pt">
100            <xsl:value-of select="comment"/>
101        </fo:block>
102    </xsl:if>
103
104    <xsl:if test="author">
105        <fo:block
106                font-size="10pt"
107                font-family="serif" 
108                keep-with-next="always">
109            author:
110        </fo:block>
111        <fo:block
112                font-size="9pt"
113                font-family="monospace"
114                margin-left="10mm">
115            <xsl:value-of select="author"/>
116        </fo:block>
117    </xsl:if>
118
119    <xsl:if test="version">
120        <fo:block
121                font-size="10pt"
122                font-family="serif" 
123                keep-with-next="always">
124            version:
125        </fo:block>
126        <fo:block
127                font-size="9pt"
128                font-family="monospace"
129                margin-left="10mm">
130            <xsl:value-of select="version"/>
131        </fo:block>
132    </xsl:if>
133
134    <xsl:if test="date">
135        <fo:block
136                font-size="10pt"
137                font-family="serif" 
138                keep-with-next="always">
139            date:
140        </fo:block>
141        <fo:block
142                font-size="9pt"
143                font-family="monospace"
144                margin-left="10mm">
145            <xsl:value-of select="date"/>
146        </fo:block>
147    </xsl:if>
148
149    <fo:block
150            font-size="10pt"
151            font-family="serif"
152            space-before="8pt"
153            keep-with-next="always">
154        compilation:
155    </fo:block>
156    <fo:block
157            font-size="9pt"
158            font-family="monospace"
159            margin-left="10mm" 
160            space-after="8pt">
161        <xsl:value-of select="compilation"/>
162    </fo:block>
163
164    <xsl:if test="info">
165        <xsl:for-each select="info">
166            <fo:block
167                    font-size="10pt"
168                    font-family="serif" 
169                    keep-with-next="always">
170                <xsl:value-of select="key"/>:
171            </fo:block>
172            <fo:block
173                    font-size="9pt"
174                    font-family="monospace"
175                    margin-left="10mm">
176                <xsl:value-of select="value"/>
177            </fo:block>
178        </xsl:for-each>
179    </xsl:if>
180
181</xsl:template>
182
183
184<xsl:template match="logtalk/relations">
185    <xsl:choose>
186        <xsl:when test="*">
187            <xsl:if test="implements">
188                <fo:block
189                        font-size="10pt"
190                        font-family="serif" 
191                        keep-with-next="always">
192                    implements:
193                </fo:block>
194                <xsl:apply-templates select="implements"/>
195            </xsl:if>
196            <xsl:if test="imports">
197                <fo:block
198                        font-size="10pt"
199                        font-family="serif" 
200                        keep-with-next="always">
201                    imports:
202                </fo:block>
203                <xsl:apply-templates select="imports"/>
204            </xsl:if>
205            <xsl:if test="extends">
206                <fo:block
207                        font-size="10pt"
208                        font-family="serif" 
209                        keep-with-next="always">
210                    extends:
211                </fo:block>
212                <xsl:apply-templates select="extends"/>
213            </xsl:if>
214            <xsl:if test="instantiates">
215                <fo:block
216                        font-size="10pt"
217                        font-family="serif" 
218                        keep-with-next="always">
219                    instantiates:
220                </fo:block>
221                <xsl:apply-templates select="instantiates"/>
222            </xsl:if>
223            <xsl:if test="specializes">
224                <fo:block
225                        font-size="10pt"
226                        font-family="serif" 
227                        keep-with-next="always">
228                    specializes:
229                </fo:block>
230                <xsl:apply-templates select="specializes"/>
231            </xsl:if>
232            <xsl:if test="uses">
233                <fo:block
234                        font-size="10pt"
235                        font-family="serif" 
236                        keep-with-next="always">
237                    uses:
238                </fo:block>
239                <xsl:apply-templates select="uses"/>
240            </xsl:if>
241            <xsl:if test="calls">
242                <fo:block
243                        font-size="10pt"
244                        font-family="serif" 
245                        keep-with-next="always">
246                    calls:
247                </fo:block>
248                <xsl:apply-templates select="calls"/>
249            </xsl:if>
250        </xsl:when>
251        <xsl:otherwise> 
252            <fo:block
253                    font-size="10pt"
254                    font-family="serif" 
255                    keep-with-next="always">
256                (no dependencies on other files)
257            </fo:block>
258        </xsl:otherwise>
259    </xsl:choose>
260</xsl:template>
261
262
263<xsl:template match="logtalk/relations/uses">
264    <fo:block
265            font-size="9pt"
266            font-family="monospace"
267            margin-left="10mm">
268        <xsl:value-of select="name"/>
269    </fo:block>
270</xsl:template>
271
272
273<xsl:template match="logtalk/relations/calls">
274    <fo:block
275            font-size="9pt"
276            font-family="monospace"
277            margin-left="10mm">
278        <xsl:value-of select="name"/>
279    </fo:block>
280</xsl:template>
281
282
283<xsl:template match="logtalk/relations/*">
284    <fo:block
285            font-size="9pt"
286            font-family="monospace"
287            margin-left="10mm">
288        <xsl:value-of select="scope"/><xsl:text> </xsl:text><xsl:value-of select="name"/>
289    </fo:block>
290</xsl:template>
291
292
293<xsl:template match="logtalk/predicates">
294
295    <fo:block
296            font-size="14pt" 
297            font-family="sans-serif" 
298            font-weight="bold" 
299            keep-with-next="always"
300            space-before="18pt">
301        Public interface
302    </fo:block>
303    <xsl:choose>
304        <xsl:when test="public/predicate">
305            <xsl:apply-templates select="public/predicate"/>
306        </xsl:when>
307        <xsl:when test="/logtalk/relations/*">     
308            <fo:block
309                    font-size="10pt" 
310                    font-family="serif" 
311                    font-style="italic"
312                    space-before="10pt">
313                (see related entities)
314            </fo:block>
315        </xsl:when>
316        <xsl:otherwise>
317            <fo:block
318                    font-size="10pt" 
319                    font-family="serif" 
320                    font-style="italic"
321                    space-before="10pt">
322                (none)
323            </fo:block>
324        </xsl:otherwise>
325    </xsl:choose>
326
327    <fo:block
328            font-size="14pt" 
329            font-family="sans-serif" 
330            font-weight="bold" 
331            keep-with-next="always"
332            space-before="18pt">
333        Protected interface
334    </fo:block>
335    <xsl:choose>
336        <xsl:when test="protected/predicate">
337            <xsl:apply-templates select="protected/predicate"/>
338        </xsl:when>
339        <xsl:when test="/logtalk/relations/*">     
340            <fo:block
341                    font-size="10pt" 
342                    font-family="serif" 
343                    font-style="italic"
344                    space-before="10pt">
345                (see related entities)
346            </fo:block>
347        </xsl:when>
348        <xsl:otherwise>
349            <fo:block
350                    font-size="10pt" 
351                    font-family="serif" 
352                    font-style="italic"
353                    space-before="10pt">
354                (none)
355            </fo:block>
356        </xsl:otherwise>
357    </xsl:choose>
358
359    <fo:block
360            font-size="14pt" 
361            font-family="sans-serif" 
362            font-weight="bold" 
363            keep-with-next="always"
364            space-before="18pt">
365        Private predicates
366    </fo:block>
367    <xsl:choose>
368        <xsl:when test="private/predicate">
369            <xsl:apply-templates select="private/predicate"/>
370        </xsl:when>
371        <xsl:when test="/logtalk/relations/*">     
372            <fo:block
373                    font-size="10pt" 
374                    font-family="serif" 
375                    font-style="italic"
376                    space-before="10pt">
377                (see related entities)
378            </fo:block>
379        </xsl:when>
380        <xsl:otherwise>
381            <fo:block
382                    font-size="10pt" 
383                    font-family="serif" 
384                    font-style="italic"
385                    space-before="10pt">
386                (none)
387            </fo:block>
388        </xsl:otherwise>
389    </xsl:choose>
390
391</xsl:template>
392
393
394<xsl:template match="*/predicate">
395
396    <fo:block
397            font-size="12pt" 
398            font-family="sans-serif" 
399            font-weight="bold" 
400            keep-with-next="always"
401            space-before="10pt">
402        <xsl:value-of select="name"/>
403    </fo:block>
404
405    <xsl:if test="comment">
406        <fo:block
407                margin-left="10mm"
408                font-size="10pt" 
409                font-family="serif" 
410                font-style="italic"
411                space-before="4pt" 
412                space-after="8pt">
413            <xsl:value-of select="comment"/>
414        </fo:block>
415    </xsl:if>
416
417    <fo:block
418            font-size="10pt"
419            font-family="serif"
420            keep-with-next="always">
421        compilation:
422    </fo:block>
423    <fo:block
424            font-size="9pt"
425            font-family="monospace"
426            margin-left="10mm">
427        <xsl:value-of select="compilation"/>
428    </fo:block>
429
430    <xsl:if test="template">
431        <fo:block
432                font-size="10pt"
433                font-family="serif" 
434                keep-with-next="always">
435            template:
436        </fo:block>
437        <fo:block
438                font-size="9pt"
439                font-family="monospace"
440                margin-left="10mm">
441            <xsl:value-of select="template"/>
442        </fo:block>
443    </xsl:if>
444
445    <xsl:if test="meta">
446        <fo:block
447                font-size="10pt"
448                font-family="serif" 
449                keep-with-next="always">
450            metapredicate template:
451        </fo:block>
452        <fo:block
453                font-size="9pt"
454                font-family="monospace"
455                margin-left="10mm">
456            <xsl:value-of select="meta"/>
457        </fo:block>
458    </xsl:if>
459
460    <xsl:if test="mode">
461        <fo:block
462                font-size="10pt"
463                font-family="serif" 
464                keep-with-next="always">
465            mode - number of solutions:
466        </fo:block>
467        <xsl:for-each select="mode">
468            <fo:block
469                    font-size="9pt"
470                    font-family="monospace"
471                    margin-left="10mm">
472                <xsl:value-of select="template"/> - <xsl:value-of select="solutions"/>
473            </fo:block>
474        </xsl:for-each>
475    </xsl:if>
476
477    <xsl:if test="exceptions">
478        <fo:block
479                font-size="10pt"
480                font-family="serif" 
481                keep-with-next="always">
482            exceptions:
483        </fo:block>
484        <xsl:for-each select="exceptions/exception">
485            <fo:block
486                    font-size="10pt"
487                    font-family="serif" 
488                    keep-with-next="always"
489                    margin-left="10mm">
490                <xsl:value-of select="condition" />:
491            </fo:block>
492            <fo:block
493                    font-size="9pt"
494                    font-family="monospace"
495                    margin-left="20mm">
496                <xsl:value-of select="term" />
497            </fo:block>
498        </xsl:for-each>
499    </xsl:if>
500
501    <xsl:if test="info">
502        <xsl:for-each select="info">
503            <fo:block
504                    font-size="10pt"
505                    font-family="serif" 
506                    keep-with-next="always">
507                    <xsl:value-of select="key"/>:
508                </fo:block>
509            <fo:block
510                    font-size="9pt"
511                    font-family="monospace"
512                    margin-left="10mm">
513                <xsl:value-of select="value"/>
514            </fo:block>
515        </xsl:for-each>
516    </xsl:if>
517
518</xsl:template>
519
520
521</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.