2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY nbsp " ">
5 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8 <!-- ********************************************************************
9 $Id: synop.xsl 8421 2009-05-04 07:49:49Z bobstayton $
10 ********************************************************************
12 This file is part of the XSL DocBook Stylesheet distribution.
13 See ../README or http://docbook.sf.net/release/xsl/current/ for
14 copyright and other information.
16 ******************************************************************** -->
18 <!-- ==================================================================== -->
20 <!-- synopsis is in verbatim -->
22 <!-- ==================================================================== -->
24 <xsl:template match="cmdsynopsis">
26 <xsl:apply-templates select="." mode="common.html.attributes"/>
28 <xsl:if test="..//processing-instruction('dbcmdlist')">
29 <!-- * Placing a dbcmdlist PI as a child of a particular element -->
30 <!-- * creates a hyperlinked list of all cmdsynopsis instances -->
31 <!-- * that are descendants of that element; so for any -->
32 <!-- * cmdsynopsis that is a descendant of an element containing -->
33 <!-- * a dbcmdlist PI, we need to output an a@id instance so that -->
34 <!-- * we will have something to link to -->
35 <xsl:call-template name="anchor">
36 <xsl:with-param name="conditional" select="0"/>
39 <xsl:apply-templates/>
44 <xsl:template match="cmdsynopsis/command">
46 <xsl:call-template name="inline.monoseq"/>
47 <xsl:text> </xsl:text>
50 <xsl:template match="cmdsynopsis/command[1]" priority="2">
51 <xsl:call-template name="inline.monoseq"/>
52 <xsl:text> </xsl:text>
55 <xsl:template match="group|arg" name="group-or-arg">
56 <xsl:variable name="choice" select="@choice"/>
57 <xsl:variable name="rep" select="@rep"/>
58 <xsl:variable name="sepchar">
60 <xsl:when test="ancestor-or-self::*/@sepchar">
61 <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
64 <xsl:text> </xsl:text>
69 <xsl:if test="preceding-sibling::*">
70 <xsl:value-of select="$sepchar"/>
73 <xsl:when test="$choice='plain'">
74 <xsl:value-of select="$arg.choice.plain.open.str"/>
76 <xsl:when test="$choice='req'">
77 <xsl:value-of select="$arg.choice.req.open.str"/>
79 <xsl:when test="$choice='opt'">
80 <xsl:value-of select="$arg.choice.opt.open.str"/>
83 <xsl:value-of select="$arg.choice.def.open.str"/>
86 <xsl:apply-templates/>
88 <xsl:when test="$rep='repeat'">
89 <xsl:value-of select="$arg.rep.repeat.str"/>
91 <xsl:when test="$rep='norepeat'">
92 <xsl:value-of select="$arg.rep.norepeat.str"/>
95 <xsl:value-of select="$arg.rep.def.str"/>
99 <xsl:when test="$choice='plain'">
100 <xsl:value-of select="$arg.choice.plain.close.str"/>
102 <xsl:when test="$choice='req'">
103 <xsl:value-of select="$arg.choice.req.close.str"/>
105 <xsl:when test="$choice='opt'">
106 <xsl:value-of select="$arg.choice.opt.close.str"/>
109 <xsl:value-of select="$arg.choice.def.close.str"/>
114 <xsl:template match="group/arg">
115 <xsl:variable name="choice" select="@choice"/>
116 <xsl:variable name="rep" select="@rep"/>
117 <xsl:if test="preceding-sibling::*">
118 <xsl:value-of select="$arg.or.sep"/>
120 <xsl:call-template name="group-or-arg"/>
123 <xsl:template match="sbr">
127 <!-- ==================================================================== -->
129 <xsl:template match="synopfragmentref">
130 <xsl:variable name="target" select="key('id',@linkend)"/>
131 <xsl:variable name="snum">
132 <xsl:apply-templates select="$target" mode="synopfragment.number"/>
135 <a href="#{@linkend}">
136 <xsl:text>(</xsl:text>
137 <xsl:value-of select="$snum"/>
138 <xsl:text>)</xsl:text>
140 <xsl:text> </xsl:text>
141 <xsl:apply-templates/>
145 <xsl:template match="synopfragment" mode="synopfragment.number">
146 <xsl:number format="1"/>
149 <xsl:template match="synopfragment">
150 <xsl:variable name="snum">
151 <xsl:apply-templates select="." mode="synopfragment.number"/>
153 <!-- You can't introduce another <p> here, because you're
154 already in a <p> from cmdsynopsis-->
156 <xsl:variable name="id">
157 <xsl:call-template name="object.id"/>
160 <xsl:text>(</xsl:text>
161 <xsl:value-of select="$snum"/>
162 <xsl:text>)</xsl:text>
164 <xsl:text> </xsl:text>
165 <xsl:apply-templates/>
169 <xsl:template match="funcsynopsis">
170 <xsl:if test="..//processing-instruction('dbfunclist')">
171 <!-- * Placing a dbfunclist PI as a child of a particular element -->
172 <!-- * creates a hyperlinked list of all funcsynopsis instances that -->
173 <!-- * are descendants of that element; so for any funcsynopsis that is -->
174 <!-- * a descendant of an element containing a dbfunclist PI, we need -->
175 <!-- * to output an a@id instance so that we will have something to -->
177 <xsl:call-template name="anchor">
178 <xsl:with-param name="conditional" select="0"/>
181 <xsl:call-template name="informal.object"/>
184 <xsl:template match="funcsynopsisinfo">
186 <xsl:apply-templates select="." mode="common.html.attributes"/>
187 <xsl:apply-templates/>
191 <!-- ====================================================================== -->
192 <!-- funcprototype -->
195 funcprototype ::= (funcdef,
196 (void|varargs|paramdef+))
198 funcdef ::= (#PCDATA|type|replaceable|function)*
200 paramdef ::= (#PCDATA|type|replaceable|parameter|funcparams)*
203 <xsl:template match="funcprototype">
204 <xsl:variable name="html-style">
205 <xsl:call-template name="pi.dbhtml_funcsynopsis-style">
206 <xsl:with-param name="node" select="ancestor::funcsynopsis/descendant-or-self::*"/>
210 <xsl:variable name="style">
212 <xsl:when test="$html-style != ''">
213 <xsl:value-of select="$html-style"/>
216 <xsl:value-of select="$funcsynopsis.style"/>
221 <!-- * 2008-02-17. the code no longer relies on the funcsynopsis.tabular.threshold -->
222 <!-- * param at all (the stuff below has been commented out since mid -->
223 <!-- * 2006), so I completely removed the funcsynopsis.tabular.threshold param -->
224 <!-- * .. MikeSmith -->
226 <xsl:variable name="tabular-p"
227 select="$funcsynopsis.tabular.threshold > 0
228 and string-length(.) > $funcsynopsis.tabular.threshold"/>
231 <xsl:variable name="tabular-p" select="true()"/>
234 <xsl:when test="$style = 'kr' and $tabular-p">
235 <xsl:apply-templates select="." mode="kr-tabular"/>
237 <xsl:when test="$style = 'kr'">
238 <xsl:apply-templates select="." mode="kr-nontabular"/>
240 <xsl:when test="$style = 'ansi' and $tabular-p">
241 <xsl:apply-templates select="." mode="ansi-tabular"/>
244 <xsl:apply-templates select="." mode="ansi-nontabular"/>
249 <!-- ====================================================================== -->
250 <!-- funcprototype: kr, non-tabular -->
252 <xsl:template match="funcprototype" mode="kr-nontabular">
254 <xsl:apply-templates mode="kr-nontabular"/>
255 <xsl:if test="paramdef">
257 <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/>
262 <xsl:template match="funcdef" mode="kr-nontabular">
264 <xsl:apply-templates select="." mode="common.html.attributes"/>
265 <xsl:apply-templates mode="kr-nontabular"/>
266 <xsl:text>(</xsl:text>
270 <xsl:template match="funcdef/function" mode="kr-nontabular">
272 <xsl:when test="$funcsynopsis.decoration != 0">
273 <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
276 <xsl:apply-templates mode="kr-nontabular"/>
281 <xsl:template match="void" mode="kr-nontabular">
283 <xsl:text>;</xsl:text>
286 <xsl:template match="varargs" mode="kr-nontabular">
287 <xsl:text>...</xsl:text>
289 <xsl:text>;</xsl:text>
292 <xsl:template match="paramdef" mode="kr-nontabular">
293 <xsl:apply-templates select="parameter" mode="kr-nontabular"/>
295 <xsl:when test="following-sibling::*">
296 <xsl:text>, </xsl:text>
300 <xsl:text>;</xsl:text>
305 <xsl:template match="paramdef/parameter" mode="kr-nontabular">
307 <xsl:when test="$funcsynopsis.decoration != 0">
308 <var class="pdparam">
309 <xsl:apply-templates mode="kr-nontabular"/>
314 <xsl:apply-templates mode="kr-nontabular"/>
320 <xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
321 <xsl:if test="preceding-sibling::paramdef"><br/></xsl:if>
323 <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
325 <xsl:text>;</xsl:text>
328 <xsl:template match="paramdef/parameter" mode="kr-funcsynopsis-mode">
330 <xsl:when test="$funcsynopsis.decoration != 0">
331 <var class="pdparam">
332 <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
337 <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
343 <xsl:template match="funcparams" mode="kr-funcsynopsis-mode">
345 <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
349 <!-- ====================================================================== -->
350 <!-- funcprototype: kr, tabular -->
352 <xsl:template match="funcprototype" mode="kr-tabular">
353 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"
354 class="funcprototype-table"
358 <xsl:apply-templates select="funcdef" mode="kr-tabular"/>
360 <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="kr-tabular"/>
362 <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
365 <xsl:apply-templates select="." mode="kr-tabular"/>
369 <xsl:if test="paramdef">
370 <div class="paramdef-list">
371 <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/>
374 <div class="funcprototype-spacer"> </div> <!-- hACk: blank div for vertical spacing -->
377 <xsl:template match="funcdef" mode="kr-tabular">
379 <xsl:apply-templates select="." mode="common.html.attributes"/>
380 <xsl:apply-templates mode="kr-tabular"/>
381 <xsl:text>(</xsl:text>
385 <xsl:template match="funcdef/function" mode="kr-tabular">
387 <xsl:when test="$funcsynopsis.decoration != 0">
388 <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
391 <xsl:apply-templates mode="kr-tabular"/>
396 <xsl:template match="void" mode="kr-tabular">
399 <xsl:text>;</xsl:text>
404 <xsl:template match="varargs" mode="kr-tabular">
406 <xsl:text>...</xsl:text>
408 <xsl:text>;</xsl:text>
413 <xsl:template match="paramdef" mode="kr-tabular">
415 <xsl:apply-templates select="parameter" mode="kr-tabular"/>
417 <xsl:when test="following-sibling::*">
418 <xsl:text>, </xsl:text>
422 <xsl:text>;</xsl:text>
429 <xsl:template match="paramdef/parameter" mode="kr-tabular">
431 <xsl:when test="$funcsynopsis.decoration != 0">
432 <var class="pdparam">
433 <xsl:apply-templates mode="kr-tabular"/>
438 <xsl:apply-templates mode="kr-tabular"/>
444 <xsl:template match="paramdef" mode="kr-tabular-funcsynopsis-mode">
445 <xsl:variable name="type">
447 <xsl:when test="type">
448 <xsl:apply-templates select="type"
449 mode="kr-tabular-funcsynopsis-mode"/>
451 <xsl:when test="normalize-space(parameter/preceding-sibling::node()[not(self::parameter)]) != ''">
452 <xsl:copy-of select="parameter/preceding-sibling::node()[not(self::parameter)]"/>
459 <xsl:when test="$type != '' and funcparams">
462 <xsl:copy-of select="$type"/>
464 <xsl:text> </xsl:text>
469 <xsl:when test="type">
470 <xsl:apply-templates select="type/following-sibling::*"
471 mode="kr-tabular-funcsynopsis-mode"/>
474 <xsl:apply-templates select="*"
475 mode="kr-tabular-funcsynopsis-mode"/>
482 <xsl:when test="funcparams">
485 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
493 <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]"
494 mode="kr-tabular-funcsynopsis-mode"/>
496 <xsl:text> </xsl:text>
500 <xsl:apply-templates select="parameter"
502 <xsl:apply-templates select="parameter/following-sibling::*[not(self::parameter)]"
503 mode="kr-tabular-funcsynopsis-mode"/>
504 <xsl:text>;</xsl:text>
512 <xsl:template match="paramdef/parameter" mode="kr-tabular-funcsynopsis-mode">
514 <xsl:when test="$funcsynopsis.decoration != 0">
515 <var class="pdparam">
516 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
521 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
527 <xsl:template match="funcparams" mode="kr-tabular-funcsynopsis-mode">
529 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
531 <xsl:text>;</xsl:text>
534 <!-- ====================================================================== -->
535 <!-- funcprototype: ansi, non-tabular -->
537 <xsl:template match="funcprototype" mode="ansi-nontabular">
539 <xsl:apply-templates mode="ansi-nontabular"/>
543 <xsl:template match="funcdef" mode="ansi-nontabular">
545 <xsl:apply-templates select="." mode="common.html.attributes"/>
546 <xsl:apply-templates mode="ansi-nontabular"/>
547 <xsl:text>(</xsl:text>
551 <xsl:template match="funcdef/function" mode="ansi-nontabular">
553 <xsl:when test="$funcsynopsis.decoration != 0">
554 <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
557 <xsl:apply-templates mode="ansi-nontabular"/>
562 <xsl:template match="void" mode="ansi-nontabular">
564 <xsl:text>;</xsl:text>
567 <xsl:template match="varargs" mode="ansi-nontabular">
568 <xsl:text>...</xsl:text>
570 <xsl:text>;</xsl:text>
573 <xsl:template match="paramdef" mode="ansi-nontabular">
574 <xsl:apply-templates mode="ansi-nontabular"/>
576 <xsl:when test="following-sibling::*">
577 <xsl:text>, </xsl:text>
581 <xsl:text>;</xsl:text>
586 <xsl:template match="paramdef/parameter" mode="ansi-nontabular">
588 <xsl:when test="$funcsynopsis.decoration != 0">
589 <var class="pdparam">
590 <xsl:apply-templates mode="ansi-nontabular"/>
595 <xsl:apply-templates mode="ansi-nontabular"/>
601 <xsl:template match="funcparams" mode="ansi-nontabular">
603 <xsl:apply-templates mode="ansi-nontabular"/>
607 <!-- ====================================================================== -->
608 <!-- funcprototype: ansi, tabular -->
610 <xsl:template match="funcprototype" mode="ansi-tabular">
611 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"
612 class="funcprototype-table"
616 <xsl:apply-templates select="funcdef" mode="ansi-tabular"/>
618 <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="ansi-tabular"/>
620 <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
623 <xsl:apply-templates select="." mode="ansi-tabular"/>
627 <div class="funcprototype-spacer"> </div> <!-- hACk: blank div for vertical spacing -->
630 <xsl:template match="funcdef" mode="ansi-tabular">
632 <xsl:apply-templates select="." mode="common.html.attributes"/>
633 <xsl:apply-templates mode="ansi-tabular"/>
634 <xsl:text>(</xsl:text>
638 <xsl:template match="funcdef/function" mode="ansi-tabular">
640 <xsl:when test="$funcsynopsis.decoration != 0">
641 <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
644 <xsl:apply-templates mode="kr-tabular"/>
649 <xsl:template match="void" mode="ansi-tabular">
652 <xsl:text>;</xsl:text>
657 <xsl:template match="varargs" mode="ansi-tabular">
659 <xsl:text>...</xsl:text>
661 <xsl:text>;</xsl:text>
666 <xsl:template match="paramdef" mode="ansi-tabular">
668 <xsl:apply-templates mode="ansi-tabular"/>
670 <xsl:when test="following-sibling::*">
671 <xsl:text>, </xsl:text>
675 <xsl:text>;</xsl:text>
681 <xsl:template match="paramdef/parameter" mode="ansi-tabular">
683 <xsl:when test="$funcsynopsis.decoration != 0">
684 <var class="pdparam">
685 <xsl:apply-templates mode="ansi-tabular"/>
690 <xsl:apply-templates mode="ansi-tabular"/>
696 <xsl:template match="funcparams" mode="ansi-tabular">
698 <xsl:apply-templates/>
702 <!-- ====================================================================== -->
704 <xsl:variable name="default-classsynopsis-language">java</xsl:variable>
706 <xsl:template match="classsynopsis
710 |destructorsynopsis">
711 <xsl:param name="language">
713 <xsl:when test="@language">
714 <xsl:value-of select="@language"/>
717 <xsl:value-of select="$default-classsynopsis-language"/>
723 <xsl:when test="$language='java' or $language='Java'">
724 <xsl:apply-templates select="." mode="java"/>
726 <xsl:when test="$language='perl' or $language='Perl'">
727 <xsl:apply-templates select="." mode="perl"/>
729 <xsl:when test="$language='idl' or $language='IDL'">
730 <xsl:apply-templates select="." mode="idl"/>
732 <xsl:when test="$language='cpp' or $language='c++' or $language='C++'">
733 <xsl:apply-templates select="." mode="cpp"/>
737 <xsl:text>Unrecognized language on </xsl:text>
738 <xsl:value-of select="local-name(.)"/>
739 <xsl:text>: </xsl:text>
740 <xsl:value-of select="$language"/>
742 <xsl:apply-templates select=".">
743 <xsl:with-param name="language"
744 select="$default-classsynopsis-language"/>
745 </xsl:apply-templates>
750 <xsl:template name="synop-break">
751 <xsl:if test="parent::classsynopsis
752 or (following-sibling::fieldsynopsis
753 |following-sibling::methodsynopsis
754 |following-sibling::constructorsynopsis
755 |following-sibling::destructorsynopsis)">
761 <!-- ===== Java ======================================================== -->
763 <xsl:template match="classsynopsis" mode="java">
765 <xsl:apply-templates select="." mode="common.html.attributes"/>
766 <xsl:apply-templates select="ooclass[1]" mode="java"/>
767 <xsl:if test="ooclass[preceding-sibling::*]">
768 <xsl:text> extends</xsl:text>
769 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="java"/>
770 <xsl:if test="oointerface|ooexception">
772 <xsl:text> </xsl:text>
775 <xsl:if test="oointerface">
776 <xsl:text>implements</xsl:text>
777 <xsl:apply-templates select="oointerface" mode="java"/>
778 <xsl:if test="ooexception">
780 <xsl:text> </xsl:text>
783 <xsl:if test="ooexception">
784 <xsl:text>throws</xsl:text>
785 <xsl:apply-templates select="ooexception" mode="java"/>
787 <xsl:text> {</xsl:text>
789 <xsl:apply-templates select="constructorsynopsis
793 |classsynopsisinfo" mode="java"/>
794 <xsl:text>}</xsl:text>
798 <xsl:template match="classsynopsisinfo" mode="java">
799 <xsl:apply-templates mode="java"/>
802 <xsl:template match="ooclass|oointerface|ooexception" mode="java">
804 <xsl:when test="preceding-sibling::*">
805 <xsl:text>, </xsl:text>
808 <xsl:text> </xsl:text>
812 <xsl:apply-templates select="." mode="common.html.attributes"/>
813 <xsl:apply-templates mode="java"/>
817 <xsl:template match="modifier|package" mode="java">
819 <xsl:apply-templates select="." mode="common.html.attributes"/>
820 <xsl:apply-templates mode="java"/>
821 <xsl:if test="following-sibling::*">
822 <xsl:text> </xsl:text>
827 <xsl:template match="classname" mode="java">
828 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
829 <xsl:text>, </xsl:text>
832 <xsl:apply-templates select="." mode="common.html.attributes"/>
833 <xsl:apply-templates mode="java"/>
837 <xsl:template match="interfacename" mode="java">
838 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
839 <xsl:text>, </xsl:text>
842 <xsl:apply-templates select="." mode="common.html.attributes"/>
843 <xsl:apply-templates mode="java"/>
847 <xsl:template match="exceptionname" mode="java">
848 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
849 <xsl:text>, </xsl:text>
852 <xsl:apply-templates select="." mode="common.html.attributes"/>
853 <xsl:apply-templates mode="java"/>
857 <xsl:template match="fieldsynopsis" mode="java">
859 <xsl:apply-templates select="." mode="common.html.attributes"/>
860 <xsl:if test="parent::classsynopsis">
861 <xsl:text> </xsl:text>
863 <xsl:apply-templates mode="java"/>
864 <xsl:text>;</xsl:text>
866 <xsl:call-template name="synop-break"/>
869 <xsl:template match="type" mode="java">
871 <xsl:apply-templates select="." mode="common.html.attributes"/>
872 <xsl:apply-templates mode="java"/>
873 <xsl:text> </xsl:text>
877 <xsl:template match="varname" mode="java">
879 <xsl:apply-templates select="." mode="common.html.attributes"/>
880 <xsl:apply-templates mode="java"/>
881 <xsl:text> </xsl:text>
885 <xsl:template match="initializer" mode="java">
887 <xsl:apply-templates select="." mode="common.html.attributes"/>
888 <xsl:text>= </xsl:text>
889 <xsl:apply-templates mode="java"/>
893 <xsl:template match="void" mode="java">
895 <xsl:apply-templates select="." mode="common.html.attributes"/>
896 <xsl:text>void </xsl:text>
900 <xsl:template match="methodname" mode="java">
902 <xsl:apply-templates select="." mode="common.html.attributes"/>
903 <xsl:apply-templates mode="java"/>
907 <xsl:template match="methodparam" mode="java">
908 <xsl:param name="indent">0</xsl:param>
909 <xsl:if test="preceding-sibling::methodparam">
910 <xsl:text>,</xsl:text>
912 <xsl:if test="$indent > 0">
913 <xsl:call-template name="copy-string">
914 <xsl:with-param name="string"> </xsl:with-param>
915 <xsl:with-param name="count" select="$indent + 1"/>
920 <xsl:apply-templates select="." mode="common.html.attributes"/>
921 <xsl:apply-templates mode="java"/>
925 <xsl:template match="parameter" mode="java">
927 <xsl:apply-templates select="." mode="common.html.attributes"/>
928 <xsl:apply-templates mode="java"/>
932 <xsl:template mode="java"
933 match="constructorsynopsis|destructorsynopsis|methodsynopsis">
934 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
935 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
936 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
937 <xsl:variable name="decl">
938 <xsl:if test="parent::classsynopsis">
939 <xsl:text> </xsl:text>
941 <xsl:apply-templates select="$start-modifiers" mode="java"/>
944 <xsl:if test="local-name($notmod[1]) != 'methodname'">
945 <xsl:apply-templates select="$notmod[1]" mode="java"/>
948 <xsl:apply-templates select="methodname" mode="java"/>
952 <xsl:apply-templates select="." mode="common.html.attributes"/>
953 <xsl:copy-of select="$decl"/>
954 <xsl:text>(</xsl:text>
955 <xsl:apply-templates select="methodparam" mode="java">
956 <xsl:with-param name="indent" select="string-length($decl)"/>
957 </xsl:apply-templates>
958 <xsl:text>)</xsl:text>
959 <xsl:if test="exceptionname">
961 <xsl:text> throws </xsl:text>
962 <xsl:apply-templates select="exceptionname" mode="java"/>
964 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
965 <xsl:text> </xsl:text>
966 <xsl:apply-templates select="$end-modifiers" mode="java"/>
968 <xsl:text>;</xsl:text>
970 <xsl:call-template name="synop-break"/>
973 <!-- ===== C++ ========================================================= -->
975 <xsl:template match="classsynopsis" mode="cpp">
977 <xsl:apply-templates select="." mode="common.html.attributes"/>
978 <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
979 <xsl:if test="ooclass[preceding-sibling::*]">
980 <xsl:text>: </xsl:text>
981 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="cpp"/>
982 <xsl:if test="oointerface|ooexception">
984 <xsl:text> </xsl:text>
987 <xsl:if test="oointerface">
988 <xsl:text> implements</xsl:text>
989 <xsl:apply-templates select="oointerface" mode="cpp"/>
990 <xsl:if test="ooexception">
992 <xsl:text> </xsl:text>
995 <xsl:if test="ooexception">
996 <xsl:text> throws</xsl:text>
997 <xsl:apply-templates select="ooexception" mode="cpp"/>
999 <xsl:text> {</xsl:text>
1001 <xsl:apply-templates select="constructorsynopsis
1005 |classsynopsisinfo" mode="cpp"/>
1006 <xsl:text>}</xsl:text>
1010 <xsl:template match="classsynopsisinfo" mode="cpp">
1011 <xsl:apply-templates mode="cpp"/>
1014 <xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
1015 <xsl:if test="preceding-sibling::*">
1016 <xsl:text>, </xsl:text>
1019 <xsl:apply-templates select="." mode="common.html.attributes"/>
1020 <xsl:apply-templates mode="cpp"/>
1024 <xsl:template match="modifier|package" mode="cpp">
1026 <xsl:apply-templates select="." mode="common.html.attributes"/>
1027 <xsl:apply-templates mode="cpp"/>
1028 <xsl:if test="following-sibling::*">
1029 <xsl:text> </xsl:text>
1034 <xsl:template match="classname" mode="cpp">
1035 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
1036 <xsl:text>, </xsl:text>
1039 <xsl:apply-templates select="." mode="common.html.attributes"/>
1040 <xsl:apply-templates mode="cpp"/>
1044 <xsl:template match="interfacename" mode="cpp">
1045 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
1046 <xsl:text>, </xsl:text>
1049 <xsl:apply-templates select="." mode="common.html.attributes"/>
1050 <xsl:apply-templates mode="cpp"/>
1054 <xsl:template match="exceptionname" mode="cpp">
1055 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
1056 <xsl:text>, </xsl:text>
1059 <xsl:apply-templates select="." mode="common.html.attributes"/>
1060 <xsl:apply-templates mode="cpp"/>
1064 <xsl:template match="fieldsynopsis" mode="cpp">
1066 <xsl:apply-templates select="." mode="common.html.attributes"/>
1067 <xsl:if test="parent::classsynopsis">
1068 <xsl:text> </xsl:text>
1070 <xsl:apply-templates mode="cpp"/>
1071 <xsl:text>;</xsl:text>
1073 <xsl:call-template name="synop-break"/>
1076 <xsl:template match="type" mode="cpp">
1078 <xsl:apply-templates select="." mode="common.html.attributes"/>
1079 <xsl:apply-templates mode="cpp"/>
1080 <xsl:text> </xsl:text>
1084 <xsl:template match="varname" mode="cpp">
1086 <xsl:apply-templates select="." mode="common.html.attributes"/>
1087 <xsl:apply-templates mode="cpp"/>
1088 <xsl:text> </xsl:text>
1092 <xsl:template match="initializer" mode="cpp">
1094 <xsl:apply-templates select="." mode="common.html.attributes"/>
1095 <xsl:text>= </xsl:text>
1096 <xsl:apply-templates mode="cpp"/>
1100 <xsl:template match="void" mode="cpp">
1102 <xsl:apply-templates select="." mode="common.html.attributes"/>
1103 <xsl:text>void </xsl:text>
1107 <xsl:template match="methodname" mode="cpp">
1109 <xsl:apply-templates select="." mode="common.html.attributes"/>
1110 <xsl:apply-templates mode="cpp"/>
1114 <xsl:template match="methodparam" mode="cpp">
1115 <xsl:if test="preceding-sibling::methodparam">
1116 <xsl:text>, </xsl:text>
1119 <xsl:apply-templates select="." mode="common.html.attributes"/>
1120 <xsl:apply-templates mode="cpp"/>
1124 <xsl:template match="parameter" mode="cpp">
1126 <xsl:apply-templates select="." mode="common.html.attributes"/>
1127 <xsl:apply-templates mode="cpp"/>
1131 <xsl:template mode="cpp"
1132 match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1133 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1134 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
1135 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1138 <xsl:apply-templates select="." mode="common.html.attributes"/>
1139 <xsl:if test="parent::classsynopsis">
1140 <xsl:text> </xsl:text>
1142 <xsl:apply-templates select="$start-modifiers" mode="cpp"/>
1145 <xsl:if test="local-name($notmod[1]) != 'methodname'">
1146 <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
1149 <xsl:apply-templates select="methodname" mode="cpp"/>
1150 <xsl:text>(</xsl:text>
1151 <xsl:apply-templates select="methodparam" mode="cpp"/>
1152 <xsl:text>)</xsl:text>
1153 <xsl:if test="exceptionname">
1155 <xsl:text> throws </xsl:text>
1156 <xsl:apply-templates select="exceptionname" mode="cpp"/>
1158 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
1159 <xsl:text> </xsl:text>
1160 <xsl:apply-templates select="$end-modifiers" mode="cpp"/>
1162 <xsl:text>;</xsl:text>
1164 <xsl:call-template name="synop-break"/>
1167 <!-- ===== IDL ========================================================= -->
1169 <xsl:template match="classsynopsis" mode="idl">
1171 <xsl:apply-templates select="." mode="common.html.attributes"/>
1172 <xsl:text>interface </xsl:text>
1173 <xsl:apply-templates select="ooclass[1]" mode="idl"/>
1174 <xsl:if test="ooclass[preceding-sibling::*]">
1175 <xsl:text>: </xsl:text>
1176 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="idl"/>
1177 <xsl:if test="oointerface|ooexception">
1179 <xsl:text> </xsl:text>
1182 <xsl:if test="oointerface">
1183 <xsl:text> implements</xsl:text>
1184 <xsl:apply-templates select="oointerface" mode="idl"/>
1185 <xsl:if test="ooexception">
1187 <xsl:text> </xsl:text>
1190 <xsl:if test="ooexception">
1191 <xsl:text> throws</xsl:text>
1192 <xsl:apply-templates select="ooexception" mode="idl"/>
1194 <xsl:text> {</xsl:text>
1196 <xsl:apply-templates select="constructorsynopsis
1200 |classsynopsisinfo" mode="idl"/>
1201 <xsl:text>}</xsl:text>
1205 <xsl:template match="classsynopsisinfo" mode="idl">
1206 <xsl:apply-templates mode="idl"/>
1209 <xsl:template match="ooclass|oointerface|ooexception" mode="idl">
1210 <xsl:if test="preceding-sibling::*">
1211 <xsl:text>, </xsl:text>
1214 <xsl:apply-templates select="." mode="common.html.attributes"/>
1215 <xsl:apply-templates mode="idl"/>
1219 <xsl:template match="modifier|package" mode="idl">
1221 <xsl:apply-templates select="." mode="common.html.attributes"/>
1222 <xsl:apply-templates mode="idl"/>
1223 <xsl:if test="following-sibling::*">
1224 <xsl:text> </xsl:text>
1229 <xsl:template match="classname" mode="idl">
1230 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
1231 <xsl:text>, </xsl:text>
1234 <xsl:apply-templates select="." mode="common.html.attributes"/>
1235 <xsl:apply-templates mode="idl"/>
1239 <xsl:template match="interfacename" mode="idl">
1240 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
1241 <xsl:text>, </xsl:text>
1244 <xsl:apply-templates select="." mode="common.html.attributes"/>
1245 <xsl:apply-templates mode="idl"/>
1249 <xsl:template match="exceptionname" mode="idl">
1250 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
1251 <xsl:text>, </xsl:text>
1254 <xsl:apply-templates select="." mode="common.html.attributes"/>
1255 <xsl:apply-templates mode="idl"/>
1259 <xsl:template match="fieldsynopsis" mode="idl">
1261 <xsl:apply-templates select="." mode="common.html.attributes"/>
1262 <xsl:if test="parent::classsynopsis">
1263 <xsl:text> </xsl:text>
1265 <xsl:apply-templates mode="idl"/>
1266 <xsl:text>;</xsl:text>
1268 <xsl:call-template name="synop-break"/>
1271 <xsl:template match="type" mode="idl">
1273 <xsl:apply-templates select="." mode="common.html.attributes"/>
1274 <xsl:apply-templates mode="idl"/>
1275 <xsl:text> </xsl:text>
1279 <xsl:template match="varname" mode="idl">
1281 <xsl:apply-templates select="." mode="common.html.attributes"/>
1282 <xsl:apply-templates mode="idl"/>
1283 <xsl:text> </xsl:text>
1287 <xsl:template match="initializer" mode="idl">
1289 <xsl:apply-templates select="." mode="common.html.attributes"/>
1290 <xsl:text>= </xsl:text>
1291 <xsl:apply-templates mode="idl"/>
1295 <xsl:template match="void" mode="idl">
1297 <xsl:apply-templates select="." mode="common.html.attributes"/>
1298 <xsl:text>void </xsl:text>
1302 <xsl:template match="methodname" mode="idl">
1304 <xsl:apply-templates select="." mode="common.html.attributes"/>
1305 <xsl:apply-templates mode="idl"/>
1309 <xsl:template match="methodparam" mode="idl">
1310 <xsl:if test="preceding-sibling::methodparam">
1311 <xsl:text>, </xsl:text>
1314 <xsl:apply-templates select="." mode="common.html.attributes"/>
1315 <xsl:apply-templates mode="idl"/>
1319 <xsl:template match="parameter" mode="idl">
1321 <xsl:apply-templates select="." mode="common.html.attributes"/>
1322 <xsl:apply-templates mode="idl"/>
1326 <xsl:template mode="idl"
1327 match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1328 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1329 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
1330 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1332 <xsl:apply-templates select="." mode="common.html.attributes"/>
1333 <xsl:if test="parent::classsynopsis">
1334 <xsl:text> </xsl:text>
1336 <xsl:apply-templates select="$start-modifiers" mode="idl"/>
1339 <xsl:if test="local-name($notmod[1]) != 'methodname'">
1340 <xsl:apply-templates select="$notmod[1]" mode="idl"/>
1343 <xsl:apply-templates select="methodname" mode="idl"/>
1344 <xsl:text>(</xsl:text>
1345 <xsl:apply-templates select="methodparam" mode="idl"/>
1346 <xsl:text>)</xsl:text>
1347 <xsl:if test="exceptionname">
1349 <xsl:text> raises(</xsl:text>
1350 <xsl:apply-templates select="exceptionname" mode="idl"/>
1351 <xsl:text>)</xsl:text>
1353 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
1354 <xsl:text> </xsl:text>
1355 <xsl:apply-templates select="$end-modifiers" mode="idl"/>
1357 <xsl:text>;</xsl:text>
1359 <xsl:call-template name="synop-break"/>
1362 <!-- ===== Perl ======================================================== -->
1364 <xsl:template match="classsynopsis" mode="perl">
1366 <xsl:apply-templates select="." mode="common.html.attributes"/>
1367 <xsl:text>package </xsl:text>
1368 <xsl:apply-templates select="ooclass[1]" mode="perl"/>
1369 <xsl:text>;</xsl:text>
1372 <xsl:if test="ooclass[preceding-sibling::*]">
1373 <xsl:text>@ISA = (</xsl:text>
1374 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="perl"/>
1375 <xsl:text>);</xsl:text>
1379 <xsl:apply-templates select="constructorsynopsis
1383 |classsynopsisinfo" mode="perl"/>
1387 <xsl:template match="classsynopsisinfo" mode="perl">
1388 <xsl:apply-templates mode="perl"/>
1391 <xsl:template match="ooclass|oointerface|ooexception" mode="perl">
1392 <xsl:if test="preceding-sibling::*">
1393 <xsl:text>, </xsl:text>
1396 <xsl:apply-templates select="." mode="common.html.attributes"/>
1397 <xsl:apply-templates mode="perl"/>
1401 <xsl:template match="modifier|package" mode="perl">
1403 <xsl:apply-templates select="." mode="common.html.attributes"/>
1404 <xsl:apply-templates mode="perl"/>
1405 <xsl:if test="following-sibling::*">
1406 <xsl:text> </xsl:text>
1411 <xsl:template match="classname" mode="perl">
1412 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
1413 <xsl:text>, </xsl:text>
1416 <xsl:apply-templates select="." mode="common.html.attributes"/>
1417 <xsl:apply-templates mode="perl"/>
1421 <xsl:template match="interfacename" mode="perl">
1422 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
1423 <xsl:text>, </xsl:text>
1426 <xsl:apply-templates select="." mode="common.html.attributes"/>
1427 <xsl:apply-templates mode="perl"/>
1431 <xsl:template match="exceptionname" mode="perl">
1432 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
1433 <xsl:text>, </xsl:text>
1436 <xsl:apply-templates select="." mode="common.html.attributes"/>
1437 <xsl:apply-templates mode="perl"/>
1441 <xsl:template match="fieldsynopsis" mode="perl">
1443 <xsl:apply-templates select="." mode="common.html.attributes"/>
1444 <xsl:if test="parent::classsynopsis">
1445 <xsl:text> </xsl:text>
1447 <xsl:apply-templates mode="perl"/>
1448 <xsl:text>;</xsl:text>
1450 <xsl:call-template name="synop-break"/>
1453 <xsl:template match="type" mode="perl">
1455 <xsl:apply-templates select="." mode="common.html.attributes"/>
1456 <xsl:apply-templates mode="perl"/>
1457 <xsl:text> </xsl:text>
1461 <xsl:template match="varname" mode="perl">
1463 <xsl:apply-templates select="." mode="common.html.attributes"/>
1464 <xsl:apply-templates mode="perl"/>
1465 <xsl:text> </xsl:text>
1469 <xsl:template match="initializer" mode="perl">
1471 <xsl:apply-templates select="." mode="common.html.attributes"/>
1472 <xsl:text>= </xsl:text>
1473 <xsl:apply-templates mode="perl"/>
1477 <xsl:template match="void" mode="perl">
1479 <xsl:apply-templates select="." mode="common.html.attributes"/>
1480 <xsl:text>void </xsl:text>
1484 <xsl:template match="methodname" mode="perl">
1486 <xsl:apply-templates select="." mode="common.html.attributes"/>
1487 <xsl:apply-templates mode="perl"/>
1491 <xsl:template match="methodparam" mode="perl">
1492 <xsl:if test="preceding-sibling::methodparam">
1493 <xsl:text>, </xsl:text>
1496 <xsl:apply-templates select="." mode="common.html.attributes"/>
1497 <xsl:apply-templates mode="perl"/>
1501 <xsl:template match="parameter" mode="perl">
1503 <xsl:apply-templates select="." mode="common.html.attributes"/>
1504 <xsl:apply-templates mode="perl"/>
1508 <xsl:template mode="perl"
1509 match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1510 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1511 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
1512 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1515 <xsl:apply-templates select="." mode="common.html.attributes"/>
1516 <xsl:text>sub </xsl:text>
1518 <xsl:apply-templates select="methodname" mode="perl"/>
1519 <xsl:text> { ... };</xsl:text>
1521 <xsl:call-template name="synop-break"/>
1524 <!-- Used when not occurring as a child of classsynopsis -->
1525 <xsl:template match="ooclass|oointerface|ooexception">
1526 <xsl:apply-templates/>
1529 <!-- ==================================================================== -->
1531 <!-- * DocBook 5 allows linking elements (link, olink, and xref) -->
1532 <!-- * within the OO *synopsis elements (classsynopsis, fieldsynopsis, -->
1533 <!-- * methodsynopsis, constructorsynopsis, destructorsynopsis) and -->
1534 <!-- * their children. So we need to have mode="java|cpp|idl|perl" -->
1535 <!-- * per-mode matches for those linking elements in order for them -->
1536 <!-- * to be processed as expected. -->
1538 <xsl:template match="link|olink|xref" mode="java">
1539 <xsl:apply-templates select="."/>
1542 <xsl:template match="link|olink|xref" mode="cpp">
1543 <xsl:apply-templates select="."/>
1546 <xsl:template match="link|olink|xref" mode="idl">
1547 <xsl:apply-templates select="."/>
1550 <xsl:template match="link|olink|xref" mode="perl">
1551 <xsl:apply-templates select="."/>