source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/fo/synop.xsl@ 64a2cd5

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 64a2cd5 was 15c7d39, checked in by Matthew Burgess <matthew@…>, 11 years ago

Update stylesheets to docbook-xsl-1.78.1.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10355 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 31.3 KB
Line 
1<?xml version='1.0'?>
2<!DOCTYPE xsl:stylesheet [
3<!ENTITY RE "&#10;">
4<!ENTITY nbsp "&#160;">
5]>
6<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:fo="http://www.w3.org/1999/XSL/Format"
8 version='1.0'>
9
10<!-- ********************************************************************
11 $Id: synop.xsl 8334 2009-03-15 14:26:23Z mzjn $
12 ********************************************************************
13
14 This file is part of the XSL DocBook Stylesheet distribution.
15 See ../README or http://docbook.sf.net/release/xsl/current/ for
16 copyright and other information.
17
18 ******************************************************************** -->
19
20<!-- ==================================================================== -->
21
22<!-- synopsis is in verbatim -->
23
24<!-- ==================================================================== -->
25
26<xsl:template match="cmdsynopsis">
27 <fo:block xsl:use-attribute-sets="normal.para.spacing">
28 <xsl:apply-templates/>
29 </fo:block>
30</xsl:template>
31
32<xsl:template match="cmdsynopsis/command">
33 <xsl:call-template name="inline.monoseq"/>
34 <xsl:text> </xsl:text>
35</xsl:template>
36
37<xsl:template match="cmdsynopsis/command[1]" priority="2">
38 <xsl:call-template name="inline.monoseq"/>
39 <xsl:text> </xsl:text>
40</xsl:template>
41
42<xsl:template match="group|arg" name="group-or-arg">
43 <xsl:variable name="choice" select="@choice"/>
44 <xsl:variable name="rep" select="@rep"/>
45 <xsl:variable name="sepchar">
46 <xsl:choose>
47 <xsl:when test="ancestor-or-self::*/@sepchar">
48 <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
49 </xsl:when>
50 <xsl:otherwise>
51 <xsl:text> </xsl:text>
52 </xsl:otherwise>
53 </xsl:choose>
54 </xsl:variable>
55 <xsl:if test="preceding-sibling::*">
56 <xsl:value-of select="$sepchar"/>
57 </xsl:if>
58 <xsl:choose>
59 <xsl:when test="$choice='plain'">
60 <xsl:value-of select="$arg.choice.plain.open.str"/>
61 </xsl:when>
62 <xsl:when test="$choice='req'">
63 <xsl:value-of select="$arg.choice.req.open.str"/>
64 </xsl:when>
65 <xsl:when test="$choice='opt'">
66 <xsl:value-of select="$arg.choice.opt.open.str"/>
67 </xsl:when>
68 <xsl:otherwise>
69 <xsl:value-of select="$arg.choice.def.open.str"/>
70 </xsl:otherwise>
71 </xsl:choose>
72 <xsl:apply-templates/>
73 <xsl:choose>
74 <xsl:when test="$rep='repeat'">
75 <xsl:value-of select="$arg.rep.repeat.str"/>
76 </xsl:when>
77 <xsl:when test="$rep='norepeat'">
78 <xsl:value-of select="$arg.rep.norepeat.str"/>
79 </xsl:when>
80 <xsl:otherwise>
81 <xsl:value-of select="$arg.rep.def.str"/>
82 </xsl:otherwise>
83 </xsl:choose>
84 <xsl:choose>
85 <xsl:when test="$choice='plain'">
86 <xsl:value-of select="$arg.choice.plain.close.str"/>
87 </xsl:when>
88 <xsl:when test="$choice='req'">
89 <xsl:value-of select="$arg.choice.req.close.str"/>
90 </xsl:when>
91 <xsl:when test="$choice='opt'">
92 <xsl:value-of select="$arg.choice.opt.close.str"/>
93 </xsl:when>
94 <xsl:otherwise>
95 <xsl:value-of select="$arg.choice.def.close.str"/>
96 </xsl:otherwise>
97 </xsl:choose>
98</xsl:template>
99
100<xsl:template match="group/arg">
101 <xsl:variable name="choice" select="@choice"/>
102 <xsl:variable name="rep" select="@rep"/>
103 <xsl:if test="preceding-sibling::*">
104 <xsl:value-of select="$arg.or.sep"/>
105 </xsl:if>
106 <xsl:call-template name="group-or-arg"/>
107</xsl:template>
108
109<xsl:template match="sbr">
110 <fo:block/>
111</xsl:template>
112
113<!-- ==================================================================== -->
114
115<xsl:template match="synopfragmentref">
116 <xsl:variable name="target" select="key('id',@linkend)"/>
117 <xsl:variable name="snum">
118 <xsl:apply-templates select="$target" mode="synopfragment.number"/>
119 </xsl:variable>
120 <fo:inline font-style="italic">
121 <fo:basic-link internal-destination="{@linkend}"
122 xsl:use-attribute-sets="xref.properties">
123 <xsl:text>(</xsl:text>
124 <xsl:value-of select="$snum"/>
125 <xsl:text>)</xsl:text>
126 </fo:basic-link>
127 <xsl:text>&#160;</xsl:text>
128 <xsl:apply-templates/>
129 </fo:inline>
130</xsl:template>
131
132<xsl:template match="synopfragment" mode="synopfragment.number">
133 <xsl:number format="1"/>
134</xsl:template>
135
136<xsl:template match="synopfragment">
137 <xsl:variable name="snum">
138 <xsl:apply-templates select="." mode="synopfragment.number"/>
139 </xsl:variable>
140 <xsl:variable name="id">
141 <xsl:call-template name="object.id"/>
142 </xsl:variable>
143 <fo:block id="{$id}">
144 <xsl:text>(</xsl:text>
145 <xsl:value-of select="$snum"/>
146 <xsl:text>)</xsl:text>
147 <xsl:text> </xsl:text>
148 <xsl:apply-templates/>
149 </fo:block>
150</xsl:template>
151
152<xsl:template match="funcsynopsis">
153 <xsl:call-template name="informal.object"/>
154</xsl:template>
155
156<xsl:template match="funcsynopsisinfo">
157 <fo:block space-after.minimum="0.8em"
158 space-after.optimum="1em"
159 space-after.maximum="1.2em">
160 <xsl:apply-templates/>
161 </fo:block>
162</xsl:template>
163
164<xsl:template match="funcprototype">
165
166 <xsl:variable name="style">
167 <xsl:call-template name="funcsynopsis.style"/>
168 </xsl:variable>
169
170 <fo:block font-family="{$monospace.font.family}"
171 space-before.minimum="0.8em"
172 space-before.optimum="1em"
173 space-before.maximum="1.2em">
174 <xsl:apply-templates/>
175
176 <xsl:if test="$style='kr'">
177 <fo:block
178 space-before.minimum="0.8em"
179 space-before.optimum="1em"
180 space-before.maximum="1.2em">
181 <xsl:apply-templates select="./paramdef" mode="kr-funcsynopsis-mode"/>
182 </fo:block>
183 </xsl:if>
184
185 </fo:block>
186</xsl:template>
187
188<xsl:template match="funcdef">
189 <fo:inline font-family="{$monospace.font.family}">
190 <xsl:apply-templates/>
191 </fo:inline>
192</xsl:template>
193
194<xsl:template match="funcdef/function">
195 <xsl:choose>
196 <xsl:when test="$funcsynopsis.decoration != 0">
197 <fo:inline font-weight="bold">
198 <xsl:apply-templates/>
199 </fo:inline>
200 </xsl:when>
201 <xsl:otherwise>
202 <xsl:apply-templates/>
203 </xsl:otherwise>
204 </xsl:choose>
205</xsl:template>
206
207<xsl:template match="void">
208
209 <xsl:variable name="style">
210 <xsl:call-template name="funcsynopsis.style"/>
211 </xsl:variable>
212
213 <xsl:choose>
214 <xsl:when test="$style='ansi'">
215 <xsl:text>(void);</xsl:text>
216 </xsl:when>
217 <xsl:otherwise>
218 <xsl:text>();</xsl:text>
219 </xsl:otherwise>
220 </xsl:choose>
221</xsl:template>
222
223<xsl:template match="varargs">
224 <xsl:text>(...);</xsl:text>
225</xsl:template>
226
227<xsl:template match="paramdef">
228
229 <xsl:variable name="style">
230 <xsl:call-template name="funcsynopsis.style"/>
231 </xsl:variable>
232
233 <xsl:variable name="paramnum">
234 <xsl:number count="paramdef" format="1"/>
235 </xsl:variable>
236 <xsl:if test="$paramnum=1">(</xsl:if>
237 <xsl:choose>
238 <xsl:when test="$style='ansi'">
239 <xsl:apply-templates/>
240 </xsl:when>
241 <xsl:otherwise>
242 <xsl:apply-templates select="./parameter"/>
243 </xsl:otherwise>
244 </xsl:choose>
245 <xsl:choose>
246 <xsl:when test="following-sibling::paramdef">
247 <xsl:text>, </xsl:text>
248 </xsl:when>
249 <xsl:otherwise>
250 <xsl:text>);</xsl:text>
251 </xsl:otherwise>
252 </xsl:choose>
253</xsl:template>
254
255<xsl:template match="paramdef/parameter">
256 <xsl:choose>
257 <xsl:when test="$funcsynopsis.decoration != 0">
258 <xsl:call-template name="inline.italicseq"/>
259 </xsl:when>
260 <xsl:otherwise>
261 <xsl:apply-templates/>
262 </xsl:otherwise>
263 </xsl:choose>
264 <xsl:if test="following-sibling::parameter">
265 <xsl:text>, </xsl:text>
266 </xsl:if>
267</xsl:template>
268
269<xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
270 <fo:block>
271 <xsl:apply-templates/>
272 <xsl:text>;</xsl:text>
273 </fo:block>
274</xsl:template>
275
276<xsl:template match="funcparams">
277 <xsl:text>(</xsl:text>
278 <xsl:apply-templates/>
279 <xsl:text>)</xsl:text>
280</xsl:template>
281
282<!-- Return value of PI or parameter -->
283<xsl:template name="funcsynopsis.style">
284 <xsl:variable name="pi.style">
285 <xsl:call-template name="pi.dbfo_funcsynopsis-style">
286 <xsl:with-param name="node" select="ancestor::funcsynopsis/descendant-or-self::*"/>
287 </xsl:call-template>
288 </xsl:variable>
289
290 <xsl:choose>
291 <xsl:when test="$pi.style != ''">
292 <xsl:value-of select="$pi.style"/>
293 </xsl:when>
294 <xsl:otherwise>
295 <xsl:value-of select="$funcsynopsis.style"/>
296 </xsl:otherwise>
297 </xsl:choose>
298</xsl:template>
299
300<!-- ==================================================================== -->
301
302<xsl:variable name="default-classsynopsis-language">java</xsl:variable>
303
304<xsl:template match="classsynopsis
305 |fieldsynopsis
306 |methodsynopsis
307 |constructorsynopsis
308 |destructorsynopsis">
309 <xsl:param name="language">
310 <xsl:choose>
311 <xsl:when test="@language">
312 <xsl:value-of select="@language"/>
313 </xsl:when>
314 <xsl:otherwise>
315 <xsl:value-of select="$default-classsynopsis-language"/>
316 </xsl:otherwise>
317 </xsl:choose>
318 </xsl:param>
319
320 <!--
321 <xsl:message>process <xsl:value-of select="local-name(.)"/> in <xsl:value-of select="$language"/></xsl:message>
322 -->
323
324 <xsl:choose>
325 <xsl:when test="$language='java' or $language='Java'">
326 <xsl:apply-templates select="." mode="java"/>
327 </xsl:when>
328 <xsl:when test="$language='perl' or $language='Perl'">
329 <xsl:apply-templates select="." mode="perl"/>
330 </xsl:when>
331 <xsl:when test="$language='idl' or $language='IDL'">
332 <xsl:apply-templates select="." mode="idl"/>
333 </xsl:when>
334 <xsl:when test="$language='cpp' or $language='c++' or $language='C++'">
335 <xsl:apply-templates select="." mode="cpp"/>
336 </xsl:when>
337 <xsl:otherwise>
338 <xsl:message>
339 <xsl:text>Unrecognized language on </xsl:text>
340 <xsl:value-of select="local-name(.)"/>
341 <xsl:text>: </xsl:text>
342 <xsl:value-of select="$language"/>
343 </xsl:message>
344 <xsl:apply-templates select=".">
345 <xsl:with-param name="language"
346 select="$default-classsynopsis-language"/>
347 </xsl:apply-templates>
348 </xsl:otherwise>
349 </xsl:choose>
350</xsl:template>
351
352<xsl:template name="synop-break">
353 <xsl:if test="parent::classsynopsis
354 or (following-sibling::fieldsynopsis
355 |following-sibling::methodsynopsis
356 |following-sibling::constructorsynopsis
357 |following-sibling::destructorsynopsis)">
358 <fo:inline>&RE;</fo:inline>
359 </xsl:if>
360</xsl:template>
361
362<!-- ===== Java ======================================================== -->
363
364<xsl:template match="classsynopsis" mode="java">
365 <fo:block wrap-option='no-wrap'
366 white-space-collapse='false'
367 linefeed-treatment="preserve"
368 xsl:use-attribute-sets="monospace.verbatim.properties">
369 <xsl:apply-templates select="ooclass[1]" mode="java"/>
370 <xsl:if test="ooclass[preceding-sibling::*]">
371 <xsl:text> extends</xsl:text>
372 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="java"/>
373 <xsl:if test="oointerface|ooexception">
374 <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
375 </xsl:if>
376 </xsl:if>
377 <xsl:if test="oointerface">
378 <xsl:text>implements</xsl:text>
379 <xsl:apply-templates select="oointerface" mode="java"/>
380 <xsl:if test="ooexception">
381 <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
382 </xsl:if>
383 </xsl:if>
384 <xsl:if test="ooexception">
385 <xsl:text>throws</xsl:text>
386 <xsl:apply-templates select="ooexception" mode="java"/>
387 </xsl:if>
388 <xsl:text>&nbsp;{&RE;</xsl:text>
389 <xsl:apply-templates select="constructorsynopsis
390 |destructorsynopsis
391 |fieldsynopsis
392 |methodsynopsis
393 |classsynopsisinfo" mode="java"/>
394 <xsl:text>}</xsl:text>
395 </fo:block>
396</xsl:template>
397
398<xsl:template match="classsynopsisinfo" mode="java">
399 <xsl:apply-templates mode="java"/>
400</xsl:template>
401
402<xsl:template match="ooclass|oointerface|ooexception" mode="java">
403 <xsl:choose>
404 <xsl:when test="preceding-sibling::*">
405 <xsl:text>, </xsl:text>
406 </xsl:when>
407 <xsl:otherwise>
408 <xsl:text> </xsl:text>
409 </xsl:otherwise>
410 </xsl:choose>
411 <xsl:apply-templates mode="java"/>
412</xsl:template>
413
414<xsl:template match="modifier|package" mode="java">
415 <xsl:apply-templates mode="java"/>
416 <xsl:if test="following-sibling::*">
417 <xsl:text>&nbsp;</xsl:text>
418 </xsl:if>
419</xsl:template>
420
421<xsl:template match="classname" mode="java">
422 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
423 <xsl:text>, </xsl:text>
424 </xsl:if>
425 <xsl:apply-templates mode="java"/>
426</xsl:template>
427
428<xsl:template match="interfacename" mode="java">
429 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
430 <xsl:text>, </xsl:text>
431 </xsl:if>
432 <xsl:apply-templates mode="java"/>
433</xsl:template>
434
435<xsl:template match="exceptionname" mode="java">
436 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
437 <xsl:text>, </xsl:text>
438 </xsl:if>
439 <xsl:apply-templates mode="java"/>
440</xsl:template>
441
442<xsl:template match="fieldsynopsis" mode="java">
443 <fo:block wrap-option='no-wrap'
444 white-space-collapse='false'
445 linefeed-treatment="preserve"
446 xsl:use-attribute-sets="monospace.verbatim.properties">
447 <xsl:text>&nbsp;&nbsp;</xsl:text>
448 <xsl:apply-templates mode="java"/>
449 <xsl:text>;</xsl:text>
450 <xsl:call-template name="synop-break"/>
451 </fo:block>
452</xsl:template>
453
454<xsl:template match="type" mode="java">
455 <xsl:apply-templates mode="java"/>
456 <xsl:text>&nbsp;</xsl:text>
457</xsl:template>
458
459<xsl:template match="varname" mode="java">
460 <xsl:apply-templates mode="java"/>
461 <xsl:text>&nbsp;</xsl:text>
462</xsl:template>
463
464<xsl:template match="initializer" mode="java">
465 <xsl:text>=&nbsp;</xsl:text>
466 <xsl:apply-templates mode="java"/>
467</xsl:template>
468
469<xsl:template match="void" mode="java">
470 <xsl:text>void&nbsp;</xsl:text>
471</xsl:template>
472
473<xsl:template match="methodname" mode="java">
474 <xsl:apply-templates mode="java"/>
475</xsl:template>
476
477<xsl:template match="methodparam" mode="java">
478 <xsl:param name="indent">0</xsl:param>
479 <xsl:if test="preceding-sibling::methodparam">
480 <xsl:text>,&RE;</xsl:text>
481 <xsl:if test="$indent &gt; 0">
482 <xsl:call-template name="copy-string">
483 <xsl:with-param name="string">&nbsp;</xsl:with-param>
484 <xsl:with-param name="count" select="$indent + 1"/>
485 </xsl:call-template>
486 </xsl:if>
487 </xsl:if>
488 <xsl:apply-templates mode="java"/>
489</xsl:template>
490
491<xsl:template match="parameter" mode="java">
492 <xsl:apply-templates mode="java"/>
493</xsl:template>
494
495<xsl:template mode="java"
496 match="constructorsynopsis|destructorsynopsis|methodsynopsis">
497 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
498 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
499 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
500 <xsl:variable name="decl">
501 <xsl:text> </xsl:text>
502 <xsl:apply-templates select="$start-modifiers" mode="java"/>
503
504 <!-- type -->
505 <xsl:if test="local-name($notmod[1]) != 'methodname'">
506 <xsl:apply-templates select="$notmod[1]" mode="java"/>
507 </xsl:if>
508
509 <xsl:apply-templates select="methodname" mode="java"/>
510 </xsl:variable>
511
512 <fo:block wrap-option='no-wrap'
513 white-space-collapse='false'
514 linefeed-treatment="preserve"
515 xsl:use-attribute-sets="monospace.verbatim.properties">
516 <xsl:copy-of select="$decl"/>
517 <xsl:text>(</xsl:text>
518 <xsl:apply-templates select="methodparam" mode="java">
519 <xsl:with-param name="indent" select="string-length($decl)"/>
520 </xsl:apply-templates>
521 <xsl:text>)</xsl:text>
522 <xsl:if test="exceptionname">
523 <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;</xsl:text>
524 <xsl:apply-templates select="exceptionname" mode="java"/>
525 </xsl:if>
526 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
527 <xsl:text> </xsl:text>
528 <xsl:apply-templates select="$end-modifiers" mode="java"/>
529 </xsl:if>
530 <xsl:text>;</xsl:text>
531 </fo:block>
532 <xsl:call-template name="synop-break"/>
533</xsl:template>
534
535<!-- ===== C++ ========================================================= -->
536
537<xsl:template match="classsynopsis" mode="cpp">
538 <fo:block wrap-option='no-wrap'
539 white-space-collapse='false'
540 linefeed-treatment="preserve"
541 xsl:use-attribute-sets="monospace.verbatim.properties">
542 <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
543 <xsl:if test="ooclass[preceding-sibling::*]">
544 <xsl:text>: </xsl:text>
545 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="cpp"/>
546 <xsl:if test="oointerface|ooexception">
547 <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
548 </xsl:if>
549 </xsl:if>
550 <xsl:if test="oointerface">
551 <xsl:text> implements</xsl:text>
552 <xsl:apply-templates select="oointerface" mode="cpp"/>
553 <xsl:if test="ooexception">
554 <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
555 </xsl:if>
556 </xsl:if>
557 <xsl:if test="ooexception">
558 <xsl:text> throws</xsl:text>
559 <xsl:apply-templates select="ooexception" mode="cpp"/>
560 </xsl:if>
561 <xsl:text>&nbsp;{&RE;</xsl:text>
562 <xsl:apply-templates select="constructorsynopsis
563 |destructorsynopsis
564 |fieldsynopsis
565 |methodsynopsis
566 |classsynopsisinfo" mode="cpp"/>
567 <xsl:text>}</xsl:text>
568 </fo:block>
569</xsl:template>
570
571<xsl:template match="classsynopsisinfo" mode="cpp">
572 <xsl:apply-templates mode="cpp"/>
573</xsl:template>
574
575<xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
576 <xsl:if test="preceding-sibling::*">
577 <xsl:text>, </xsl:text>
578 </xsl:if>
579 <xsl:apply-templates mode="cpp"/>
580</xsl:template>
581
582<xsl:template match="modifier|package" mode="cpp">
583 <xsl:apply-templates mode="cpp"/>
584 <xsl:if test="following-sibling::*">
585 <xsl:text>&nbsp;</xsl:text>
586 </xsl:if>
587</xsl:template>
588
589<xsl:template match="classname" mode="cpp">
590 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
591 <xsl:text>, </xsl:text>
592 </xsl:if>
593 <xsl:apply-templates mode="cpp"/>
594</xsl:template>
595
596<xsl:template match="interfacename" mode="cpp">
597 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
598 <xsl:text>, </xsl:text>
599 </xsl:if>
600 <xsl:apply-templates mode="cpp"/>
601</xsl:template>
602
603<xsl:template match="exceptionname" mode="cpp">
604 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
605 <xsl:text>, </xsl:text>
606 </xsl:if>
607 <xsl:apply-templates mode="cpp"/>
608</xsl:template>
609
610<xsl:template match="fieldsynopsis" mode="cpp">
611 <fo:block wrap-option='no-wrap'
612 white-space-collapse='false'
613 linefeed-treatment="preserve"
614 xsl:use-attribute-sets="monospace.verbatim.properties">
615 <xsl:text>&nbsp;&nbsp;</xsl:text>
616 <xsl:apply-templates mode="cpp"/>
617 <xsl:text>;</xsl:text>
618 </fo:block>
619 <xsl:call-template name="synop-break"/>
620</xsl:template>
621
622<xsl:template match="type" mode="cpp">
623 <xsl:apply-templates mode="cpp"/>
624 <xsl:text>&nbsp;</xsl:text>
625</xsl:template>
626
627<xsl:template match="varname" mode="cpp">
628 <xsl:apply-templates mode="cpp"/>
629 <xsl:text>&nbsp;</xsl:text>
630</xsl:template>
631
632<xsl:template match="initializer" mode="cpp">
633 <xsl:text>=&nbsp;</xsl:text>
634 <xsl:apply-templates mode="cpp"/>
635</xsl:template>
636
637<xsl:template match="void" mode="cpp">
638 <xsl:text>void&nbsp;</xsl:text>
639</xsl:template>
640
641<xsl:template match="methodname" mode="cpp">
642 <xsl:apply-templates mode="cpp"/>
643</xsl:template>
644
645<xsl:template match="methodparam" mode="cpp">
646 <xsl:if test="preceding-sibling::methodparam">
647 <xsl:text>, </xsl:text>
648 </xsl:if>
649 <xsl:apply-templates mode="cpp"/>
650</xsl:template>
651
652<xsl:template match="parameter" mode="cpp">
653 <xsl:apply-templates mode="cpp"/>
654</xsl:template>
655
656<xsl:template mode="cpp"
657 match="constructorsynopsis|destructorsynopsis|methodsynopsis">
658 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
659 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
660 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
661
662 <fo:block wrap-option='no-wrap'
663 white-space-collapse='false'
664 linefeed-treatment="preserve"
665 xsl:use-attribute-sets="monospace.verbatim.properties">
666 <xsl:text> </xsl:text>
667 <xsl:apply-templates select="$start-modifiers" mode="cpp"/>
668
669 <!-- type -->
670 <xsl:if test="local-name($notmod[1]) != 'methodname'">
671 <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
672 </xsl:if>
673
674 <xsl:apply-templates select="methodname" mode="cpp"/>
675 <xsl:text>(</xsl:text>
676 <xsl:apply-templates select="methodparam" mode="cpp"/>
677 <xsl:text>)</xsl:text>
678 <xsl:if test="exceptionname">
679 <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;</xsl:text>
680 <xsl:apply-templates select="exceptionname" mode="cpp"/>
681 </xsl:if>
682 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
683 <xsl:text> </xsl:text>
684 <xsl:apply-templates select="$end-modifiers" mode="cpp"/>
685 </xsl:if>
686 <xsl:text>;</xsl:text>
687 </fo:block>
688 <xsl:call-template name="synop-break"/>
689</xsl:template>
690
691<!-- ===== IDL ========================================================= -->
692
693<xsl:template match="classsynopsis" mode="idl">
694 <fo:block wrap-option='no-wrap'
695 white-space-collapse='false'
696 linefeed-treatment="preserve"
697 xsl:use-attribute-sets="monospace.verbatim.properties">
698 <xsl:text>interface </xsl:text>
699 <xsl:apply-templates select="ooclass[1]" mode="idl"/>
700 <xsl:if test="ooclass[preceding-sibling::*]">
701 <xsl:text>: </xsl:text>
702 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="idl"/>
703 <xsl:if test="oointerface|ooexception">
704 <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
705 </xsl:if>
706 </xsl:if>
707 <xsl:if test="oointerface">
708 <xsl:text> implements</xsl:text>
709 <xsl:apply-templates select="oointerface" mode="idl"/>
710 <xsl:if test="ooexception">
711 <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
712 </xsl:if>
713 </xsl:if>
714 <xsl:if test="ooexception">
715 <xsl:text> throws</xsl:text>
716 <xsl:apply-templates select="ooexception" mode="idl"/>
717 </xsl:if>
718 <xsl:text>&nbsp;{&RE;</xsl:text>
719 <xsl:apply-templates select="constructorsynopsis
720 |destructorsynopsis
721 |fieldsynopsis
722 |methodsynopsis
723 |classsynopsisinfo" mode="idl"/>
724 <xsl:text>}</xsl:text>
725 </fo:block>
726</xsl:template>
727
728<xsl:template match="classsynopsisinfo" mode="idl">
729 <xsl:apply-templates mode="idl"/>
730</xsl:template>
731
732<xsl:template match="ooclass|oointerface|ooexception" mode="idl">
733 <xsl:if test="preceding-sibling::*">
734 <xsl:text>, </xsl:text>
735 </xsl:if>
736 <xsl:apply-templates mode="idl"/>
737</xsl:template>
738
739<xsl:template match="modifier|package" mode="idl">
740 <xsl:apply-templates mode="idl"/>
741 <xsl:if test="following-sibling::*">
742 <xsl:text>&nbsp;</xsl:text>
743 </xsl:if>
744</xsl:template>
745
746<xsl:template match="classname" mode="idl">
747 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
748 <xsl:text>, </xsl:text>
749 </xsl:if>
750 <xsl:apply-templates mode="idl"/>
751</xsl:template>
752
753<xsl:template match="interfacename" mode="idl">
754 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
755 <xsl:text>, </xsl:text>
756 </xsl:if>
757 <xsl:apply-templates mode="idl"/>
758</xsl:template>
759
760<xsl:template match="exceptionname" mode="idl">
761 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
762 <xsl:text>, </xsl:text>
763 </xsl:if>
764 <xsl:apply-templates mode="idl"/>
765</xsl:template>
766
767<xsl:template match="fieldsynopsis" mode="idl">
768 <fo:block wrap-option='no-wrap'
769 white-space-collapse='false'
770 linefeed-treatment="preserve"
771 xsl:use-attribute-sets="monospace.verbatim.properties">
772 <xsl:text>&nbsp;&nbsp;</xsl:text>
773 <xsl:apply-templates mode="idl"/>
774 <xsl:text>;</xsl:text>
775 </fo:block>
776 <xsl:call-template name="synop-break"/>
777</xsl:template>
778
779<xsl:template match="type" mode="idl">
780 <xsl:apply-templates mode="idl"/>
781 <xsl:text>&nbsp;</xsl:text>
782</xsl:template>
783
784<xsl:template match="varname" mode="idl">
785 <xsl:apply-templates mode="idl"/>
786 <xsl:text>&nbsp;</xsl:text>
787</xsl:template>
788
789<xsl:template match="initializer" mode="idl">
790 <xsl:text>=&nbsp;</xsl:text>
791 <xsl:apply-templates mode="idl"/>
792</xsl:template>
793
794<xsl:template match="void" mode="idl">
795 <xsl:text>void&nbsp;</xsl:text>
796</xsl:template>
797
798<xsl:template match="methodname" mode="idl">
799 <xsl:apply-templates mode="idl"/>
800</xsl:template>
801
802<xsl:template match="methodparam" mode="idl">
803 <xsl:if test="preceding-sibling::methodparam">
804 <xsl:text>, </xsl:text>
805 </xsl:if>
806 <xsl:apply-templates mode="idl"/>
807</xsl:template>
808
809<xsl:template match="parameter" mode="idl">
810 <xsl:apply-templates mode="idl"/>
811</xsl:template>
812
813<xsl:template mode="idl"
814 match="constructorsynopsis|destructorsynopsis|methodsynopsis">
815 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
816 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
817 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
818
819 <fo:block wrap-option='no-wrap'
820 white-space-collapse='false'
821 linefeed-treatment="preserve"
822 xsl:use-attribute-sets="monospace.verbatim.properties">
823 <xsl:text> </xsl:text>
824 <xsl:apply-templates select="$start-modifiers" mode="idl"/>
825
826 <!-- type -->
827 <xsl:if test="local-name($notmod[1]) != 'methodname'">
828 <xsl:apply-templates select="$notmod[1]" mode="idl"/>
829 </xsl:if>
830
831 <xsl:apply-templates select="methodname" mode="idl"/>
832 <xsl:text>(</xsl:text>
833 <xsl:apply-templates select="methodparam" mode="idl"/>
834 <xsl:text>)</xsl:text>
835 <xsl:if test="exceptionname">
836 <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;raises(</xsl:text>
837 <xsl:apply-templates select="exceptionname" mode="idl"/>
838 <xsl:text>)</xsl:text>
839 </xsl:if>
840 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
841 <xsl:text> </xsl:text>
842 <xsl:apply-templates select="$end-modifiers" mode="idl"/>
843 </xsl:if>
844 <xsl:text>;</xsl:text>
845 </fo:block>
846 <xsl:call-template name="synop-break"/>
847</xsl:template>
848
849<!-- ===== Perl ======================================================== -->
850
851<xsl:template match="classsynopsis" mode="perl">
852 <fo:block wrap-option='no-wrap'
853 white-space-collapse='false'
854 linefeed-treatment="preserve"
855 xsl:use-attribute-sets="monospace.verbatim.properties">
856 <xsl:text>package </xsl:text>
857 <xsl:apply-templates select="ooclass[1]" mode="perl"/>
858 <xsl:text>;&RE;</xsl:text>
859
860 <xsl:if test="ooclass[preceding-sibling::*]">
861 <xsl:text>@ISA = (</xsl:text>
862 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="perl"/>
863 <xsl:text>);&RE;</xsl:text>
864 </xsl:if>
865
866 <xsl:apply-templates select="constructorsynopsis
867 |destructorsynopsis
868 |fieldsynopsis
869 |methodsynopsis
870 |classsynopsisinfo" mode="perl"/>
871 </fo:block>
872</xsl:template>
873
874<xsl:template match="classsynopsisinfo" mode="perl">
875 <xsl:apply-templates mode="perl"/>
876</xsl:template>
877
878<xsl:template match="ooclass|oointerface|ooexception" mode="perl">
879 <xsl:if test="preceding-sibling::*">
880 <xsl:text>, </xsl:text>
881 </xsl:if>
882 <xsl:apply-templates mode="perl"/>
883</xsl:template>
884
885<xsl:template match="modifier|package" mode="perl">
886 <xsl:apply-templates mode="perl"/>
887 <xsl:if test="following-sibling::*">
888 <xsl:text>&nbsp;</xsl:text>
889 </xsl:if>
890</xsl:template>
891
892<xsl:template match="classname" mode="perl">
893 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
894 <xsl:text>, </xsl:text>
895 </xsl:if>
896 <xsl:apply-templates mode="perl"/>
897</xsl:template>
898
899<xsl:template match="interfacename" mode="perl">
900 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
901 <xsl:text>, </xsl:text>
902 </xsl:if>
903 <xsl:apply-templates mode="perl"/>
904</xsl:template>
905
906<xsl:template match="exceptionname" mode="perl">
907 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
908 <xsl:text>, </xsl:text>
909 </xsl:if>
910 <xsl:apply-templates mode="perl"/>
911</xsl:template>
912
913<xsl:template match="fieldsynopsis" mode="perl">
914 <fo:block wrap-option='no-wrap'
915 white-space-collapse='false'
916 linefeed-treatment="preserve"
917 xsl:use-attribute-sets="monospace.verbatim.properties">
918 <xsl:text>&nbsp;&nbsp;</xsl:text>
919 <xsl:apply-templates mode="perl"/>
920 <xsl:text>;</xsl:text>
921 </fo:block>
922 <xsl:call-template name="synop-break"/>
923</xsl:template>
924
925<xsl:template match="type" mode="perl">
926 <xsl:apply-templates mode="perl"/>
927 <xsl:text>&nbsp;</xsl:text>
928</xsl:template>
929
930<xsl:template match="varname" mode="perl">
931 <xsl:apply-templates mode="perl"/>
932 <xsl:text>&nbsp;</xsl:text>
933</xsl:template>
934
935<xsl:template match="initializer" mode="perl">
936 <xsl:text>=&nbsp;</xsl:text>
937 <xsl:apply-templates mode="perl"/>
938</xsl:template>
939
940<xsl:template match="void" mode="perl">
941 <xsl:text>void&nbsp;</xsl:text>
942</xsl:template>
943
944<xsl:template match="methodname" mode="perl">
945 <xsl:apply-templates mode="perl"/>
946</xsl:template>
947
948<xsl:template match="methodparam" mode="perl">
949 <xsl:if test="preceding-sibling::methodparam">
950 <xsl:text>, </xsl:text>
951 </xsl:if>
952 <xsl:apply-templates mode="perl"/>
953</xsl:template>
954
955<xsl:template match="parameter" mode="perl">
956 <xsl:apply-templates mode="perl"/>
957</xsl:template>
958
959<xsl:template mode="perl"
960 match="constructorsynopsis|destructorsynopsis|methodsynopsis">
961 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
962 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
963 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
964
965 <fo:block wrap-option='no-wrap'
966 white-space-collapse='false'
967 linefeed-treatment="preserve"
968 xsl:use-attribute-sets="monospace.verbatim.properties">
969 <xsl:text>sub </xsl:text>
970
971 <xsl:apply-templates select="methodname" mode="perl"/>
972 <xsl:text> { ... };</xsl:text>
973 <xsl:call-template name="synop-break"/>
974 </fo:block>
975</xsl:template>
976
977<!-- Used when not occurring as a child of classsynopsis -->
978<xsl:template match="ooclass|oointerface|ooexception">
979 <xsl:apply-templates/>
980</xsl:template>
981
982<!-- ==================================================================== -->
983
984<!-- * DocBook 5 allows linking elements (link, olink, and xref) -->
985<!-- * within the OO *synopsis elements (classsynopsis, fieldsynopsis, -->
986<!-- * methodsynopsis, constructorsynopsis, destructorsynopsis) and -->
987<!-- * their children. So we need to have mode="java|cpp|idl|perl" -->
988<!-- * per-mode matches for those linking elements in order for them -->
989<!-- * to be processed as expected. -->
990
991<xsl:template match="link|olink|xref" mode="java">
992 <xsl:apply-templates select="."/>
993</xsl:template>
994
995<xsl:template match="link|olink|xref" mode="cpp">
996 <xsl:apply-templates select="."/>
997</xsl:template>
998
999<xsl:template match="link|olink|xref" mode="idl">
1000 <xsl:apply-templates select="."/>
1001</xsl:template>
1002
1003<xsl:template match="link|olink|xref" mode="perl">
1004 <xsl:apply-templates select="."/>
1005</xsl:template>
1006
1007</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.