2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY nbsp
" ">
5 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
8 <!-- ********************************************************************
9 $Id: synop.xsl,v 1.1 2007/03/10 05:15:13 scott Exp $
10 ********************************************************************
12 This file is part of the XSL DocBook Stylesheet distribution.
13 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
14 and other information.
16 ******************************************************************** -->
18 <!-- ==================================================================== -->
20 <!-- synopsis is in verbatim -->
22 <!-- ==================================================================== -->
24 <xsl:template match=
"cmdsynopsis">
26 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
28 <xsl:call-template name=
"anchor"/>
29 <xsl:apply-templates/>
34 <xsl:template match=
"cmdsynopsis/command">
36 <xsl:call-template name=
"inline.monoseq"/>
37 <xsl:text> </xsl:text>
40 <xsl:template match=
"cmdsynopsis/command[1]" priority=
"2">
41 <xsl:call-template name=
"inline.monoseq"/>
42 <xsl:text> </xsl:text>
45 <xsl:template match=
"group|arg" name=
"group-or-arg">
46 <xsl:variable name=
"choice" select=
"@choice"/>
47 <xsl:variable name=
"rep" select=
"@rep"/>
48 <xsl:variable name=
"sepchar">
50 <xsl:when test=
"ancestor-or-self::*/@sepchar">
51 <xsl:value-of select=
"ancestor-or-self::*/@sepchar"/>
54 <xsl:text> </xsl:text>
59 <xsl:if test=
"preceding-sibling::*">
60 <xsl:value-of select=
"$sepchar"/>
63 <xsl:when test=
"$choice='plain'">
64 <xsl:value-of select=
"$arg.choice.plain.open.str"/>
66 <xsl:when test=
"$choice='req'">
67 <xsl:value-of select=
"$arg.choice.req.open.str"/>
69 <xsl:when test=
"$choice='opt'">
70 <xsl:value-of select=
"$arg.choice.opt.open.str"/>
73 <xsl:value-of select=
"$arg.choice.def.open.str"/>
76 <xsl:apply-templates/>
78 <xsl:when test=
"$rep='repeat'">
79 <xsl:value-of select=
"$arg.rep.repeat.str"/>
81 <xsl:when test=
"$rep='norepeat'">
82 <xsl:value-of select=
"$arg.rep.norepeat.str"/>
85 <xsl:value-of select=
"$arg.rep.def.str"/>
89 <xsl:when test=
"$choice='plain'">
90 <xsl:value-of select=
"$arg.choice.plain.close.str"/>
92 <xsl:when test=
"$choice='req'">
93 <xsl:value-of select=
"$arg.choice.req.close.str"/>
95 <xsl:when test=
"$choice='opt'">
96 <xsl:value-of select=
"$arg.choice.opt.close.str"/>
99 <xsl:value-of select=
"$arg.choice.def.close.str"/>
104 <xsl:template match=
"group/arg">
105 <xsl:variable name=
"choice" select=
"@choice"/>
106 <xsl:variable name=
"rep" select=
"@rep"/>
107 <xsl:if test=
"preceding-sibling::*">
108 <xsl:value-of select=
"$arg.or.sep"/>
110 <xsl:call-template name=
"group-or-arg"/>
113 <xsl:template match=
"sbr">
117 <!-- ==================================================================== -->
119 <xsl:template match=
"synopfragmentref">
120 <xsl:variable name=
"target" select=
"key('id',@linkend)"/>
121 <xsl:variable name=
"snum">
122 <xsl:apply-templates select=
"$target" mode=
"synopfragment.number"/>
125 <a href=
"#{@linkend}">
126 <xsl:text>(
</xsl:text>
127 <xsl:value-of select=
"$snum"/>
128 <xsl:text>)
</xsl:text>
130 <xsl:text> </xsl:text>
131 <xsl:apply-templates/>
135 <xsl:template match=
"synopfragment" mode=
"synopfragment.number">
136 <xsl:number format=
"1"/>
139 <xsl:template match=
"synopfragment">
140 <xsl:variable name=
"snum">
141 <xsl:apply-templates select=
"." mode=
"synopfragment.number"/>
144 <xsl:variable name=
"id">
145 <xsl:call-template name=
"object.id"/>
148 <xsl:text>(
</xsl:text>
149 <xsl:value-of select=
"$snum"/>
150 <xsl:text>)
</xsl:text>
152 <xsl:text> </xsl:text>
153 <xsl:apply-templates/>
157 <xsl:template match=
"funcsynopsis">
158 <xsl:call-template name=
"informal.object"/>
161 <xsl:template match=
"funcsynopsisinfo">
163 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
164 <xsl:apply-templates/>
168 <!-- ====================================================================== -->
169 <!-- funcprototype -->
172 funcprototype ::= (funcdef,
173 (void|varargs|paramdef+))
175 funcdef ::= (#PCDATA|type|replaceable|function)*
177 paramdef ::= (#PCDATA|type|replaceable|parameter|funcparams)*
180 <xsl:template match=
"funcprototype">
181 <xsl:variable name=
"html-style">
182 <xsl:call-template name=
"dbhtml-attribute">
183 <xsl:with-param name=
"pis"
184 select=
"ancestor::funcsynopsis//processing-instruction('dbhtml')"/>
185 <xsl:with-param name=
"attribute" select=
"'funcsynopsis-style'"/>
189 <xsl:variable name=
"style">
191 <xsl:when test=
"$html-style != ''">
192 <xsl:value-of select=
"$html-style"/>
195 <xsl:value-of select=
"$funcsynopsis.style"/>
201 <xsl:variable name="tabular-p"
202 select="$funcsynopsis.tabular.threshold > 0
203 and string-length(.) > $funcsynopsis.tabular.threshold"/>
206 <xsl:variable name=
"tabular-p" select=
"true()"/>
209 <xsl:when test=
"$style = 'kr' and $tabular-p">
210 <xsl:apply-templates select=
"." mode=
"kr-tabular"/>
212 <xsl:when test=
"$style = 'kr'">
213 <xsl:apply-templates select=
"." mode=
"kr-nontabular"/>
215 <xsl:when test=
"$style = 'ansi' and $tabular-p">
216 <xsl:apply-templates select=
"." mode=
"ansi-tabular"/>
219 <xsl:apply-templates select=
"." mode=
"ansi-nontabular"/>
224 <!-- ====================================================================== -->
225 <!-- funcprototype: kr, non-tabular -->
227 <xsl:template match=
"funcprototype" mode=
"kr-nontabular">
229 <xsl:apply-templates mode=
"kr-nontabular"/>
230 <xsl:if test=
"paramdef">
232 <xsl:apply-templates select=
"paramdef" mode=
"kr-funcsynopsis-mode"/>
237 <xsl:template match=
"funcdef" mode=
"kr-nontabular">
239 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
240 <xsl:apply-templates mode=
"kr-nontabular"/>
241 <xsl:text>(
</xsl:text>
245 <xsl:template match=
"funcdef/function" mode=
"kr-nontabular">
247 <xsl:when test=
"$funcsynopsis.decoration != 0">
248 <b class=
"fsfunc"><xsl:apply-templates mode=
"kr-nontabular"/></b>
251 <xsl:apply-templates mode=
"kr-nontabular"/>
256 <xsl:template match=
"void" mode=
"kr-nontabular">
258 <xsl:text>;
</xsl:text>
261 <xsl:template match=
"varargs" mode=
"kr-nontabular">
262 <xsl:text>...
</xsl:text>
264 <xsl:text>;
</xsl:text>
267 <xsl:template match=
"paramdef" mode=
"kr-nontabular">
268 <xsl:apply-templates select=
"parameter" mode=
"kr-nontabular"/>
270 <xsl:when test=
"following-sibling::*">
271 <xsl:text>,
</xsl:text>
275 <xsl:text>;
</xsl:text>
280 <xsl:template match=
"paramdef/parameter" mode=
"kr-nontabular">
282 <xsl:when test=
"$funcsynopsis.decoration != 0">
283 <var class=
"pdparam">
284 <xsl:apply-templates mode=
"kr-nontabular"/>
289 <xsl:apply-templates mode=
"kr-nontabular"/>
295 <xsl:template match=
"paramdef" mode=
"kr-funcsynopsis-mode">
296 <xsl:if test=
"preceding-sibling::paramdef"><br/></xsl:if>
298 <xsl:apply-templates mode=
"kr-funcsynopsis-mode"/>
300 <xsl:text>;
</xsl:text>
303 <xsl:template match=
"paramdef/parameter" mode=
"kr-funcsynopsis-mode">
305 <xsl:when test=
"$funcsynopsis.decoration != 0">
306 <var class=
"pdparam">
307 <xsl:apply-templates mode=
"kr-funcsynopsis-mode"/>
312 <xsl:apply-templates mode=
"kr-funcsynopsis-mode"/>
318 <xsl:template match=
"funcparams" mode=
"kr-funcsynopsis-mode">
320 <xsl:apply-templates mode=
"kr-funcsynopsis-mode"/>
324 <!-- ====================================================================== -->
325 <!-- funcprototype: kr, tabular -->
327 <xsl:template match=
"funcprototype" mode=
"kr-tabular">
328 <table border=
"0" summary=
"Function synopsis" cellspacing=
"0" cellpadding=
"0"
329 style=
"padding-bottom: 1em">
332 <xsl:apply-templates select=
"funcdef" mode=
"kr-tabular"/>
334 <xsl:apply-templates select=
"(void|varargs|paramdef)[1]" mode=
"kr-tabular"/>
336 <xsl:for-each select=
"(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
339 <xsl:apply-templates select=
"." mode=
"kr-tabular"/>
343 <xsl:if test=
"paramdef">
344 <table border=
"0" summary=
"Function argument synopsis"
345 cellspacing=
"0" cellpadding=
"0">
346 <xsl:if test=
"following-sibling::funcprototype">
347 <xsl:attribute name=
"style">padding-bottom:
1em
</xsl:attribute>
349 <xsl:apply-templates select=
"paramdef" mode=
"kr-tabular-funcsynopsis-mode"/>
354 <xsl:template match=
"funcdef" mode=
"kr-tabular">
356 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
357 <xsl:apply-templates mode=
"kr-tabular"/>
358 <xsl:text>(
</xsl:text>
362 <xsl:template match=
"funcdef/function" mode=
"kr-tabular">
364 <xsl:when test=
"$funcsynopsis.decoration != 0">
365 <b class=
"fsfunc"><xsl:apply-templates mode=
"kr-nontabular"/></b>
368 <xsl:apply-templates mode=
"kr-tabular"/>
373 <xsl:template match=
"void" mode=
"kr-tabular">
376 <xsl:text>;
</xsl:text>
381 <xsl:template match=
"varargs" mode=
"kr-tabular">
383 <xsl:text>...
</xsl:text>
385 <xsl:text>;
</xsl:text>
390 <xsl:template match=
"paramdef" mode=
"kr-tabular">
392 <xsl:apply-templates select=
"parameter" mode=
"kr-tabular"/>
394 <xsl:when test=
"following-sibling::*">
395 <xsl:text>,
</xsl:text>
399 <xsl:text>;
</xsl:text>
406 <xsl:template match=
"paramdef/parameter" mode=
"kr-tabular">
408 <xsl:when test=
"$funcsynopsis.decoration != 0">
409 <var class=
"pdparam">
410 <xsl:apply-templates mode=
"kr-tabular"/>
415 <xsl:apply-templates mode=
"kr-tabular"/>
421 <xsl:template match=
"paramdef" mode=
"kr-tabular-funcsynopsis-mode">
422 <xsl:variable name=
"type">
424 <xsl:when test=
"type">
425 <xsl:apply-templates select=
"type"
426 mode=
"kr-tabular-funcsynopsis-mode"/>
428 <xsl:when test=
"normalize-space(parameter/preceding-sibling::node()[not(self::parameter)]) != ''">
429 <xsl:copy-of select=
"parameter/preceding-sibling::node()[not(self::parameter)]"/>
436 <xsl:when test=
"$type != '' and funcparams">
439 <xsl:copy-of select=
"$type"/>
441 <xsl:text> </xsl:text>
446 <xsl:when test=
"type">
447 <xsl:apply-templates select=
"type/following-sibling::*"
448 mode=
"kr-tabular-funcsynopsis-mode"/>
451 <xsl:apply-templates select=
"*"
452 mode=
"kr-tabular-funcsynopsis-mode"/>
459 <xsl:when test=
"funcparams">
462 <xsl:apply-templates mode=
"kr-tabular-funcsynopsis-mode"/>
470 <xsl:apply-templates select=
"parameter/preceding-sibling::node()[not(self::parameter)]"
471 mode=
"kr-tabular-funcsynopsis-mode"/>
473 <xsl:text> </xsl:text>
477 <xsl:apply-templates select=
"parameter"
479 <xsl:apply-templates select=
"parameter/following-sibling::*[not(self::parameter)]"
480 mode=
"kr-tabular-funcsynopsis-mode"/>
481 <xsl:text>;
</xsl:text>
489 <xsl:template match=
"paramdef/parameter" mode=
"kr-tabular-funcsynopsis-mode">
491 <xsl:when test=
"$funcsynopsis.decoration != 0">
492 <var class=
"pdparam">
493 <xsl:apply-templates mode=
"kr-tabular-funcsynopsis-mode"/>
498 <xsl:apply-templates mode=
"kr-tabular-funcsynopsis-mode"/>
504 <xsl:template match=
"funcparams" mode=
"kr-tabular-funcsynopsis-mode">
506 <xsl:apply-templates mode=
"kr-tabular-funcsynopsis-mode"/>
508 <xsl:text>;
</xsl:text>
511 <!-- ====================================================================== -->
512 <!-- funcprototype: ansi, non-tabular -->
514 <xsl:template match=
"funcprototype" mode=
"ansi-nontabular">
516 <xsl:apply-templates mode=
"ansi-nontabular"/>
520 <xsl:template match=
"funcdef" mode=
"ansi-nontabular">
522 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
523 <xsl:apply-templates mode=
"ansi-nontabular"/>
524 <xsl:text>(
</xsl:text>
528 <xsl:template match=
"funcdef/function" mode=
"ansi-nontabular">
530 <xsl:when test=
"$funcsynopsis.decoration != 0">
531 <b class=
"fsfunc"><xsl:apply-templates mode=
"ansi-nontabular"/></b>
534 <xsl:apply-templates mode=
"ansi-nontabular"/>
539 <xsl:template match=
"void" mode=
"ansi-nontabular">
541 <xsl:text>;
</xsl:text>
544 <xsl:template match=
"varargs" mode=
"ansi-nontabular">
545 <xsl:text>...
</xsl:text>
547 <xsl:text>;
</xsl:text>
550 <xsl:template match=
"paramdef" mode=
"ansi-nontabular">
551 <xsl:apply-templates mode=
"ansi-nontabular"/>
553 <xsl:when test=
"following-sibling::*">
554 <xsl:text>,
</xsl:text>
558 <xsl:text>;
</xsl:text>
563 <xsl:template match=
"paramdef/parameter" mode=
"ansi-nontabular">
565 <xsl:when test=
"$funcsynopsis.decoration != 0">
566 <var class=
"pdparam">
567 <xsl:apply-templates mode=
"ansi-nontabular"/>
572 <xsl:apply-templates mode=
"ansi-nontabular"/>
578 <xsl:template match=
"funcparams" mode=
"ansi-nontabular">
580 <xsl:apply-templates mode=
"ansi-nontabular"/>
584 <!-- ====================================================================== -->
585 <!-- funcprototype: ansi, tabular -->
587 <xsl:template match=
"funcprototype" mode=
"ansi-tabular">
588 <table border=
"0" summary=
"Function synopsis" cellspacing=
"0" cellpadding=
"0">
589 <xsl:if test=
"following-sibling::funcprototype">
590 <xsl:attribute name=
"style">padding-bottom:
1em
</xsl:attribute>
594 <xsl:apply-templates select=
"funcdef" mode=
"ansi-tabular"/>
596 <xsl:apply-templates select=
"(void|varargs|paramdef)[1]" mode=
"ansi-tabular"/>
598 <xsl:for-each select=
"(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
601 <xsl:apply-templates select=
"." mode=
"ansi-tabular"/>
607 <xsl:template match=
"funcdef" mode=
"ansi-tabular">
609 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
610 <xsl:apply-templates mode=
"ansi-tabular"/>
611 <xsl:text>(
</xsl:text>
615 <xsl:template match=
"funcdef/function" mode=
"ansi-tabular">
617 <xsl:when test=
"$funcsynopsis.decoration != 0">
618 <b class=
"fsfunc"><xsl:apply-templates mode=
"ansi-nontabular"/></b>
621 <xsl:apply-templates mode=
"kr-tabular"/>
626 <xsl:template match=
"void" mode=
"ansi-tabular">
629 <xsl:text>;
</xsl:text>
634 <xsl:template match=
"varargs" mode=
"ansi-tabular">
636 <xsl:text>...
</xsl:text>
638 <xsl:text>;
</xsl:text>
643 <xsl:template match=
"paramdef" mode=
"ansi-tabular">
644 <xsl:variable name=
"type">
646 <xsl:when test=
"type">
647 <xsl:apply-templates select=
"type"
648 mode=
"ansi-tabular"/>
650 <xsl:when test=
"normalize-space(parameter/preceding-sibling::node()[not(self::parameter)]) != ''">
651 <xsl:copy-of select=
"parameter/preceding-sibling::node()[not(self::parameter)]"/>
657 <xsl:when test=
"$type != '' and funcparams">
659 <xsl:copy-of select=
"$type"/>
660 <xsl:text> </xsl:text>
664 <xsl:when test=
"type">
665 <xsl:apply-templates select=
"type/following-sibling::*"
666 mode=
"ansi-tabular"/>
669 <xsl:apply-templates select=
"*"
670 mode=
"ansi-tabular"/>
674 <xsl:when test=
"following-sibling::*">
675 <xsl:text>,
</xsl:text>
679 <xsl:text>;
</xsl:text>
686 <xsl:apply-templates select=
"parameter/preceding-sibling::node()[not(self::parameter)]"
687 mode=
"ansi-tabular"/>
688 <xsl:text> </xsl:text>
691 <xsl:apply-templates select=
"parameter"
692 mode=
"ansi-tabular"/>
693 <xsl:apply-templates select=
"parameter/following-sibling::*[not(self::parameter)]"
694 mode=
"ansi-tabular"/>
696 <xsl:when test=
"following-sibling::*">
697 <xsl:text>,
</xsl:text>
701 <xsl:text>;
</xsl:text>
709 <xsl:template match=
"paramdef/parameter" mode=
"ansi-tabular">
711 <xsl:when test=
"$funcsynopsis.decoration != 0">
712 <var class=
"pdparam">
713 <xsl:apply-templates mode=
"ansi-tabular"/>
718 <xsl:apply-templates mode=
"ansi-tabular"/>
724 <xsl:template match=
"funcparams" mode=
"ansi-tabular">
726 <xsl:apply-templates/>
730 <!-- ====================================================================== -->
732 <xsl:variable name=
"default-classsynopsis-language">java
</xsl:variable>
734 <xsl:template match=
"classsynopsis
738 |destructorsynopsis">
739 <xsl:param name=
"language">
741 <xsl:when test=
"@language">
742 <xsl:value-of select=
"@language"/>
745 <xsl:value-of select=
"$default-classsynopsis-language"/>
751 <xsl:when test=
"$language='java' or $language='Java'">
752 <xsl:apply-templates select=
"." mode=
"java"/>
754 <xsl:when test=
"$language='perl' or $language='Perl'">
755 <xsl:apply-templates select=
"." mode=
"perl"/>
757 <xsl:when test=
"$language='idl' or $language='IDL'">
758 <xsl:apply-templates select=
"." mode=
"idl"/>
760 <xsl:when test=
"$language='cpp' or $language='c++' or $language='C++'">
761 <xsl:apply-templates select=
"." mode=
"cpp"/>
765 <xsl:text>Unrecognized language on
</xsl:text>
766 <xsl:value-of select=
"local-name(.)"/>
767 <xsl:text>:
</xsl:text>
768 <xsl:value-of select=
"$language"/>
770 <xsl:apply-templates select=
".">
771 <xsl:with-param name=
"language"
772 select=
"$default-classsynopsis-language"/>
773 </xsl:apply-templates>
778 <xsl:template name=
"synop-break">
779 <xsl:if test=
"parent::classsynopsis
780 or (following-sibling::fieldsynopsis
781 |following-sibling::methodsynopsis
782 |following-sibling::constructorsynopsis
783 |following-sibling::destructorsynopsis)">
789 <!-- ===== Java ======================================================== -->
791 <xsl:template match=
"classsynopsis" mode=
"java">
793 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
794 <xsl:apply-templates select=
"ooclass[1]" mode=
"java"/>
795 <xsl:if test=
"ooclass[preceding-sibling::*]">
796 <xsl:text> extends
</xsl:text>
797 <xsl:apply-templates select=
"ooclass[preceding-sibling::*]" mode=
"java"/>
798 <xsl:if test=
"oointerface|ooexception">
800 <xsl:text> </xsl:text>
803 <xsl:if test=
"oointerface">
804 <xsl:text>implements
</xsl:text>
805 <xsl:apply-templates select=
"oointerface" mode=
"java"/>
806 <xsl:if test=
"ooexception">
808 <xsl:text> </xsl:text>
811 <xsl:if test=
"ooexception">
812 <xsl:text>throws
</xsl:text>
813 <xsl:apply-templates select=
"ooexception" mode=
"java"/>
815 <xsl:text> {
</xsl:text>
817 <xsl:apply-templates select=
"constructorsynopsis
821 |classsynopsisinfo" mode=
"java"/>
822 <xsl:text>}
</xsl:text>
826 <xsl:template match=
"classsynopsisinfo" mode=
"java">
827 <xsl:apply-templates mode=
"java"/>
830 <xsl:template match=
"ooclass|oointerface|ooexception" mode=
"java">
832 <xsl:when test=
"preceding-sibling::*">
833 <xsl:text>,
</xsl:text>
836 <xsl:text> </xsl:text>
840 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
841 <xsl:apply-templates mode=
"java"/>
845 <xsl:template match=
"modifier|package" mode=
"java">
847 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
848 <xsl:apply-templates mode=
"java"/>
849 <xsl:if test=
"following-sibling::*">
850 <xsl:text> </xsl:text>
855 <xsl:template match=
"classname" mode=
"java">
856 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'classname'">
857 <xsl:text>,
</xsl:text>
860 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
861 <xsl:apply-templates mode=
"java"/>
865 <xsl:template match=
"interfacename" mode=
"java">
866 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'interfacename'">
867 <xsl:text>,
</xsl:text>
870 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
871 <xsl:apply-templates mode=
"java"/>
875 <xsl:template match=
"exceptionname" mode=
"java">
876 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'exceptionname'">
877 <xsl:text>,
</xsl:text>
880 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
881 <xsl:apply-templates mode=
"java"/>
885 <xsl:template match=
"fieldsynopsis" mode=
"java">
887 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
888 <xsl:if test=
"parent::classsynopsis">
889 <xsl:text> </xsl:text>
891 <xsl:apply-templates mode=
"java"/>
892 <xsl:text>;
</xsl:text>
894 <xsl:call-template name=
"synop-break"/>
897 <xsl:template match=
"type" mode=
"java">
899 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
900 <xsl:apply-templates mode=
"java"/>
901 <xsl:text> </xsl:text>
905 <xsl:template match=
"varname" mode=
"java">
907 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
908 <xsl:apply-templates mode=
"java"/>
909 <xsl:text> </xsl:text>
913 <xsl:template match=
"initializer" mode=
"java">
915 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
916 <xsl:text>=
</xsl:text>
917 <xsl:apply-templates mode=
"java"/>
921 <xsl:template match=
"void" mode=
"java">
923 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
924 <xsl:text>void
</xsl:text>
928 <xsl:template match=
"methodname" mode=
"java">
930 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
931 <xsl:apply-templates mode=
"java"/>
935 <xsl:template match=
"methodparam" mode=
"java">
936 <xsl:param name=
"indent">0</xsl:param>
937 <xsl:if test=
"preceding-sibling::methodparam">
938 <xsl:text>,
</xsl:text>
940 <xsl:if test=
"$indent > 0">
941 <xsl:call-template name=
"copy-string">
942 <xsl:with-param name=
"string"> </xsl:with-param>
943 <xsl:with-param name=
"count" select=
"$indent + 1"/>
948 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
949 <xsl:apply-templates mode=
"java"/>
953 <xsl:template match=
"parameter" mode=
"java">
955 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
956 <xsl:apply-templates mode=
"java"/>
960 <xsl:template mode=
"java"
961 match=
"constructorsynopsis|destructorsynopsis|methodsynopsis">
962 <xsl:variable name=
"start-modifiers" select=
"modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
963 <xsl:variable name=
"notmod" select=
"*[local-name(.) != 'modifier']"/>
964 <xsl:variable name=
"end-modifiers" select=
"modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
965 <xsl:variable name=
"decl">
966 <xsl:if test=
"parent::classsynopsis">
967 <xsl:text> </xsl:text>
969 <xsl:apply-templates select=
"$start-modifiers" mode=
"java"/>
972 <xsl:if test=
"local-name($notmod[1]) != 'methodname'">
973 <xsl:apply-templates select=
"$notmod[1]" mode=
"java"/>
976 <xsl:apply-templates select=
"methodname" mode=
"java"/>
980 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
981 <xsl:copy-of select=
"$decl"/>
982 <xsl:text>(
</xsl:text>
983 <xsl:apply-templates select=
"methodparam" mode=
"java">
984 <xsl:with-param name=
"indent" select=
"string-length($decl)"/>
985 </xsl:apply-templates>
986 <xsl:text>)
</xsl:text>
987 <xsl:if test=
"exceptionname">
989 <xsl:text> throws
</xsl:text>
990 <xsl:apply-templates select=
"exceptionname" mode=
"java"/>
992 <xsl:if test=
"modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
993 <xsl:text> </xsl:text>
994 <xsl:apply-templates select=
"$end-modifiers" mode=
"java"/>
996 <xsl:text>;
</xsl:text>
998 <xsl:call-template name=
"synop-break"/>
1001 <!-- ===== C++ ========================================================= -->
1003 <xsl:template match=
"classsynopsis" mode=
"cpp">
1005 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1006 <xsl:apply-templates select=
"ooclass[1]" mode=
"cpp"/>
1007 <xsl:if test=
"ooclass[preceding-sibling::*]">
1008 <xsl:text>:
</xsl:text>
1009 <xsl:apply-templates select=
"ooclass[preceding-sibling::*]" mode=
"cpp"/>
1010 <xsl:if test=
"oointerface|ooexception">
1012 <xsl:text> </xsl:text>
1015 <xsl:if test=
"oointerface">
1016 <xsl:text> implements
</xsl:text>
1017 <xsl:apply-templates select=
"oointerface" mode=
"cpp"/>
1018 <xsl:if test=
"ooexception">
1020 <xsl:text> </xsl:text>
1023 <xsl:if test=
"ooexception">
1024 <xsl:text> throws
</xsl:text>
1025 <xsl:apply-templates select=
"ooexception" mode=
"cpp"/>
1027 <xsl:text> {
</xsl:text>
1029 <xsl:apply-templates select=
"constructorsynopsis
1033 |classsynopsisinfo" mode=
"cpp"/>
1034 <xsl:text>}
</xsl:text>
1038 <xsl:template match=
"classsynopsisinfo" mode=
"cpp">
1039 <xsl:apply-templates mode=
"cpp"/>
1042 <xsl:template match=
"ooclass|oointerface|ooexception" mode=
"cpp">
1043 <xsl:if test=
"preceding-sibling::*">
1044 <xsl:text>,
</xsl:text>
1047 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1048 <xsl:apply-templates mode=
"cpp"/>
1052 <xsl:template match=
"modifier|package" mode=
"cpp">
1054 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1055 <xsl:apply-templates mode=
"cpp"/>
1056 <xsl:if test=
"following-sibling::*">
1057 <xsl:text> </xsl:text>
1062 <xsl:template match=
"classname" mode=
"cpp">
1063 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'classname'">
1064 <xsl:text>,
</xsl:text>
1067 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1068 <xsl:apply-templates mode=
"cpp"/>
1072 <xsl:template match=
"interfacename" mode=
"cpp">
1073 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'interfacename'">
1074 <xsl:text>,
</xsl:text>
1077 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1078 <xsl:apply-templates mode=
"cpp"/>
1082 <xsl:template match=
"exceptionname" mode=
"cpp">
1083 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'exceptionname'">
1084 <xsl:text>,
</xsl:text>
1087 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1088 <xsl:apply-templates mode=
"cpp"/>
1092 <xsl:template match=
"fieldsynopsis" mode=
"cpp">
1094 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1095 <xsl:if test=
"parent::classsynopsis">
1096 <xsl:text> </xsl:text>
1098 <xsl:apply-templates mode=
"cpp"/>
1099 <xsl:text>;
</xsl:text>
1101 <xsl:call-template name=
"synop-break"/>
1104 <xsl:template match=
"type" mode=
"cpp">
1106 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1107 <xsl:apply-templates mode=
"cpp"/>
1108 <xsl:text> </xsl:text>
1112 <xsl:template match=
"varname" mode=
"cpp">
1114 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1115 <xsl:apply-templates mode=
"cpp"/>
1116 <xsl:text> </xsl:text>
1120 <xsl:template match=
"initializer" mode=
"cpp">
1122 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1123 <xsl:text>=
</xsl:text>
1124 <xsl:apply-templates mode=
"cpp"/>
1128 <xsl:template match=
"void" mode=
"cpp">
1130 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1131 <xsl:text>void
</xsl:text>
1135 <xsl:template match=
"methodname" mode=
"cpp">
1137 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1138 <xsl:apply-templates mode=
"cpp"/>
1142 <xsl:template match=
"methodparam" mode=
"cpp">
1143 <xsl:if test=
"preceding-sibling::methodparam">
1144 <xsl:text>,
</xsl:text>
1147 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1148 <xsl:apply-templates mode=
"cpp"/>
1152 <xsl:template match=
"parameter" mode=
"cpp">
1154 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1155 <xsl:apply-templates mode=
"cpp"/>
1159 <xsl:template mode=
"cpp"
1160 match=
"constructorsynopsis|destructorsynopsis|methodsynopsis">
1161 <xsl:variable name=
"start-modifiers" select=
"modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1162 <xsl:variable name=
"notmod" select=
"*[local-name(.) != 'modifier']"/>
1163 <xsl:variable name=
"end-modifiers" select=
"modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1166 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1167 <xsl:if test=
"parent::classsynopsis">
1168 <xsl:text> </xsl:text>
1170 <xsl:apply-templates select=
"$start-modifiers" mode=
"cpp"/>
1173 <xsl:if test=
"local-name($notmod[1]) != 'methodname'">
1174 <xsl:apply-templates select=
"$notmod[1]" mode=
"cpp"/>
1177 <xsl:apply-templates select=
"methodname" mode=
"cpp"/>
1178 <xsl:text>(
</xsl:text>
1179 <xsl:apply-templates select=
"methodparam" mode=
"cpp"/>
1180 <xsl:text>)
</xsl:text>
1181 <xsl:if test=
"exceptionname">
1183 <xsl:text> throws
</xsl:text>
1184 <xsl:apply-templates select=
"exceptionname" mode=
"cpp"/>
1186 <xsl:if test=
"modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
1187 <xsl:text> </xsl:text>
1188 <xsl:apply-templates select=
"$end-modifiers" mode=
"cpp"/>
1190 <xsl:text>;
</xsl:text>
1192 <xsl:call-template name=
"synop-break"/>
1195 <!-- ===== IDL ========================================================= -->
1197 <xsl:template match=
"classsynopsis" mode=
"idl">
1199 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1200 <xsl:text>interface
</xsl:text>
1201 <xsl:apply-templates select=
"ooclass[1]" mode=
"idl"/>
1202 <xsl:if test=
"ooclass[preceding-sibling::*]">
1203 <xsl:text>:
</xsl:text>
1204 <xsl:apply-templates select=
"ooclass[preceding-sibling::*]" mode=
"idl"/>
1205 <xsl:if test=
"oointerface|ooexception">
1207 <xsl:text> </xsl:text>
1210 <xsl:if test=
"oointerface">
1211 <xsl:text> implements
</xsl:text>
1212 <xsl:apply-templates select=
"oointerface" mode=
"idl"/>
1213 <xsl:if test=
"ooexception">
1215 <xsl:text> </xsl:text>
1218 <xsl:if test=
"ooexception">
1219 <xsl:text> throws
</xsl:text>
1220 <xsl:apply-templates select=
"ooexception" mode=
"idl"/>
1222 <xsl:text> {
</xsl:text>
1224 <xsl:apply-templates select=
"constructorsynopsis
1228 |classsynopsisinfo" mode=
"idl"/>
1229 <xsl:text>}
</xsl:text>
1233 <xsl:template match=
"classsynopsisinfo" mode=
"idl">
1234 <xsl:apply-templates mode=
"idl"/>
1237 <xsl:template match=
"ooclass|oointerface|ooexception" mode=
"idl">
1238 <xsl:if test=
"preceding-sibling::*">
1239 <xsl:text>,
</xsl:text>
1242 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1243 <xsl:apply-templates mode=
"idl"/>
1247 <xsl:template match=
"modifier|package" mode=
"idl">
1249 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1250 <xsl:apply-templates mode=
"idl"/>
1251 <xsl:if test=
"following-sibling::*">
1252 <xsl:text> </xsl:text>
1257 <xsl:template match=
"classname" mode=
"idl">
1258 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'classname'">
1259 <xsl:text>,
</xsl:text>
1262 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1263 <xsl:apply-templates mode=
"idl"/>
1267 <xsl:template match=
"interfacename" mode=
"idl">
1268 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'interfacename'">
1269 <xsl:text>,
</xsl:text>
1272 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1273 <xsl:apply-templates mode=
"idl"/>
1277 <xsl:template match=
"exceptionname" mode=
"idl">
1278 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'exceptionname'">
1279 <xsl:text>,
</xsl:text>
1282 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1283 <xsl:apply-templates mode=
"idl"/>
1287 <xsl:template match=
"fieldsynopsis" mode=
"idl">
1289 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1290 <xsl:if test=
"parent::classsynopsis">
1291 <xsl:text> </xsl:text>
1293 <xsl:apply-templates mode=
"idl"/>
1294 <xsl:text>;
</xsl:text>
1296 <xsl:call-template name=
"synop-break"/>
1299 <xsl:template match=
"type" mode=
"idl">
1301 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1302 <xsl:apply-templates mode=
"idl"/>
1303 <xsl:text> </xsl:text>
1307 <xsl:template match=
"varname" mode=
"idl">
1309 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1310 <xsl:apply-templates mode=
"idl"/>
1311 <xsl:text> </xsl:text>
1315 <xsl:template match=
"initializer" mode=
"idl">
1317 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1318 <xsl:text>=
</xsl:text>
1319 <xsl:apply-templates mode=
"idl"/>
1323 <xsl:template match=
"void" mode=
"idl">
1325 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1326 <xsl:text>void
</xsl:text>
1330 <xsl:template match=
"methodname" mode=
"idl">
1332 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1333 <xsl:apply-templates mode=
"idl"/>
1337 <xsl:template match=
"methodparam" mode=
"idl">
1338 <xsl:if test=
"preceding-sibling::methodparam">
1339 <xsl:text>,
</xsl:text>
1342 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1343 <xsl:apply-templates mode=
"idl"/>
1347 <xsl:template match=
"parameter" mode=
"idl">
1349 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1350 <xsl:apply-templates mode=
"idl"/>
1354 <xsl:template mode=
"idl"
1355 match=
"constructorsynopsis|destructorsynopsis|methodsynopsis">
1356 <xsl:variable name=
"start-modifiers" select=
"modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1357 <xsl:variable name=
"notmod" select=
"*[local-name(.) != 'modifier']"/>
1358 <xsl:variable name=
"end-modifiers" select=
"modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1360 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1361 <xsl:if test=
"parent::classsynopsis">
1362 <xsl:text> </xsl:text>
1364 <xsl:apply-templates select=
"$start-modifiers" mode=
"idl"/>
1367 <xsl:if test=
"local-name($notmod[1]) != 'methodname'">
1368 <xsl:apply-templates select=
"$notmod[1]" mode=
"idl"/>
1371 <xsl:apply-templates select=
"methodname" mode=
"idl"/>
1372 <xsl:text>(
</xsl:text>
1373 <xsl:apply-templates select=
"methodparam" mode=
"idl"/>
1374 <xsl:text>)
</xsl:text>
1375 <xsl:if test=
"exceptionname">
1377 <xsl:text> raises(
</xsl:text>
1378 <xsl:apply-templates select=
"exceptionname" mode=
"idl"/>
1379 <xsl:text>)
</xsl:text>
1381 <xsl:if test=
"modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
1382 <xsl:text> </xsl:text>
1383 <xsl:apply-templates select=
"$end-modifiers" mode=
"idl"/>
1385 <xsl:text>;
</xsl:text>
1387 <xsl:call-template name=
"synop-break"/>
1390 <!-- ===== Perl ======================================================== -->
1392 <xsl:template match=
"classsynopsis" mode=
"perl">
1394 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1395 <xsl:text>package
</xsl:text>
1396 <xsl:apply-templates select=
"ooclass[1]" mode=
"perl"/>
1397 <xsl:text>;
</xsl:text>
1400 <xsl:if test=
"ooclass[preceding-sibling::*]">
1401 <xsl:text>@ISA = (
</xsl:text>
1402 <xsl:apply-templates select=
"ooclass[preceding-sibling::*]" mode=
"perl"/>
1403 <xsl:text>);
</xsl:text>
1407 <xsl:apply-templates select=
"constructorsynopsis
1411 |classsynopsisinfo" mode=
"perl"/>
1415 <xsl:template match=
"classsynopsisinfo" mode=
"perl">
1416 <xsl:apply-templates mode=
"perl"/>
1419 <xsl:template match=
"ooclass|oointerface|ooexception" mode=
"perl">
1420 <xsl:if test=
"preceding-sibling::*">
1421 <xsl:text>,
</xsl:text>
1424 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1425 <xsl:apply-templates mode=
"perl"/>
1429 <xsl:template match=
"modifier|package" mode=
"perl">
1431 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1432 <xsl:apply-templates mode=
"perl"/>
1433 <xsl:if test=
"following-sibling::*">
1434 <xsl:text> </xsl:text>
1439 <xsl:template match=
"classname" mode=
"perl">
1440 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'classname'">
1441 <xsl:text>,
</xsl:text>
1444 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1445 <xsl:apply-templates mode=
"perl"/>
1449 <xsl:template match=
"interfacename" mode=
"perl">
1450 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'interfacename'">
1451 <xsl:text>,
</xsl:text>
1454 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1455 <xsl:apply-templates mode=
"perl"/>
1459 <xsl:template match=
"exceptionname" mode=
"perl">
1460 <xsl:if test=
"local-name(preceding-sibling::*[1]) = 'exceptionname'">
1461 <xsl:text>,
</xsl:text>
1464 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1465 <xsl:apply-templates mode=
"perl"/>
1469 <xsl:template match=
"fieldsynopsis" mode=
"perl">
1471 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1472 <xsl:if test=
"parent::classsynopsis">
1473 <xsl:text> </xsl:text>
1475 <xsl:apply-templates mode=
"perl"/>
1476 <xsl:text>;
</xsl:text>
1478 <xsl:call-template name=
"synop-break"/>
1481 <xsl:template match=
"type" mode=
"perl">
1483 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1484 <xsl:apply-templates mode=
"perl"/>
1485 <xsl:text> </xsl:text>
1489 <xsl:template match=
"varname" mode=
"perl">
1491 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1492 <xsl:apply-templates mode=
"perl"/>
1493 <xsl:text> </xsl:text>
1497 <xsl:template match=
"initializer" mode=
"perl">
1499 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1500 <xsl:text>=
</xsl:text>
1501 <xsl:apply-templates mode=
"perl"/>
1505 <xsl:template match=
"void" mode=
"perl">
1507 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1508 <xsl:text>void
</xsl:text>
1512 <xsl:template match=
"methodname" mode=
"perl">
1514 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1515 <xsl:apply-templates mode=
"perl"/>
1519 <xsl:template match=
"methodparam" mode=
"perl">
1520 <xsl:if test=
"preceding-sibling::methodparam">
1521 <xsl:text>,
</xsl:text>
1524 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1525 <xsl:apply-templates mode=
"perl"/>
1529 <xsl:template match=
"parameter" mode=
"perl">
1531 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1532 <xsl:apply-templates mode=
"perl"/>
1536 <xsl:template mode=
"perl"
1537 match=
"constructorsynopsis|destructorsynopsis|methodsynopsis">
1538 <xsl:variable name=
"start-modifiers" select=
"modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1539 <xsl:variable name=
"notmod" select=
"*[local-name(.) != 'modifier']"/>
1540 <xsl:variable name=
"end-modifiers" select=
"modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1543 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1544 <xsl:text>sub
</xsl:text>
1546 <xsl:apply-templates select=
"methodname" mode=
"perl"/>
1547 <xsl:text> { ... };
</xsl:text>
1549 <xsl:call-template name=
"synop-break"/>
1552 <!-- ==================================================================== -->
1554 <!-- * DocBook 5 allows linking elements (link, olink, and xref) -->
1555 <!-- * within the OO *synopsis elements (classsynopsis, fieldsynopsis, -->
1556 <!-- * methodsynopsis, constructorsynopsis, destructorsynopsis) and -->
1557 <!-- * their children. So we need to have mode="java|cpp|idl|perl" -->
1558 <!-- * per-mode matches for those linking elements in order for them -->
1559 <!-- * to be processed as expected. -->
1561 <xsl:template match=
"link|olink|xref" mode=
"java">
1562 <xsl:apply-templates select=
"."/>
1565 <xsl:template match=
"link|olink|xref" mode=
"cpp">
1566 <xsl:apply-templates select=
"."/>
1569 <xsl:template match=
"link|olink|xref" mode=
"idl">
1570 <xsl:apply-templates select=
"."/>
1573 <xsl:template match=
"link|olink|xref" mode=
"perl">
1574 <xsl:apply-templates select=
"."/>