2 <!DOCTYPE xsl:stylesheet [
4 <!ENTITY nbsp " ">
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:fo="http://www.w3.org/1999/XSL/Format"
10 <!-- ********************************************************************
11 $Id: synop.xsl 8334 2009-03-15 14:26:23Z mzjn $
12 ********************************************************************
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.
18 ******************************************************************** -->
20 <!-- ==================================================================== -->
22 <!-- synopsis is in verbatim -->
24 <!-- ==================================================================== -->
26 <xsl:template match="cmdsynopsis">
27 <fo:block xsl:use-attribute-sets="normal.para.spacing">
28 <xsl:apply-templates/>
32 <xsl:template match="cmdsynopsis/command">
33 <xsl:call-template name="inline.monoseq"/>
34 <xsl:text> </xsl:text>
37 <xsl:template match="cmdsynopsis/command[1]" priority="2">
38 <xsl:call-template name="inline.monoseq"/>
39 <xsl:text> </xsl:text>
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">
47 <xsl:when test="ancestor-or-self::*/@sepchar">
48 <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
51 <xsl:text> </xsl:text>
55 <xsl:if test="preceding-sibling::*">
56 <xsl:value-of select="$sepchar"/>
59 <xsl:when test="$choice='plain'">
60 <xsl:value-of select="$arg.choice.plain.open.str"/>
62 <xsl:when test="$choice='req'">
63 <xsl:value-of select="$arg.choice.req.open.str"/>
65 <xsl:when test="$choice='opt'">
66 <xsl:value-of select="$arg.choice.opt.open.str"/>
69 <xsl:value-of select="$arg.choice.def.open.str"/>
72 <xsl:apply-templates/>
74 <xsl:when test="$rep='repeat'">
75 <xsl:value-of select="$arg.rep.repeat.str"/>
77 <xsl:when test="$rep='norepeat'">
78 <xsl:value-of select="$arg.rep.norepeat.str"/>
81 <xsl:value-of select="$arg.rep.def.str"/>
85 <xsl:when test="$choice='plain'">
86 <xsl:value-of select="$arg.choice.plain.close.str"/>
88 <xsl:when test="$choice='req'">
89 <xsl:value-of select="$arg.choice.req.close.str"/>
91 <xsl:when test="$choice='opt'">
92 <xsl:value-of select="$arg.choice.opt.close.str"/>
95 <xsl:value-of select="$arg.choice.def.close.str"/>
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"/>
106 <xsl:call-template name="group-or-arg"/>
109 <xsl:template match="sbr">
113 <!-- ==================================================================== -->
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"/>
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>
127 <xsl:text> </xsl:text>
128 <xsl:apply-templates/>
132 <xsl:template match="synopfragment" mode="synopfragment.number">
133 <xsl:number format="1"/>
136 <xsl:template match="synopfragment">
137 <xsl:variable name="snum">
138 <xsl:apply-templates select="." mode="synopfragment.number"/>
140 <xsl:variable name="id">
141 <xsl:call-template name="object.id"/>
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/>
152 <xsl:template match="funcsynopsis">
153 <xsl:call-template name="informal.object"/>
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/>
164 <xsl:template match="funcprototype">
166 <xsl:variable name="style">
167 <xsl:call-template name="funcsynopsis.style"/>
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/>
176 <xsl:if test="$style='kr'">
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"/>
188 <xsl:template match="funcdef">
189 <fo:inline font-family="{$monospace.font.family}">
190 <xsl:apply-templates/>
194 <xsl:template match="funcdef/function">
196 <xsl:when test="$funcsynopsis.decoration != 0">
197 <fo:inline font-weight="bold">
198 <xsl:apply-templates/>
202 <xsl:apply-templates/>
207 <xsl:template match="void">
209 <xsl:variable name="style">
210 <xsl:call-template name="funcsynopsis.style"/>
214 <xsl:when test="$style='ansi'">
215 <xsl:text>(void);</xsl:text>
218 <xsl:text>();</xsl:text>
223 <xsl:template match="varargs">
224 <xsl:text>(...);</xsl:text>
227 <xsl:template match="paramdef">
229 <xsl:variable name="style">
230 <xsl:call-template name="funcsynopsis.style"/>
233 <xsl:variable name="paramnum">
234 <xsl:number count="paramdef" format="1"/>
236 <xsl:if test="$paramnum=1">(</xsl:if>
238 <xsl:when test="$style='ansi'">
239 <xsl:apply-templates/>
242 <xsl:apply-templates select="./parameter"/>
246 <xsl:when test="following-sibling::paramdef">
247 <xsl:text>, </xsl:text>
250 <xsl:text>);</xsl:text>
255 <xsl:template match="paramdef/parameter">
257 <xsl:when test="$funcsynopsis.decoration != 0">
258 <xsl:call-template name="inline.italicseq"/>
261 <xsl:apply-templates/>
264 <xsl:if test="following-sibling::parameter">
265 <xsl:text>, </xsl:text>
269 <xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
271 <xsl:apply-templates/>
272 <xsl:text>;</xsl:text>
276 <xsl:template match="funcparams">
277 <xsl:text>(</xsl:text>
278 <xsl:apply-templates/>
279 <xsl:text>)</xsl:text>
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::*"/>
291 <xsl:when test="$pi.style != ''">
292 <xsl:value-of select="$pi.style"/>
295 <xsl:value-of select="$funcsynopsis.style"/>
300 <!-- ==================================================================== -->
302 <xsl:variable name="default-classsynopsis-language">java</xsl:variable>
304 <xsl:template match="classsynopsis
308 |destructorsynopsis">
309 <xsl:param name="language">
311 <xsl:when test="@language">
312 <xsl:value-of select="@language"/>
315 <xsl:value-of select="$default-classsynopsis-language"/>
321 <xsl:message>process <xsl:value-of select="local-name(.)"/> in <xsl:value-of select="$language"/></xsl:message>
325 <xsl:when test="$language='java' or $language='Java'">
326 <xsl:apply-templates select="." mode="java"/>
328 <xsl:when test="$language='perl' or $language='Perl'">
329 <xsl:apply-templates select="." mode="perl"/>
331 <xsl:when test="$language='idl' or $language='IDL'">
332 <xsl:apply-templates select="." mode="idl"/>
334 <xsl:when test="$language='cpp' or $language='c++' or $language='C++'">
335 <xsl:apply-templates select="." mode="cpp"/>
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"/>
344 <xsl:apply-templates select=".">
345 <xsl:with-param name="language"
346 select="$default-classsynopsis-language"/>
347 </xsl:apply-templates>
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>
362 <!-- ===== Java ======================================================== -->
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; </xsl:text>
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; </xsl:text>
384 <xsl:if test="ooexception">
385 <xsl:text>throws</xsl:text>
386 <xsl:apply-templates select="ooexception" mode="java"/>
388 <xsl:text> {&RE;</xsl:text>
389 <xsl:apply-templates select="constructorsynopsis
393 |classsynopsisinfo" mode="java"/>
394 <xsl:text>}</xsl:text>
398 <xsl:template match="classsynopsisinfo" mode="java">
399 <xsl:apply-templates mode="java"/>
402 <xsl:template match="ooclass|oointerface|ooexception" mode="java">
404 <xsl:when test="preceding-sibling::*">
405 <xsl:text>, </xsl:text>
408 <xsl:text> </xsl:text>
411 <xsl:apply-templates mode="java"/>
414 <xsl:template match="modifier|package" mode="java">
415 <xsl:apply-templates mode="java"/>
416 <xsl:if test="following-sibling::*">
417 <xsl:text> </xsl:text>
421 <xsl:template match="classname" mode="java">
422 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
423 <xsl:text>, </xsl:text>
425 <xsl:apply-templates mode="java"/>
428 <xsl:template match="interfacename" mode="java">
429 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
430 <xsl:text>, </xsl:text>
432 <xsl:apply-templates mode="java"/>
435 <xsl:template match="exceptionname" mode="java">
436 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
437 <xsl:text>, </xsl:text>
439 <xsl:apply-templates mode="java"/>
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> </xsl:text>
448 <xsl:apply-templates mode="java"/>
449 <xsl:text>;</xsl:text>
450 <xsl:call-template name="synop-break"/>
454 <xsl:template match="type" mode="java">
455 <xsl:apply-templates mode="java"/>
456 <xsl:text> </xsl:text>
459 <xsl:template match="varname" mode="java">
460 <xsl:apply-templates mode="java"/>
461 <xsl:text> </xsl:text>
464 <xsl:template match="initializer" mode="java">
465 <xsl:text>= </xsl:text>
466 <xsl:apply-templates mode="java"/>
469 <xsl:template match="void" mode="java">
470 <xsl:text>void </xsl:text>
473 <xsl:template match="methodname" mode="java">
474 <xsl:apply-templates mode="java"/>
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 > 0">
482 <xsl:call-template name="copy-string">
483 <xsl:with-param name="string"> </xsl:with-param>
484 <xsl:with-param name="count" select="$indent + 1"/>
488 <xsl:apply-templates mode="java"/>
491 <xsl:template match="parameter" mode="java">
492 <xsl:apply-templates mode="java"/>
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"/>
505 <xsl:if test="local-name($notmod[1]) != 'methodname'">
506 <xsl:apply-templates select="$notmod[1]" mode="java"/>
509 <xsl:apply-templates select="methodname" mode="java"/>
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; throws </xsl:text>
524 <xsl:apply-templates select="exceptionname" mode="java"/>
526 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
527 <xsl:text> </xsl:text>
528 <xsl:apply-templates select="$end-modifiers" mode="java"/>
530 <xsl:text>;</xsl:text>
532 <xsl:call-template name="synop-break"/>
535 <!-- ===== C++ ========================================================= -->
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; </xsl:text>
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; </xsl:text>
557 <xsl:if test="ooexception">
558 <xsl:text> throws</xsl:text>
559 <xsl:apply-templates select="ooexception" mode="cpp"/>
561 <xsl:text> {&RE;</xsl:text>
562 <xsl:apply-templates select="constructorsynopsis
566 |classsynopsisinfo" mode="cpp"/>
567 <xsl:text>}</xsl:text>
571 <xsl:template match="classsynopsisinfo" mode="cpp">
572 <xsl:apply-templates mode="cpp"/>
575 <xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
576 <xsl:if test="preceding-sibling::*">
577 <xsl:text>, </xsl:text>
579 <xsl:apply-templates mode="cpp"/>
582 <xsl:template match="modifier|package" mode="cpp">
583 <xsl:apply-templates mode="cpp"/>
584 <xsl:if test="following-sibling::*">
585 <xsl:text> </xsl:text>
589 <xsl:template match="classname" mode="cpp">
590 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
591 <xsl:text>, </xsl:text>
593 <xsl:apply-templates mode="cpp"/>
596 <xsl:template match="interfacename" mode="cpp">
597 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
598 <xsl:text>, </xsl:text>
600 <xsl:apply-templates mode="cpp"/>
603 <xsl:template match="exceptionname" mode="cpp">
604 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
605 <xsl:text>, </xsl:text>
607 <xsl:apply-templates mode="cpp"/>
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> </xsl:text>
616 <xsl:apply-templates mode="cpp"/>
617 <xsl:text>;</xsl:text>
619 <xsl:call-template name="synop-break"/>
622 <xsl:template match="type" mode="cpp">
623 <xsl:apply-templates mode="cpp"/>
624 <xsl:text> </xsl:text>
627 <xsl:template match="varname" mode="cpp">
628 <xsl:apply-templates mode="cpp"/>
629 <xsl:text> </xsl:text>
632 <xsl:template match="initializer" mode="cpp">
633 <xsl:text>= </xsl:text>
634 <xsl:apply-templates mode="cpp"/>
637 <xsl:template match="void" mode="cpp">
638 <xsl:text>void </xsl:text>
641 <xsl:template match="methodname" mode="cpp">
642 <xsl:apply-templates mode="cpp"/>
645 <xsl:template match="methodparam" mode="cpp">
646 <xsl:if test="preceding-sibling::methodparam">
647 <xsl:text>, </xsl:text>
649 <xsl:apply-templates mode="cpp"/>
652 <xsl:template match="parameter" mode="cpp">
653 <xsl:apply-templates mode="cpp"/>
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']]"/>
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"/>
670 <xsl:if test="local-name($notmod[1]) != 'methodname'">
671 <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
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; throws </xsl:text>
680 <xsl:apply-templates select="exceptionname" mode="cpp"/>
682 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
683 <xsl:text> </xsl:text>
684 <xsl:apply-templates select="$end-modifiers" mode="cpp"/>
686 <xsl:text>;</xsl:text>
688 <xsl:call-template name="synop-break"/>
691 <!-- ===== IDL ========================================================= -->
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; </xsl:text>
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; </xsl:text>
714 <xsl:if test="ooexception">
715 <xsl:text> throws</xsl:text>
716 <xsl:apply-templates select="ooexception" mode="idl"/>
718 <xsl:text> {&RE;</xsl:text>
719 <xsl:apply-templates select="constructorsynopsis
723 |classsynopsisinfo" mode="idl"/>
724 <xsl:text>}</xsl:text>
728 <xsl:template match="classsynopsisinfo" mode="idl">
729 <xsl:apply-templates mode="idl"/>
732 <xsl:template match="ooclass|oointerface|ooexception" mode="idl">
733 <xsl:if test="preceding-sibling::*">
734 <xsl:text>, </xsl:text>
736 <xsl:apply-templates mode="idl"/>
739 <xsl:template match="modifier|package" mode="idl">
740 <xsl:apply-templates mode="idl"/>
741 <xsl:if test="following-sibling::*">
742 <xsl:text> </xsl:text>
746 <xsl:template match="classname" mode="idl">
747 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
748 <xsl:text>, </xsl:text>
750 <xsl:apply-templates mode="idl"/>
753 <xsl:template match="interfacename" mode="idl">
754 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
755 <xsl:text>, </xsl:text>
757 <xsl:apply-templates mode="idl"/>
760 <xsl:template match="exceptionname" mode="idl">
761 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
762 <xsl:text>, </xsl:text>
764 <xsl:apply-templates mode="idl"/>
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> </xsl:text>
773 <xsl:apply-templates mode="idl"/>
774 <xsl:text>;</xsl:text>
776 <xsl:call-template name="synop-break"/>
779 <xsl:template match="type" mode="idl">
780 <xsl:apply-templates mode="idl"/>
781 <xsl:text> </xsl:text>
784 <xsl:template match="varname" mode="idl">
785 <xsl:apply-templates mode="idl"/>
786 <xsl:text> </xsl:text>
789 <xsl:template match="initializer" mode="idl">
790 <xsl:text>= </xsl:text>
791 <xsl:apply-templates mode="idl"/>
794 <xsl:template match="void" mode="idl">
795 <xsl:text>void </xsl:text>
798 <xsl:template match="methodname" mode="idl">
799 <xsl:apply-templates mode="idl"/>
802 <xsl:template match="methodparam" mode="idl">
803 <xsl:if test="preceding-sibling::methodparam">
804 <xsl:text>, </xsl:text>
806 <xsl:apply-templates mode="idl"/>
809 <xsl:template match="parameter" mode="idl">
810 <xsl:apply-templates mode="idl"/>
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']]"/>
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"/>
827 <xsl:if test="local-name($notmod[1]) != 'methodname'">
828 <xsl:apply-templates select="$notmod[1]" mode="idl"/>
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; raises(</xsl:text>
837 <xsl:apply-templates select="exceptionname" mode="idl"/>
838 <xsl:text>)</xsl:text>
840 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
841 <xsl:text> </xsl:text>
842 <xsl:apply-templates select="$end-modifiers" mode="idl"/>
844 <xsl:text>;</xsl:text>
846 <xsl:call-template name="synop-break"/>
849 <!-- ===== Perl ======================================================== -->
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>
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>
866 <xsl:apply-templates select="constructorsynopsis
870 |classsynopsisinfo" mode="perl"/>
874 <xsl:template match="classsynopsisinfo" mode="perl">
875 <xsl:apply-templates mode="perl"/>
878 <xsl:template match="ooclass|oointerface|ooexception" mode="perl">
879 <xsl:if test="preceding-sibling::*">
880 <xsl:text>, </xsl:text>
882 <xsl:apply-templates mode="perl"/>
885 <xsl:template match="modifier|package" mode="perl">
886 <xsl:apply-templates mode="perl"/>
887 <xsl:if test="following-sibling::*">
888 <xsl:text> </xsl:text>
892 <xsl:template match="classname" mode="perl">
893 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
894 <xsl:text>, </xsl:text>
896 <xsl:apply-templates mode="perl"/>
899 <xsl:template match="interfacename" mode="perl">
900 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
901 <xsl:text>, </xsl:text>
903 <xsl:apply-templates mode="perl"/>
906 <xsl:template match="exceptionname" mode="perl">
907 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
908 <xsl:text>, </xsl:text>
910 <xsl:apply-templates mode="perl"/>
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> </xsl:text>
919 <xsl:apply-templates mode="perl"/>
920 <xsl:text>;</xsl:text>
922 <xsl:call-template name="synop-break"/>
925 <xsl:template match="type" mode="perl">
926 <xsl:apply-templates mode="perl"/>
927 <xsl:text> </xsl:text>
930 <xsl:template match="varname" mode="perl">
931 <xsl:apply-templates mode="perl"/>
932 <xsl:text> </xsl:text>
935 <xsl:template match="initializer" mode="perl">
936 <xsl:text>= </xsl:text>
937 <xsl:apply-templates mode="perl"/>
940 <xsl:template match="void" mode="perl">
941 <xsl:text>void </xsl:text>
944 <xsl:template match="methodname" mode="perl">
945 <xsl:apply-templates mode="perl"/>
948 <xsl:template match="methodparam" mode="perl">
949 <xsl:if test="preceding-sibling::methodparam">
950 <xsl:text>, </xsl:text>
952 <xsl:apply-templates mode="perl"/>
955 <xsl:template match="parameter" mode="perl">
956 <xsl:apply-templates mode="perl"/>
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']]"/>
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>
971 <xsl:apply-templates select="methodname" mode="perl"/>
972 <xsl:text> { ... };</xsl:text>
973 <xsl:call-template name="synop-break"/>
977 <!-- Used when not occurring as a child of classsynopsis -->
978 <xsl:template match="ooclass|oointerface|ooexception">
979 <xsl:apply-templates/>
982 <!-- ==================================================================== -->
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. -->
991 <xsl:template match="link|olink|xref" mode="java">
992 <xsl:apply-templates select="."/>
995 <xsl:template match="link|olink|xref" mode="cpp">
996 <xsl:apply-templates select="."/>
999 <xsl:template match="link|olink|xref" mode="idl">
1000 <xsl:apply-templates select="."/>
1003 <xsl:template match="link|olink|xref" mode="perl">
1004 <xsl:apply-templates select="."/>