1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
4 <!-- ********************************************************************
5 $Id: synop.xsl 8421 2009-05-04 07:49:49Z bobstayton $
6 ********************************************************************
8 This file is part of the XSL DocBook Stylesheet distribution.
9 See ../README or http://docbook.sf.net/release/xsl/current/ for
10 copyright and other information.
12 ******************************************************************** -->
14 <!-- ==================================================================== -->
16 <!-- synopsis is in verbatim -->
18 <!-- ==================================================================== -->
20 <xsl:template match="cmdsynopsis">
22 <xsl:apply-templates select="." mode="common.html.attributes"/>
24 <xsl:if test="..//processing-instruction('dbcmdlist')">
25 <!-- * Placing a dbcmdlist PI as a child of a particular element -->
26 <!-- * creates a hyperlinked list of all cmdsynopsis instances -->
27 <!-- * that are descendants of that element; so for any -->
28 <!-- * cmdsynopsis that is a descendant of an element containing -->
29 <!-- * a dbcmdlist PI, we need to output an a@id instance so that -->
30 <!-- * we will have something to link to -->
31 <xsl:call-template name="anchor">
32 <xsl:with-param name="conditional" select="0"/>
35 <xsl:apply-templates/>
40 <xsl:template match="cmdsynopsis/command">
44 <xsl:call-template name="inline.monoseq"/>
45 <xsl:text> </xsl:text>
48 <xsl:template match="cmdsynopsis/command[1]" priority="2">
49 <xsl:call-template name="inline.monoseq"/>
50 <xsl:text> </xsl:text>
53 <xsl:template match="group|arg" name="group-or-arg">
54 <xsl:variable name="choice" select="@choice"/>
55 <xsl:variable name="rep" select="@rep"/>
56 <xsl:variable name="sepchar">
58 <xsl:when test="ancestor-or-self::*/@sepchar">
59 <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
62 <xsl:text> </xsl:text>
67 <xsl:if test="preceding-sibling::*">
68 <xsl:value-of select="$sepchar"/>
71 <xsl:when test="$choice='plain'">
72 <xsl:value-of select="$arg.choice.plain.open.str"/>
74 <xsl:when test="$choice='req'">
75 <xsl:value-of select="$arg.choice.req.open.str"/>
77 <xsl:when test="$choice='opt'">
78 <xsl:value-of select="$arg.choice.opt.open.str"/>
81 <xsl:value-of select="$arg.choice.def.open.str"/>
84 <xsl:apply-templates/>
86 <xsl:when test="$rep='repeat'">
87 <xsl:value-of select="$arg.rep.repeat.str"/>
89 <xsl:when test="$rep='norepeat'">
90 <xsl:value-of select="$arg.rep.norepeat.str"/>
93 <xsl:value-of select="$arg.rep.def.str"/>
97 <xsl:when test="$choice='plain'">
98 <xsl:value-of select="$arg.choice.plain.close.str"/>
100 <xsl:when test="$choice='req'">
101 <xsl:value-of select="$arg.choice.req.close.str"/>
103 <xsl:when test="$choice='opt'">
104 <xsl:value-of select="$arg.choice.opt.close.str"/>
107 <xsl:value-of select="$arg.choice.def.close.str"/>
112 <xsl:template match="group/arg">
113 <xsl:variable name="choice" select="@choice"/>
114 <xsl:variable name="rep" select="@rep"/>
115 <xsl:if test="preceding-sibling::*">
116 <xsl:value-of select="$arg.or.sep"/>
118 <xsl:call-template name="group-or-arg"/>
121 <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:text><xsl:text>.nf
188 <xsl:apply-templates select="." mode="common.html.attributes"/>
189 <xsl:apply-templates/>
190 </pre><xsl:text/><xsl:text>.fi
194 <!-- ====================================================================== -->
195 <!-- funcprototype -->
198 funcprototype ::= (funcdef,
199 (void|varargs|paramdef+))
201 funcdef ::= (#PCDATA|type|replaceable|function)*
203 paramdef ::= (#PCDATA|type|replaceable|parameter|funcparams)*
206 <xsl:template match="funcprototype">
207 <xsl:variable name="html-style">
208 <xsl:call-template name="pi.dbhtml_funcsynopsis-style">
209 <xsl:with-param name="node" select="ancestor::funcsynopsis/descendant-or-self::*"/>
213 <xsl:variable name="style">
215 <xsl:when test="$html-style != ''">
216 <xsl:value-of select="$html-style"/>
219 <xsl:value-of select="$funcsynopsis.style"/>
224 <!-- * 2008-02-17. the code no longer relies on the funcsynopsis.tabular.threshold -->
225 <!-- * param at all (the stuff below has been commented out since mid -->
226 <!-- * 2006), so I completely removed the funcsynopsis.tabular.threshold param -->
227 <!-- * .. MikeSmith -->
229 <xsl:variable name="tabular-p"
230 select="$funcsynopsis.tabular.threshold > 0
231 and string-length(.) > $funcsynopsis.tabular.threshold"/>
234 <xsl:variable name="tabular-p" select="true()"/>
237 <xsl:when test="$style = 'kr' and $tabular-p">
238 <xsl:apply-templates select="." mode="kr-tabular"/>
240 <xsl:when test="$style = 'kr'">
241 <xsl:apply-templates select="." mode="kr-nontabular"/>
243 <xsl:when test="$style = 'ansi' and $tabular-p">
244 <xsl:apply-templates select="." mode="ansi-tabular"/>
247 <xsl:apply-templates select="." mode="ansi-nontabular"/>
252 <!-- ====================================================================== -->
253 <!-- funcprototype: kr, non-tabular -->
255 <xsl:template match="funcprototype" mode="kr-nontabular">
257 <xsl:apply-templates mode="kr-nontabular"/>
258 <xsl:if test="paramdef">
262 <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/>
267 <xsl:template match="funcdef" mode="kr-nontabular">
269 <xsl:apply-templates select="." mode="common.html.attributes"/>
270 <xsl:apply-templates mode="kr-nontabular"/>
271 <xsl:text>(</xsl:text>
275 <xsl:template match="funcdef/function" mode="kr-nontabular">
277 <xsl:when test="$funcsynopsis.decoration != 0">
278 <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
281 <xsl:apply-templates mode="kr-nontabular"/>
286 <xsl:template match="void" mode="kr-nontabular">
288 <xsl:text>;</xsl:text>
291 <xsl:template match="varargs" mode="kr-nontabular">
292 <xsl:text>...</xsl:text>
294 <xsl:text>;</xsl:text>
297 <xsl:template match="paramdef" mode="kr-nontabular">
298 <xsl:apply-templates select="parameter" mode="kr-nontabular"/>
300 <xsl:when test="following-sibling::*">
301 <xsl:text>, </xsl:text>
305 <xsl:text>;</xsl:text>
310 <xsl:template match="paramdef/parameter" mode="kr-nontabular">
312 <xsl:when test="$funcsynopsis.decoration != 0">
313 <var class="pdparam">
314 <xsl:apply-templates mode="kr-nontabular"/>
319 <xsl:apply-templates mode="kr-nontabular"/>
325 <xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
326 <xsl:if test="preceding-sibling::paramdef"><xsl:text>
330 <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
332 <xsl:text>;</xsl:text>
335 <xsl:template match="paramdef/parameter" mode="kr-funcsynopsis-mode">
337 <xsl:when test="$funcsynopsis.decoration != 0">
338 <var class="pdparam">
339 <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
344 <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
350 <xsl:template match="funcparams" mode="kr-funcsynopsis-mode">
352 <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
356 <!-- ====================================================================== -->
357 <!-- funcprototype: kr, tabular -->
359 <xsl:template match="funcprototype" mode="kr-tabular">
360 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table">
363 <xsl:apply-templates select="funcdef" mode="kr-tabular"/>
365 <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="kr-tabular"/>
367 <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
370 <xsl:apply-templates select="." mode="kr-tabular"/>
374 <xsl:if test="paramdef">
375 <div class="paramdef-list">
376 <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/>
379 <div class="funcprototype-spacer"> </div> <!-- hACk: blank div for vertical spacing -->
382 <xsl:template match="funcdef" mode="kr-tabular">
384 <xsl:apply-templates select="." mode="common.html.attributes"/>
385 <xsl:apply-templates mode="kr-tabular"/>
386 <xsl:text>(</xsl:text>
390 <xsl:template match="funcdef/function" mode="kr-tabular">
392 <xsl:when test="$funcsynopsis.decoration != 0">
393 <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
396 <xsl:apply-templates mode="kr-tabular"/>
401 <xsl:template match="void" mode="kr-tabular">
404 <xsl:text>;</xsl:text>
409 <xsl:template match="varargs" mode="kr-tabular">
411 <xsl:text>...</xsl:text>
413 <xsl:text>;</xsl:text>
418 <xsl:template match="paramdef" mode="kr-tabular">
420 <xsl:apply-templates select="parameter" mode="kr-tabular"/>
422 <xsl:when test="following-sibling::*">
423 <xsl:text>, </xsl:text>
427 <xsl:text>;</xsl:text>
434 <xsl:template match="paramdef/parameter" mode="kr-tabular">
436 <xsl:when test="$funcsynopsis.decoration != 0">
437 <var class="pdparam">
438 <xsl:apply-templates mode="kr-tabular"/>
443 <xsl:apply-templates mode="kr-tabular"/>
449 <xsl:template match="paramdef" mode="kr-tabular-funcsynopsis-mode">
450 <xsl:variable name="type">
452 <xsl:when test="type">
453 <xsl:apply-templates select="type" mode="kr-tabular-funcsynopsis-mode"/>
455 <xsl:when test="normalize-space(parameter/preceding-sibling::node()[not(self::parameter)]) != ''">
456 <xsl:copy-of select="parameter/preceding-sibling::node()[not(self::parameter)]"/>
463 <xsl:when test="$type != '' and funcparams">
466 <xsl:copy-of select="$type"/>
468 <xsl:text> </xsl:text>
473 <xsl:when test="type">
474 <xsl:apply-templates select="type/following-sibling::*" mode="kr-tabular-funcsynopsis-mode"/>
477 <xsl:apply-templates select="*" mode="kr-tabular-funcsynopsis-mode"/>
484 <xsl:when test="funcparams">
487 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
495 <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]" mode="kr-tabular-funcsynopsis-mode"/>
497 <xsl:text> </xsl:text>
501 <xsl:apply-templates select="parameter" mode="kr-tabular"/>
502 <xsl:apply-templates select="parameter/following-sibling::*[not(self::parameter)]" mode="kr-tabular-funcsynopsis-mode"/>
503 <xsl:text>;</xsl:text>
511 <xsl:template match="paramdef/parameter" mode="kr-tabular-funcsynopsis-mode">
513 <xsl:when test="$funcsynopsis.decoration != 0">
514 <var class="pdparam">
515 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
520 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
526 <xsl:template match="funcparams" mode="kr-tabular-funcsynopsis-mode">
528 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
530 <xsl:text>;</xsl:text>
533 <!-- ====================================================================== -->
534 <!-- funcprototype: ansi, non-tabular -->
536 <xsl:template match="funcprototype" mode="ansi-nontabular">
538 <xsl:apply-templates mode="ansi-nontabular"/>
542 <xsl:template match="funcdef" mode="ansi-nontabular">
544 <xsl:apply-templates select="." mode="common.html.attributes"/>
545 <xsl:apply-templates mode="ansi-nontabular"/>
546 <xsl:text>(</xsl:text>
550 <xsl:template match="funcdef/function" mode="ansi-nontabular">
552 <xsl:when test="$funcsynopsis.decoration != 0">
553 <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
556 <xsl:apply-templates mode="ansi-nontabular"/>
561 <xsl:template match="void" mode="ansi-nontabular">
563 <xsl:text>;</xsl:text>
566 <xsl:template match="varargs" mode="ansi-nontabular">
567 <xsl:text>...</xsl:text>
569 <xsl:text>;</xsl:text>
572 <xsl:template match="paramdef" mode="ansi-nontabular">
573 <xsl:apply-templates mode="ansi-nontabular"/>
575 <xsl:when test="following-sibling::*">
576 <xsl:text>, </xsl:text>
580 <xsl:text>;</xsl:text>
585 <xsl:template match="paramdef/parameter" mode="ansi-nontabular">
587 <xsl:when test="$funcsynopsis.decoration != 0">
588 <var class="pdparam">
589 <xsl:apply-templates mode="ansi-nontabular"/>
594 <xsl:apply-templates mode="ansi-nontabular"/>
600 <xsl:template match="funcparams" mode="ansi-nontabular">
602 <xsl:apply-templates mode="ansi-nontabular"/>
606 <!-- ====================================================================== -->
607 <!-- funcprototype: ansi, tabular -->
609 <xsl:template match="funcprototype" mode="ansi-tabular">
610 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table">
613 <xsl:apply-templates select="funcdef" mode="ansi-tabular"/>
615 <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="ansi-tabular"/>
617 <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
620 <xsl:apply-templates select="." mode="ansi-tabular"/>
624 <div class="funcprototype-spacer"> </div> <!-- hACk: blank div for vertical spacing -->
627 <xsl:template match="funcdef" mode="ansi-tabular">
629 <xsl:apply-templates select="." mode="common.html.attributes"/>
630 <xsl:apply-templates mode="ansi-tabular"/>
631 <xsl:text>(</xsl:text>
635 <xsl:template match="funcdef/function" mode="ansi-tabular">
637 <xsl:when test="$funcsynopsis.decoration != 0">
638 <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
641 <xsl:apply-templates mode="kr-tabular"/>
646 <xsl:template match="void" mode="ansi-tabular">
649 <xsl:text>;</xsl:text>
654 <xsl:template match="varargs" mode="ansi-tabular">
656 <xsl:text>...</xsl:text>
658 <xsl:text>;</xsl:text>
663 <xsl:template match="paramdef" mode="ansi-tabular">
665 <xsl:apply-templates mode="ansi-tabular"/>
667 <xsl:when test="following-sibling::*">
668 <xsl:text>, </xsl:text>
672 <xsl:text>;</xsl:text>
678 <xsl:template match="paramdef/parameter" mode="ansi-tabular">
680 <xsl:when test="$funcsynopsis.decoration != 0">
681 <var class="pdparam">
682 <xsl:apply-templates mode="ansi-tabular"/>
687 <xsl:apply-templates mode="ansi-tabular"/>
693 <xsl:template match="funcparams" mode="ansi-tabular">
695 <xsl:apply-templates/>
699 <!-- ====================================================================== -->
701 <xsl:variable name="default-classsynopsis-language">java</xsl:variable>
703 <xsl:template match="classsynopsis |fieldsynopsis |methodsynopsis |constructorsynopsis |destructorsynopsis">
704 <xsl:param name="language">
706 <xsl:when test="@language">
707 <xsl:value-of select="@language"/>
710 <xsl:value-of select="$default-classsynopsis-language"/>
716 <xsl:when test="$language='java' or $language='Java'">
717 <xsl:apply-templates select="." mode="java"/>
719 <xsl:when test="$language='perl' or $language='Perl'">
720 <xsl:apply-templates select="." mode="perl"/>
722 <xsl:when test="$language='idl' or $language='IDL'">
723 <xsl:apply-templates select="." mode="idl"/>
725 <xsl:when test="$language='cpp' or $language='c++' or $language='C++'">
726 <xsl:apply-templates select="." mode="cpp"/>
730 <xsl:text>Unrecognized language on </xsl:text>
731 <xsl:value-of select="local-name(.)"/>
732 <xsl:text>: </xsl:text>
733 <xsl:value-of select="$language"/>
735 <xsl:apply-templates select=".">
736 <xsl:with-param name="language" select="$default-classsynopsis-language"/>
737 </xsl:apply-templates>
742 <xsl:template name="synop-break">
743 <xsl:if test="parent::classsynopsis or (following-sibling::fieldsynopsis |following-sibling::methodsynopsis |following-sibling::constructorsynopsis |following-sibling::destructorsynopsis)">
751 <!-- ===== Java ======================================================== -->
753 <xsl:template match="classsynopsis" mode="java">
755 </xsl:text><xsl:text>.nf
757 <xsl:apply-templates select="." mode="common.html.attributes"/>
758 <xsl:apply-templates select="ooclass[1]" mode="java"/>
759 <xsl:if test="ooclass[preceding-sibling::*]">
760 <xsl:text> extends</xsl:text>
761 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="java"/>
762 <xsl:if test="oointerface|ooexception">
766 <xsl:text> </xsl:text>
769 <xsl:if test="oointerface">
770 <xsl:text>implements</xsl:text>
771 <xsl:apply-templates select="oointerface" mode="java"/>
772 <xsl:if test="ooexception">
776 <xsl:text> </xsl:text>
779 <xsl:if test="ooexception">
780 <xsl:text>throws</xsl:text>
781 <xsl:apply-templates select="ooexception" mode="java"/>
783 <xsl:text> {</xsl:text>
787 <xsl:apply-templates select="constructorsynopsis |destructorsynopsis |fieldsynopsis |methodsynopsis |classsynopsisinfo" mode="java"/>
788 <xsl:text>}</xsl:text>
789 </pre><xsl:text/><xsl:text>.fi
793 <xsl:template match="classsynopsisinfo" mode="java">
794 <xsl:apply-templates mode="java"/>
797 <xsl:template match="ooclass|oointerface|ooexception" mode="java">
799 <xsl:when test="preceding-sibling::*">
800 <xsl:text>, </xsl:text>
803 <xsl:text> </xsl:text>
807 <xsl:apply-templates select="." mode="common.html.attributes"/>
808 <xsl:apply-templates mode="java"/>
812 <xsl:template match="modifier|package" mode="java">
814 <xsl:apply-templates select="." mode="common.html.attributes"/>
815 <xsl:apply-templates mode="java"/>
816 <xsl:if test="following-sibling::*">
817 <xsl:text> </xsl:text>
822 <xsl:template match="classname" mode="java">
823 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
824 <xsl:text>, </xsl:text>
827 <xsl:apply-templates select="." mode="common.html.attributes"/>
828 <xsl:apply-templates mode="java"/>
832 <xsl:template match="interfacename" mode="java">
833 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
834 <xsl:text>, </xsl:text>
837 <xsl:apply-templates select="." mode="common.html.attributes"/>
838 <xsl:apply-templates mode="java"/>
842 <xsl:template match="exceptionname" mode="java">
843 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
844 <xsl:text>, </xsl:text>
847 <xsl:apply-templates select="." mode="common.html.attributes"/>
848 <xsl:apply-templates mode="java"/>
852 <xsl:template match="fieldsynopsis" mode="java">
854 <xsl:apply-templates select="." mode="common.html.attributes"/>
855 <xsl:if test="parent::classsynopsis">
856 <xsl:text> </xsl:text>
858 <xsl:apply-templates mode="java"/>
859 <xsl:text>;</xsl:text>
861 <xsl:call-template name="synop-break"/>
864 <xsl:template match="type" mode="java">
866 <xsl:apply-templates select="." mode="common.html.attributes"/>
867 <xsl:apply-templates mode="java"/>
868 <xsl:text> </xsl:text>
872 <xsl:template match="varname" mode="java">
874 <xsl:apply-templates select="." mode="common.html.attributes"/>
875 <xsl:apply-templates mode="java"/>
876 <xsl:text> </xsl:text>
880 <xsl:template match="initializer" mode="java">
882 <xsl:apply-templates select="." mode="common.html.attributes"/>
883 <xsl:text>= </xsl:text>
884 <xsl:apply-templates mode="java"/>
888 <xsl:template match="void" mode="java">
890 <xsl:apply-templates select="." mode="common.html.attributes"/>
891 <xsl:text>void </xsl:text>
895 <xsl:template match="methodname" mode="java">
897 <xsl:apply-templates select="." mode="common.html.attributes"/>
898 <xsl:apply-templates mode="java"/>
902 <xsl:template match="methodparam" mode="java">
903 <xsl:param name="indent">0</xsl:param>
904 <xsl:if test="preceding-sibling::methodparam">
905 <xsl:text>,</xsl:text>
909 <xsl:if test="$indent > 0">
910 <xsl:call-template name="copy-string">
911 <xsl:with-param name="string"> </xsl:with-param>
912 <xsl:with-param name="count" select="$indent + 1"/>
917 <xsl:apply-templates select="." mode="common.html.attributes"/>
918 <xsl:apply-templates mode="java"/>
922 <xsl:template match="parameter" mode="java">
924 <xsl:apply-templates select="." mode="common.html.attributes"/>
925 <xsl:apply-templates mode="java"/>
929 <xsl:template mode="java" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
930 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
931 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
932 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
933 <xsl:variable name="decl">
934 <xsl:if test="parent::classsynopsis">
935 <xsl:text> </xsl:text>
937 <xsl:apply-templates select="$start-modifiers" mode="java"/>
940 <xsl:if test="local-name($notmod[1]) != 'methodname'">
941 <xsl:apply-templates select="$notmod[1]" mode="java"/>
944 <xsl:apply-templates select="methodname" mode="java"/>
948 <xsl:apply-templates select="." mode="common.html.attributes"/>
949 <xsl:copy-of select="$decl"/>
950 <xsl:text>(</xsl:text>
951 <xsl:apply-templates select="methodparam" mode="java">
952 <xsl:with-param name="indent" select="string-length($decl)"/>
953 </xsl:apply-templates>
954 <xsl:text>)</xsl:text>
955 <xsl:if test="exceptionname">
959 <xsl:text> throws </xsl:text>
960 <xsl:apply-templates select="exceptionname" mode="java"/>
962 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
963 <xsl:text> </xsl:text>
964 <xsl:apply-templates select="$end-modifiers" mode="java"/>
966 <xsl:text>;</xsl:text>
968 <xsl:call-template name="synop-break"/>
971 <!-- ===== C++ ========================================================= -->
973 <xsl:template match="classsynopsis" mode="cpp">
975 </xsl:text><xsl:text>.nf
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">
986 <xsl:text> </xsl:text>
989 <xsl:if test="oointerface">
990 <xsl:text> implements</xsl:text>
991 <xsl:apply-templates select="oointerface" mode="cpp"/>
992 <xsl:if test="ooexception">
996 <xsl:text> </xsl:text>
999 <xsl:if test="ooexception">
1000 <xsl:text> throws</xsl:text>
1001 <xsl:apply-templates select="ooexception" mode="cpp"/>
1003 <xsl:text> {</xsl:text>
1007 <xsl:apply-templates select="constructorsynopsis |destructorsynopsis |fieldsynopsis |methodsynopsis |classsynopsisinfo" mode="cpp"/>
1008 <xsl:text>}</xsl:text>
1009 </pre><xsl:text/><xsl:text>.fi
1013 <xsl:template match="classsynopsisinfo" mode="cpp">
1014 <xsl:apply-templates mode="cpp"/>
1017 <xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
1018 <xsl:if test="preceding-sibling::*">
1019 <xsl:text>, </xsl:text>
1022 <xsl:apply-templates select="." mode="common.html.attributes"/>
1023 <xsl:apply-templates mode="cpp"/>
1027 <xsl:template match="modifier|package" mode="cpp">
1029 <xsl:apply-templates select="." mode="common.html.attributes"/>
1030 <xsl:apply-templates mode="cpp"/>
1031 <xsl:if test="following-sibling::*">
1032 <xsl:text> </xsl:text>
1037 <xsl:template match="classname" mode="cpp">
1038 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
1039 <xsl:text>, </xsl:text>
1042 <xsl:apply-templates select="." mode="common.html.attributes"/>
1043 <xsl:apply-templates mode="cpp"/>
1047 <xsl:template match="interfacename" mode="cpp">
1048 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
1049 <xsl:text>, </xsl:text>
1052 <xsl:apply-templates select="." mode="common.html.attributes"/>
1053 <xsl:apply-templates mode="cpp"/>
1057 <xsl:template match="exceptionname" mode="cpp">
1058 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
1059 <xsl:text>, </xsl:text>
1062 <xsl:apply-templates select="." mode="common.html.attributes"/>
1063 <xsl:apply-templates mode="cpp"/>
1067 <xsl:template match="fieldsynopsis" mode="cpp">
1069 <xsl:apply-templates select="." mode="common.html.attributes"/>
1070 <xsl:if test="parent::classsynopsis">
1071 <xsl:text> </xsl:text>
1073 <xsl:apply-templates mode="cpp"/>
1074 <xsl:text>;</xsl:text>
1076 <xsl:call-template name="synop-break"/>
1079 <xsl:template match="type" mode="cpp">
1081 <xsl:apply-templates select="." mode="common.html.attributes"/>
1082 <xsl:apply-templates mode="cpp"/>
1083 <xsl:text> </xsl:text>
1087 <xsl:template match="varname" mode="cpp">
1089 <xsl:apply-templates select="." mode="common.html.attributes"/>
1090 <xsl:apply-templates mode="cpp"/>
1091 <xsl:text> </xsl:text>
1095 <xsl:template match="initializer" mode="cpp">
1097 <xsl:apply-templates select="." mode="common.html.attributes"/>
1098 <xsl:text>= </xsl:text>
1099 <xsl:apply-templates mode="cpp"/>
1103 <xsl:template match="void" mode="cpp">
1105 <xsl:apply-templates select="." mode="common.html.attributes"/>
1106 <xsl:text>void </xsl:text>
1110 <xsl:template match="methodname" mode="cpp">
1112 <xsl:apply-templates select="." mode="common.html.attributes"/>
1113 <xsl:apply-templates mode="cpp"/>
1117 <xsl:template match="methodparam" mode="cpp">
1118 <xsl:if test="preceding-sibling::methodparam">
1119 <xsl:text>, </xsl:text>
1122 <xsl:apply-templates select="." mode="common.html.attributes"/>
1123 <xsl:apply-templates mode="cpp"/>
1127 <xsl:template match="parameter" mode="cpp">
1129 <xsl:apply-templates select="." mode="common.html.attributes"/>
1130 <xsl:apply-templates mode="cpp"/>
1134 <xsl:template mode="cpp" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1135 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1136 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
1137 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1140 <xsl:apply-templates select="." mode="common.html.attributes"/>
1141 <xsl:if test="parent::classsynopsis">
1142 <xsl:text> </xsl:text>
1144 <xsl:apply-templates select="$start-modifiers" mode="cpp"/>
1147 <xsl:if test="local-name($notmod[1]) != 'methodname'">
1148 <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
1151 <xsl:apply-templates select="methodname" mode="cpp"/>
1152 <xsl:text>(</xsl:text>
1153 <xsl:apply-templates select="methodparam" mode="cpp"/>
1154 <xsl:text>)</xsl:text>
1155 <xsl:if test="exceptionname">
1159 <xsl:text> throws </xsl:text>
1160 <xsl:apply-templates select="exceptionname" mode="cpp"/>
1162 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
1163 <xsl:text> </xsl:text>
1164 <xsl:apply-templates select="$end-modifiers" mode="cpp"/>
1166 <xsl:text>;</xsl:text>
1168 <xsl:call-template name="synop-break"/>
1171 <!-- ===== IDL ========================================================= -->
1173 <xsl:template match="classsynopsis" mode="idl">
1175 </xsl:text><xsl:text>.nf
1177 <xsl:apply-templates select="." mode="common.html.attributes"/>
1178 <xsl:text>interface </xsl:text>
1179 <xsl:apply-templates select="ooclass[1]" mode="idl"/>
1180 <xsl:if test="ooclass[preceding-sibling::*]">
1181 <xsl:text>: </xsl:text>
1182 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="idl"/>
1183 <xsl:if test="oointerface|ooexception">
1187 <xsl:text> </xsl:text>
1190 <xsl:if test="oointerface">
1191 <xsl:text> implements</xsl:text>
1192 <xsl:apply-templates select="oointerface" mode="idl"/>
1193 <xsl:if test="ooexception">
1197 <xsl:text> </xsl:text>
1200 <xsl:if test="ooexception">
1201 <xsl:text> throws</xsl:text>
1202 <xsl:apply-templates select="ooexception" mode="idl"/>
1204 <xsl:text> {</xsl:text>
1208 <xsl:apply-templates select="constructorsynopsis |destructorsynopsis |fieldsynopsis |methodsynopsis |classsynopsisinfo" mode="idl"/>
1209 <xsl:text>}</xsl:text>
1210 </pre><xsl:text/><xsl:text>.fi
1214 <xsl:template match="classsynopsisinfo" mode="idl">
1215 <xsl:apply-templates mode="idl"/>
1218 <xsl:template match="ooclass|oointerface|ooexception" mode="idl">
1219 <xsl:if test="preceding-sibling::*">
1220 <xsl:text>, </xsl:text>
1223 <xsl:apply-templates select="." mode="common.html.attributes"/>
1224 <xsl:apply-templates mode="idl"/>
1228 <xsl:template match="modifier|package" mode="idl">
1230 <xsl:apply-templates select="." mode="common.html.attributes"/>
1231 <xsl:apply-templates mode="idl"/>
1232 <xsl:if test="following-sibling::*">
1233 <xsl:text> </xsl:text>
1238 <xsl:template match="classname" mode="idl">
1239 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
1240 <xsl:text>, </xsl:text>
1243 <xsl:apply-templates select="." mode="common.html.attributes"/>
1244 <xsl:apply-templates mode="idl"/>
1248 <xsl:template match="interfacename" mode="idl">
1249 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
1250 <xsl:text>, </xsl:text>
1253 <xsl:apply-templates select="." mode="common.html.attributes"/>
1254 <xsl:apply-templates mode="idl"/>
1258 <xsl:template match="exceptionname" mode="idl">
1259 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
1260 <xsl:text>, </xsl:text>
1263 <xsl:apply-templates select="." mode="common.html.attributes"/>
1264 <xsl:apply-templates mode="idl"/>
1268 <xsl:template match="fieldsynopsis" mode="idl">
1270 <xsl:apply-templates select="." mode="common.html.attributes"/>
1271 <xsl:if test="parent::classsynopsis">
1272 <xsl:text> </xsl:text>
1274 <xsl:apply-templates mode="idl"/>
1275 <xsl:text>;</xsl:text>
1277 <xsl:call-template name="synop-break"/>
1280 <xsl:template match="type" mode="idl">
1282 <xsl:apply-templates select="." mode="common.html.attributes"/>
1283 <xsl:apply-templates mode="idl"/>
1284 <xsl:text> </xsl:text>
1288 <xsl:template match="varname" mode="idl">
1290 <xsl:apply-templates select="." mode="common.html.attributes"/>
1291 <xsl:apply-templates mode="idl"/>
1292 <xsl:text> </xsl:text>
1296 <xsl:template match="initializer" mode="idl">
1298 <xsl:apply-templates select="." mode="common.html.attributes"/>
1299 <xsl:text>= </xsl:text>
1300 <xsl:apply-templates mode="idl"/>
1304 <xsl:template match="void" mode="idl">
1306 <xsl:apply-templates select="." mode="common.html.attributes"/>
1307 <xsl:text>void </xsl:text>
1311 <xsl:template match="methodname" mode="idl">
1313 <xsl:apply-templates select="." mode="common.html.attributes"/>
1314 <xsl:apply-templates mode="idl"/>
1318 <xsl:template match="methodparam" mode="idl">
1319 <xsl:if test="preceding-sibling::methodparam">
1320 <xsl:text>, </xsl:text>
1323 <xsl:apply-templates select="." mode="common.html.attributes"/>
1324 <xsl:apply-templates mode="idl"/>
1328 <xsl:template match="parameter" mode="idl">
1330 <xsl:apply-templates select="." mode="common.html.attributes"/>
1331 <xsl:apply-templates mode="idl"/>
1335 <xsl:template mode="idl" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1336 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1337 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
1338 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1340 <xsl:apply-templates select="." mode="common.html.attributes"/>
1341 <xsl:if test="parent::classsynopsis">
1342 <xsl:text> </xsl:text>
1344 <xsl:apply-templates select="$start-modifiers" mode="idl"/>
1347 <xsl:if test="local-name($notmod[1]) != 'methodname'">
1348 <xsl:apply-templates select="$notmod[1]" mode="idl"/>
1351 <xsl:apply-templates select="methodname" mode="idl"/>
1352 <xsl:text>(</xsl:text>
1353 <xsl:apply-templates select="methodparam" mode="idl"/>
1354 <xsl:text>)</xsl:text>
1355 <xsl:if test="exceptionname">
1359 <xsl:text> raises(</xsl:text>
1360 <xsl:apply-templates select="exceptionname" mode="idl"/>
1361 <xsl:text>)</xsl:text>
1363 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
1364 <xsl:text> </xsl:text>
1365 <xsl:apply-templates select="$end-modifiers" mode="idl"/>
1367 <xsl:text>;</xsl:text>
1369 <xsl:call-template name="synop-break"/>
1372 <!-- ===== Perl ======================================================== -->
1374 <xsl:template match="classsynopsis" mode="perl">
1376 </xsl:text><xsl:text>.nf
1378 <xsl:apply-templates select="." mode="common.html.attributes"/>
1379 <xsl:text>package </xsl:text>
1380 <xsl:apply-templates select="ooclass[1]" mode="perl"/>
1381 <xsl:text>;</xsl:text>
1386 <xsl:if test="ooclass[preceding-sibling::*]">
1387 <xsl:text>@ISA = (</xsl:text>
1388 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="perl"/>
1389 <xsl:text>);</xsl:text>
1395 <xsl:apply-templates select="constructorsynopsis |destructorsynopsis |fieldsynopsis |methodsynopsis |classsynopsisinfo" mode="perl"/>
1396 </pre><xsl:text/><xsl:text>.fi
1400 <xsl:template match="classsynopsisinfo" mode="perl">
1401 <xsl:apply-templates mode="perl"/>
1404 <xsl:template match="ooclass|oointerface|ooexception" mode="perl">
1405 <xsl:if test="preceding-sibling::*">
1406 <xsl:text>, </xsl:text>
1409 <xsl:apply-templates select="." mode="common.html.attributes"/>
1410 <xsl:apply-templates mode="perl"/>
1414 <xsl:template match="modifier|package" mode="perl">
1416 <xsl:apply-templates select="." mode="common.html.attributes"/>
1417 <xsl:apply-templates mode="perl"/>
1418 <xsl:if test="following-sibling::*">
1419 <xsl:text> </xsl:text>
1424 <xsl:template match="classname" mode="perl">
1425 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
1426 <xsl:text>, </xsl:text>
1429 <xsl:apply-templates select="." mode="common.html.attributes"/>
1430 <xsl:apply-templates mode="perl"/>
1434 <xsl:template match="interfacename" mode="perl">
1435 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
1436 <xsl:text>, </xsl:text>
1439 <xsl:apply-templates select="." mode="common.html.attributes"/>
1440 <xsl:apply-templates mode="perl"/>
1444 <xsl:template match="exceptionname" mode="perl">
1445 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
1446 <xsl:text>, </xsl:text>
1449 <xsl:apply-templates select="." mode="common.html.attributes"/>
1450 <xsl:apply-templates mode="perl"/>
1454 <xsl:template match="fieldsynopsis" mode="perl">
1456 <xsl:apply-templates select="." mode="common.html.attributes"/>
1457 <xsl:if test="parent::classsynopsis">
1458 <xsl:text> </xsl:text>
1460 <xsl:apply-templates mode="perl"/>
1461 <xsl:text>;</xsl:text>
1463 <xsl:call-template name="synop-break"/>
1466 <xsl:template match="type" mode="perl">
1468 <xsl:apply-templates select="." mode="common.html.attributes"/>
1469 <xsl:apply-templates mode="perl"/>
1470 <xsl:text> </xsl:text>
1474 <xsl:template match="varname" mode="perl">
1476 <xsl:apply-templates select="." mode="common.html.attributes"/>
1477 <xsl:apply-templates mode="perl"/>
1478 <xsl:text> </xsl:text>
1482 <xsl:template match="initializer" mode="perl">
1484 <xsl:apply-templates select="." mode="common.html.attributes"/>
1485 <xsl:text>= </xsl:text>
1486 <xsl:apply-templates mode="perl"/>
1490 <xsl:template match="void" mode="perl">
1492 <xsl:apply-templates select="." mode="common.html.attributes"/>
1493 <xsl:text>void </xsl:text>
1497 <xsl:template match="methodname" mode="perl">
1499 <xsl:apply-templates select="." mode="common.html.attributes"/>
1500 <xsl:apply-templates mode="perl"/>
1504 <xsl:template match="methodparam" mode="perl">
1505 <xsl:if test="preceding-sibling::methodparam">
1506 <xsl:text>, </xsl:text>
1509 <xsl:apply-templates select="." mode="common.html.attributes"/>
1510 <xsl:apply-templates mode="perl"/>
1514 <xsl:template match="parameter" mode="perl">
1516 <xsl:apply-templates select="." mode="common.html.attributes"/>
1517 <xsl:apply-templates mode="perl"/>
1521 <xsl:template mode="perl" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1522 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1523 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
1524 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1527 <xsl:apply-templates select="." mode="common.html.attributes"/>
1528 <xsl:text>sub </xsl:text>
1530 <xsl:apply-templates select="methodname" mode="perl"/>
1531 <xsl:text> { ... };</xsl:text>
1533 <xsl:call-template name="synop-break"/>
1536 <!-- Used when not occurring as a child of classsynopsis -->
1537 <xsl:template match="ooclass|oointerface|ooexception">
1538 <xsl:apply-templates/>
1541 <!-- ==================================================================== -->
1543 <!-- * DocBook 5 allows linking elements (link, olink, and xref) -->
1544 <!-- * within the OO *synopsis elements (classsynopsis, fieldsynopsis, -->
1545 <!-- * methodsynopsis, constructorsynopsis, destructorsynopsis) and -->
1546 <!-- * their children. So we need to have mode="java|cpp|idl|perl" -->
1547 <!-- * per-mode matches for those linking elements in order for them -->
1548 <!-- * to be processed as expected. -->
1550 <xsl:template match="link|olink|xref" mode="java">
1551 <xsl:apply-templates select="."/>
1554 <xsl:template match="link|olink|xref" mode="cpp">
1555 <xsl:apply-templates select="."/>
1558 <xsl:template match="link|olink|xref" mode="idl">
1559 <xsl:apply-templates select="."/>
1562 <xsl:template match="link|olink|xref" mode="perl">
1563 <xsl:apply-templates select="."/>