Whamcloud - gitweb
LUDOC-120 presentation: build bits for webhelp.
[doc/manual.git] / webhelp / xhtml / synop.xsl
1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6 <!-- ********************************************************************
7      $Id: synop.xsl 9829 2013-11-05 20:07:15Z bobstayton $
8      ********************************************************************
9
10      This file is part of the XSL DocBook Stylesheet distribution.
11      See ../README or http://docbook.sf.net/release/xsl/current/ for
12      copyright and other information.
13
14      ******************************************************************** -->
15
16 <!-- ==================================================================== -->
17
18 <!-- synopsis is in verbatim -->
19
20 <!-- ==================================================================== -->
21
22 <xsl:template match="cmdsynopsis">
23   <div>
24     <xsl:apply-templates select="." mode="common.html.attributes"/>
25     <p>
26       <xsl:call-template name="id.attribute">
27         <xsl:with-param name="conditional" select="0"/>
28       </xsl:call-template>
29       <xsl:choose>
30         <xsl:when test="..//processing-instruction('dbcmdlist')">
31           <!-- * Placing a dbcmdlist PI as a child of a particular element -->
32           <!-- * creates a hyperlinked list of all cmdsynopsis instances -->
33           <!-- * that are descendants of that element; so for any -->
34           <!-- * cmdsynopsis that is a descendant of an element containing -->
35           <!-- * a dbcmdlist PI, we need to output an a@id instance so that -->
36           <!-- * we will have something to link to -->
37           <xsl:call-template name="anchor">
38             <xsl:with-param name="conditional" select="0"/>
39           </xsl:call-template>
40         </xsl:when>
41         <xsl:otherwise>
42           <xsl:call-template name="anchor">
43             <xsl:with-param name="conditional" select="1"/>
44           </xsl:call-template>
45         </xsl:otherwise>
46       </xsl:choose>
47       <xsl:apply-templates/>
48     </p>
49   </div>
50 </xsl:template>
51
52 <xsl:template match="cmdsynopsis/command">
53   <br/>
54   <xsl:call-template name="inline.monoseq"/>
55   <xsl:text> </xsl:text>
56 </xsl:template>
57
58 <xsl:template match="cmdsynopsis/command[1]" priority="2">
59   <xsl:call-template name="inline.monoseq"/>
60   <xsl:text> </xsl:text>
61 </xsl:template>
62
63 <xsl:template match="group|arg" name="group-or-arg">
64   <xsl:variable name="choice" select="@choice"/>
65   <xsl:variable name="rep" select="@rep"/>
66   <xsl:variable name="sepchar">
67     <xsl:choose>
68       <xsl:when test="ancestor-or-self::*/@sepchar">
69         <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
70       </xsl:when>
71       <xsl:otherwise>
72         <xsl:text> </xsl:text>
73       </xsl:otherwise>
74     </xsl:choose>
75   </xsl:variable>
76
77   <xsl:if test="preceding-sibling::*">
78     <xsl:value-of select="$sepchar"/>
79   </xsl:if>
80   <xsl:choose>
81     <xsl:when test="$choice='plain'">
82       <xsl:value-of select="$arg.choice.plain.open.str"/>
83     </xsl:when>
84     <xsl:when test="$choice='req'">
85       <xsl:value-of select="$arg.choice.req.open.str"/>
86     </xsl:when>
87     <xsl:when test="$choice='opt'">
88       <xsl:value-of select="$arg.choice.opt.open.str"/>
89     </xsl:when>
90     <xsl:otherwise>
91       <xsl:value-of select="$arg.choice.def.open.str"/>
92     </xsl:otherwise>
93   </xsl:choose>
94   <xsl:apply-templates/>
95   <xsl:choose>
96     <xsl:when test="$rep='repeat'">
97       <xsl:value-of select="$arg.rep.repeat.str"/>
98     </xsl:when>
99     <xsl:when test="$rep='norepeat'">
100       <xsl:value-of select="$arg.rep.norepeat.str"/>
101     </xsl:when>
102     <xsl:otherwise>
103       <xsl:value-of select="$arg.rep.def.str"/>
104     </xsl:otherwise>
105   </xsl:choose>
106   <xsl:choose>
107     <xsl:when test="$choice='plain'">
108       <xsl:value-of select="$arg.choice.plain.close.str"/>
109     </xsl:when>
110     <xsl:when test="$choice='req'">
111       <xsl:value-of select="$arg.choice.req.close.str"/>
112     </xsl:when>
113     <xsl:when test="$choice='opt'">
114       <xsl:value-of select="$arg.choice.opt.close.str"/>
115     </xsl:when>
116     <xsl:otherwise>
117       <xsl:value-of select="$arg.choice.def.close.str"/>
118     </xsl:otherwise>
119   </xsl:choose>
120 </xsl:template>
121
122 <xsl:template match="group/arg">
123   <xsl:variable name="choice" select="@choice"/>
124   <xsl:variable name="rep" select="@rep"/>
125   <xsl:if test="preceding-sibling::*">
126     <xsl:value-of select="$arg.or.sep"/>
127   </xsl:if>
128   <xsl:call-template name="group-or-arg"/>
129 </xsl:template>
130
131 <xsl:template match="sbr">
132   <br/>
133 </xsl:template>
134
135 <!-- ==================================================================== -->
136
137 <xsl:template match="synopfragmentref">
138   <xsl:variable name="target" select="key('id',@linkend)"/>
139   <xsl:variable name="snum">
140     <xsl:apply-templates select="$target" mode="synopfragment.number"/>
141   </xsl:variable>
142   <em xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
143     <a href="#{@linkend}">
144       <xsl:text>(</xsl:text>
145       <xsl:value-of select="$snum"/>
146       <xsl:text>)</xsl:text>
147     </a>
148     <xsl:text>&#160;</xsl:text>
149     <xsl:apply-templates/>
150   </em>
151 </xsl:template>
152
153 <xsl:template match="synopfragment" mode="synopfragment.number">
154   <xsl:number format="1"/>
155 </xsl:template>
156
157 <xsl:template match="synopfragment">
158   <xsl:variable name="snum">
159     <xsl:apply-templates select="." mode="synopfragment.number"/>
160   </xsl:variable>
161   <!-- You can't introduce another <p> here, because you're 
162        already in a <p> from cmdsynopsis-->
163   <span>
164     <xsl:variable name="id">
165       <xsl:call-template name="object.id"/>
166     </xsl:variable>
167     <a id="{$id}">
168       <xsl:text>(</xsl:text>
169       <xsl:value-of select="$snum"/>
170       <xsl:text>)</xsl:text>
171     </a>
172     <xsl:text> </xsl:text>
173     <xsl:apply-templates/>
174   </span>
175 </xsl:template>
176
177 <xsl:template match="funcsynopsis">
178   <xsl:if test="..//processing-instruction('dbfunclist')">
179     <!-- * Placing a dbfunclist PI as a child of a particular element -->
180     <!-- * creates a hyperlinked list of all funcsynopsis instances that -->
181     <!-- * are descendants of that element; so for any funcsynopsis that is -->
182     <!-- * a descendant of an element containing a dbfunclist PI, we need -->
183     <!-- * to output an a@id instance so that we will have something to -->
184     <!-- * link to -->
185     <span>
186       <xsl:call-template name="id.attribute">
187         <xsl:with-param name="conditional" select="0"/>
188       </xsl:call-template>
189     </span>
190     <xsl:call-template name="anchor">
191       <xsl:with-param name="conditional" select="0"/>
192     </xsl:call-template>
193   </xsl:if>
194   <xsl:call-template name="informal.object"/>
195 </xsl:template>
196
197 <xsl:template match="funcsynopsisinfo">
198   <pre>
199     <xsl:apply-templates select="." mode="common.html.attributes"/>
200     <xsl:call-template name="id.attribute"/>
201     <xsl:apply-templates/>
202   </pre>
203 </xsl:template>
204
205 <!-- ====================================================================== -->
206 <!-- funcprototype -->
207 <!--
208
209 funcprototype ::= (funcdef,
210                    (void|varargs|paramdef+))
211
212 funcdef       ::= (#PCDATA|type|replaceable|function)*
213
214 paramdef      ::= (#PCDATA|type|replaceable|parameter|funcparams)*
215 -->
216
217 <xsl:template match="funcprototype">
218   <xsl:variable name="html-style">
219     <xsl:call-template name="pi.dbhtml_funcsynopsis-style">
220       <xsl:with-param name="node" select="ancestor::funcsynopsis/descendant-or-self::*"/>
221     </xsl:call-template>
222   </xsl:variable>
223
224   <xsl:variable name="style">
225     <xsl:choose>
226       <xsl:when test="$html-style != ''">
227         <xsl:value-of select="$html-style"/>
228       </xsl:when>
229       <xsl:otherwise>
230         <xsl:value-of select="$funcsynopsis.style"/>
231       </xsl:otherwise>
232     </xsl:choose>
233   </xsl:variable>
234
235 <!-- * 2008-02-17. the code no longer relies on the funcsynopsis.tabular.threshold -->
236 <!-- * param at all (the stuff below has been commented out since mid -->
237 <!-- * 2006), so I completely removed the funcsynopsis.tabular.threshold param -->
238 <!-- * .. MikeSmith -->
239 <!--
240   <xsl:variable name="tabular-p"
241                 select="$funcsynopsis.tabular.threshold &gt; 0
242                         and string-length(.) &gt; $funcsynopsis.tabular.threshold"/>
243 -->
244
245   <xsl:variable name="tabular-p" select="true()"/>
246
247   <xsl:choose>
248     <xsl:when test="$style = 'kr' and $tabular-p">
249       <xsl:apply-templates select="." mode="kr-tabular"/>
250     </xsl:when>
251     <xsl:when test="$style = 'kr'">
252       <xsl:apply-templates select="." mode="kr-nontabular"/>
253     </xsl:when>
254     <xsl:when test="$style = 'ansi' and $tabular-p">
255       <xsl:apply-templates select="." mode="ansi-tabular"/>
256     </xsl:when>
257     <xsl:otherwise>
258       <xsl:apply-templates select="." mode="ansi-nontabular"/>
259     </xsl:otherwise>
260   </xsl:choose>
261 </xsl:template>
262
263 <!-- ====================================================================== -->
264 <!-- funcprototype: kr, non-tabular -->
265
266 <xsl:template match="funcprototype" mode="kr-nontabular">
267   <p>
268     <xsl:apply-templates mode="kr-nontabular"/>
269     <xsl:if test="paramdef">
270       <br/>
271       <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/>
272     </xsl:if>
273   </p>
274 </xsl:template>
275
276 <xsl:template match="funcdef" mode="kr-nontabular">
277   <code>
278     <xsl:apply-templates select="." mode="common.html.attributes"/>
279     <xsl:call-template name="id.attribute"/>
280     <xsl:apply-templates mode="kr-nontabular"/>
281     <xsl:text>(</xsl:text>
282   </code>
283 </xsl:template>
284
285 <xsl:template match="funcdef/function" mode="kr-nontabular">
286   <xsl:choose>
287     <xsl:when test="$funcsynopsis.decoration != 0">
288       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform" class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></strong>
289     </xsl:when>
290     <xsl:otherwise>
291       <xsl:apply-templates mode="kr-nontabular"/>
292     </xsl:otherwise>
293   </xsl:choose>
294 </xsl:template>
295
296 <xsl:template match="void" mode="kr-nontabular">
297   <code>)</code>
298   <xsl:text>;</xsl:text>
299 </xsl:template>
300
301 <xsl:template match="varargs" mode="kr-nontabular">
302   <xsl:text>...</xsl:text>
303   <code>)</code>
304   <xsl:text>;</xsl:text>
305 </xsl:template>
306
307 <xsl:template match="paramdef" mode="kr-nontabular">
308   <xsl:apply-templates select="parameter" mode="kr-nontabular"/>
309   <xsl:choose>
310     <xsl:when test="following-sibling::*">
311       <xsl:text>, </xsl:text>
312     </xsl:when>
313     <xsl:otherwise>
314       <code>)</code>
315       <xsl:text>;</xsl:text>
316     </xsl:otherwise>
317   </xsl:choose>
318 </xsl:template>
319
320 <xsl:template match="paramdef/parameter" mode="kr-nontabular">
321   <xsl:choose>
322     <xsl:when test="$funcsynopsis.decoration != 0">
323       <var class="pdparam">
324         <xsl:apply-templates mode="kr-nontabular"/>
325       </var>
326     </xsl:when>
327     <xsl:otherwise>
328       <code>
329         <xsl:apply-templates mode="kr-nontabular"/>
330       </code>
331     </xsl:otherwise>
332   </xsl:choose>
333 </xsl:template>
334
335 <xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
336   <xsl:if test="preceding-sibling::paramdef"><br/></xsl:if>
337   <code>
338     <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
339   </code>
340   <xsl:text>;</xsl:text>
341 </xsl:template>
342
343 <xsl:template match="paramdef/parameter" mode="kr-funcsynopsis-mode">
344   <xsl:choose>
345     <xsl:when test="$funcsynopsis.decoration != 0">
346       <var class="pdparam">
347         <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
348       </var>
349     </xsl:when>
350     <xsl:otherwise>
351       <code>
352         <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
353       </code>
354     </xsl:otherwise>
355   </xsl:choose>
356 </xsl:template>
357
358 <xsl:template match="funcparams" mode="kr-funcsynopsis-mode">
359   <code>(</code>
360   <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
361   <code>)</code>
362 </xsl:template>
363
364 <!-- ====================================================================== -->
365 <!-- funcprototype: kr, tabular -->
366
367 <xsl:template match="funcprototype" mode="kr-tabular">
368   <table border="{$table.border.off}" class="funcprototype-table">
369     <xsl:if test="$div.element != 'section'">
370       <xsl:attribute name="summary">Function synopsis</xsl:attribute>
371     </xsl:if>
372     <xsl:if test="$css.decoration != 0">
373       <xsl:attribute name="style">cellspacing: 0; cellpadding: 0;</xsl:attribute>
374     </xsl:if>
375     <tr>
376       <td>
377         <xsl:apply-templates select="funcdef" mode="kr-tabular"/>
378       </td>
379       <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="kr-tabular"/>
380     </tr>
381     <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
382       <tr>
383         <td>&#160;</td>
384         <xsl:apply-templates select="." mode="kr-tabular"/>
385       </tr>
386     </xsl:for-each>
387   </table>
388   <xsl:if test="paramdef">
389     <div class="paramdef-list">
390       <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/>
391     </div>
392   </xsl:if>
393   <div class="funcprototype-spacer">&#160;</div> <!-- hACk: blank div for vertical spacing -->
394 </xsl:template>
395
396 <xsl:template match="funcdef" mode="kr-tabular">
397   <code>
398     <xsl:apply-templates select="." mode="common.html.attributes"/>
399     <xsl:call-template name="id.attribute"/>
400     <xsl:apply-templates mode="kr-tabular"/>
401     <xsl:text>(</xsl:text>
402   </code>
403 </xsl:template>
404
405 <xsl:template match="funcdef/function" mode="kr-tabular">
406   <xsl:choose>
407     <xsl:when test="$funcsynopsis.decoration != 0">
408       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform" class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></strong>
409     </xsl:when>
410     <xsl:otherwise>
411       <xsl:apply-templates mode="kr-tabular"/>
412     </xsl:otherwise>
413   </xsl:choose>
414 </xsl:template>
415
416 <xsl:template match="void" mode="kr-tabular">
417   <td>
418     <code>)</code>
419     <xsl:text>;</xsl:text>
420   </td>
421   <td>&#160;</td>
422 </xsl:template>
423
424 <xsl:template match="varargs" mode="kr-tabular">
425   <td>
426     <xsl:text>...</xsl:text>
427     <code>)</code>
428     <xsl:text>;</xsl:text>
429   </td>
430   <td>&#160;</td>
431 </xsl:template>
432
433 <xsl:template match="paramdef" mode="kr-tabular">
434   <td>
435     <xsl:apply-templates select="parameter" mode="kr-tabular"/>
436     <xsl:choose>
437       <xsl:when test="following-sibling::*">
438         <xsl:text>, </xsl:text>
439       </xsl:when>
440       <xsl:otherwise>
441         <code>)</code>
442         <xsl:text>;</xsl:text>
443       </xsl:otherwise>
444     </xsl:choose>
445   </td>
446   <td>&#160;</td>
447 </xsl:template>
448
449 <xsl:template match="paramdef/parameter" mode="kr-tabular">
450   <xsl:choose>
451     <xsl:when test="$funcsynopsis.decoration != 0">
452       <var class="pdparam">
453         <xsl:apply-templates mode="kr-tabular"/>
454       </var>
455     </xsl:when>
456     <xsl:otherwise>
457       <code>
458         <xsl:apply-templates mode="kr-tabular"/>
459       </code>
460     </xsl:otherwise>
461   </xsl:choose>
462 </xsl:template>
463
464 <xsl:template match="paramdef" mode="kr-tabular-funcsynopsis-mode">
465   <xsl:variable name="type">
466     <xsl:choose>
467       <xsl:when test="type">
468         <xsl:apply-templates select="type" mode="kr-tabular-funcsynopsis-mode"/>
469       </xsl:when>
470       <xsl:when test="normalize-space(parameter/preceding-sibling::node()[not(self::parameter)]) != ''">
471         <xsl:copy-of select="parameter/preceding-sibling::node()[not(self::parameter)]"/>
472       </xsl:when>
473     </xsl:choose>
474   </xsl:variable>
475
476   <tr>
477     <xsl:choose>
478       <xsl:when test="$type != '' and funcparams">
479         <td>
480           <code>
481             <xsl:copy-of select="$type"/>
482           </code>
483           <xsl:text>&#160;</xsl:text>
484         </td>
485         <td>
486           <code>
487             <xsl:choose>
488               <xsl:when test="type">
489                 <xsl:apply-templates select="type/following-sibling::*" mode="kr-tabular-funcsynopsis-mode"/>
490               </xsl:when>
491               <xsl:otherwise>
492                 <xsl:apply-templates select="*" mode="kr-tabular-funcsynopsis-mode"/>
493               </xsl:otherwise>
494             </xsl:choose>
495           </code>
496         </td>
497       </xsl:when>
498
499       <xsl:when test="funcparams">
500         <td colspan="2">
501           <code>
502             <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
503           </code>
504         </td>
505       </xsl:when>
506
507       <xsl:otherwise>
508         <td>
509           <code>
510             <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]" mode="kr-tabular-funcsynopsis-mode"/>
511           </code>
512           <xsl:text>&#160;</xsl:text>
513         </td>
514         <td>
515           <code>
516             <xsl:apply-templates select="parameter" mode="kr-tabular"/>
517             <xsl:apply-templates select="parameter/following-sibling::*[not(self::parameter)]" mode="kr-tabular-funcsynopsis-mode"/>
518             <xsl:text>;</xsl:text>
519           </code>
520         </td>
521       </xsl:otherwise>
522     </xsl:choose>
523   </tr>
524 </xsl:template>
525
526 <xsl:template match="paramdef/parameter" mode="kr-tabular-funcsynopsis-mode">
527   <xsl:choose>
528     <xsl:when test="$funcsynopsis.decoration != 0">
529       <var class="pdparam">
530         <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
531       </var>
532     </xsl:when>
533     <xsl:otherwise>
534       <code>
535         <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
536       </code>
537     </xsl:otherwise>
538   </xsl:choose>
539 </xsl:template>
540
541 <xsl:template match="funcparams" mode="kr-tabular-funcsynopsis-mode">
542   <code>(</code>
543   <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
544   <code>)</code>
545   <xsl:text>;</xsl:text>
546 </xsl:template>
547
548 <!-- ====================================================================== -->
549 <!-- funcprototype: ansi, non-tabular -->
550
551 <xsl:template match="funcprototype" mode="ansi-nontabular">
552   <p>
553     <xsl:apply-templates mode="ansi-nontabular"/>
554   </p>
555 </xsl:template>
556
557 <xsl:template match="funcdef" mode="ansi-nontabular">
558   <code>
559     <xsl:apply-templates select="." mode="common.html.attributes"/>
560     <xsl:call-template name="id.attribute"/>
561     <xsl:apply-templates mode="ansi-nontabular"/>
562     <xsl:text>(</xsl:text>
563   </code>
564 </xsl:template>
565
566 <xsl:template match="funcdef/function" mode="ansi-nontabular">
567   <xsl:choose>
568     <xsl:when test="$funcsynopsis.decoration != 0">
569       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform" class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></strong>
570     </xsl:when>
571     <xsl:otherwise>
572       <xsl:apply-templates mode="ansi-nontabular"/>
573     </xsl:otherwise>
574   </xsl:choose>
575 </xsl:template>
576
577 <xsl:template match="void" mode="ansi-nontabular">
578   <code>void)</code>
579   <xsl:text>;</xsl:text>
580 </xsl:template>
581
582 <xsl:template match="varargs" mode="ansi-nontabular">
583   <xsl:text>...</xsl:text>
584   <code>)</code>
585   <xsl:text>;</xsl:text>
586 </xsl:template>
587
588 <xsl:template match="paramdef" mode="ansi-nontabular">
589   <xsl:apply-templates mode="ansi-nontabular"/>
590   <xsl:choose>
591     <xsl:when test="following-sibling::*">
592       <xsl:text>, </xsl:text>
593     </xsl:when>
594     <xsl:otherwise>
595       <code>)</code>
596       <xsl:text>;</xsl:text>
597     </xsl:otherwise>
598   </xsl:choose>
599 </xsl:template>
600
601 <xsl:template match="paramdef/parameter" mode="ansi-nontabular">
602   <xsl:choose>
603     <xsl:when test="$funcsynopsis.decoration != 0">
604       <var class="pdparam">
605         <xsl:apply-templates mode="ansi-nontabular"/>
606       </var>
607     </xsl:when>
608     <xsl:otherwise>
609       <code>
610         <xsl:apply-templates mode="ansi-nontabular"/>
611       </code>
612     </xsl:otherwise>
613   </xsl:choose>
614 </xsl:template>
615
616 <xsl:template match="funcparams" mode="ansi-nontabular">
617   <code>(</code>
618   <xsl:apply-templates mode="ansi-nontabular"/>
619   <code>)</code>
620 </xsl:template>
621
622 <!-- ====================================================================== -->
623 <!-- funcprototype: ansi, tabular -->
624
625 <xsl:template match="funcprototype" mode="ansi-tabular">
626   <table border="{$table.border.off}" class="funcprototype-table">
627     <xsl:if test="$div.element != 'section'">
628       <xsl:attribute name="summary">Function synopsis</xsl:attribute>
629     </xsl:if>
630     <xsl:if test="$css.decoration != 0">
631       <xsl:attribute name="style">cellspacing: 0; cellpadding: 0;</xsl:attribute>
632     </xsl:if>
633     <tr>
634       <td>
635         <xsl:apply-templates select="funcdef" mode="ansi-tabular"/>
636       </td>
637       <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="ansi-tabular"/>
638     </tr>
639     <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
640       <tr>
641         <td>&#160;</td>
642         <xsl:apply-templates select="." mode="ansi-tabular"/>
643       </tr>
644     </xsl:for-each>
645   </table>
646   <div class="funcprototype-spacer">&#160;</div> <!-- hACk: blank div for vertical spacing -->
647 </xsl:template>
648
649 <xsl:template match="funcdef" mode="ansi-tabular">
650   <code>
651     <xsl:apply-templates select="." mode="common.html.attributes"/>
652     <xsl:call-template name="id.attribute"/>
653     <xsl:apply-templates mode="ansi-tabular"/>
654     <xsl:text>(</xsl:text>
655   </code>
656 </xsl:template>
657
658 <xsl:template match="funcdef/function" mode="ansi-tabular">
659   <xsl:choose>
660     <xsl:when test="$funcsynopsis.decoration != 0">
661       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform" class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></strong>
662     </xsl:when>
663     <xsl:otherwise>
664       <xsl:apply-templates mode="kr-tabular"/>
665     </xsl:otherwise>
666   </xsl:choose>
667 </xsl:template>
668
669 <xsl:template match="void" mode="ansi-tabular">
670   <td>
671     <code>void)</code>
672     <xsl:text>;</xsl:text>
673   </td>
674   <td>&#160;</td>
675 </xsl:template>
676
677 <xsl:template match="varargs" mode="ansi-tabular">
678   <td>
679     <xsl:text>...</xsl:text>
680     <code>)</code>
681     <xsl:text>;</xsl:text>
682   </td>
683   <td>&#160;</td>
684 </xsl:template>
685
686 <xsl:template match="paramdef" mode="ansi-tabular">
687       <td>
688         <xsl:apply-templates mode="ansi-tabular"/>
689         <xsl:choose>
690           <xsl:when test="following-sibling::*">
691             <xsl:text>, </xsl:text>
692           </xsl:when>
693           <xsl:otherwise>
694             <code>)</code>
695             <xsl:text>;</xsl:text>
696           </xsl:otherwise>
697         </xsl:choose>
698       </td>
699 </xsl:template>
700
701 <xsl:template match="paramdef/parameter" mode="ansi-tabular">
702   <xsl:choose>
703     <xsl:when test="$funcsynopsis.decoration != 0">
704       <var class="pdparam">
705         <xsl:apply-templates mode="ansi-tabular"/>
706       </var>
707     </xsl:when>
708     <xsl:otherwise>
709       <code>
710         <xsl:apply-templates mode="ansi-tabular"/>
711       </code>
712     </xsl:otherwise>
713   </xsl:choose>
714 </xsl:template>
715
716 <xsl:template match="funcparams" mode="ansi-tabular">
717   <code>(</code>
718   <xsl:apply-templates/>
719   <code>)</code>
720 </xsl:template>
721
722 <!-- ====================================================================== -->
723
724 <xsl:variable name="default-classsynopsis-language">java</xsl:variable>
725
726 <xsl:template match="classsynopsis                      |fieldsynopsis                      |methodsynopsis                      |constructorsynopsis                      |destructorsynopsis">
727   <xsl:param name="language">
728     <xsl:choose>
729       <xsl:when test="@language">
730         <xsl:value-of select="@language"/>
731       </xsl:when>
732       <xsl:otherwise>
733         <xsl:value-of select="$default-classsynopsis-language"/>
734       </xsl:otherwise>
735     </xsl:choose>
736   </xsl:param>
737
738   <xsl:choose>
739     <xsl:when test="$language='java' or $language='Java'">
740       <xsl:apply-templates select="." mode="java"/>
741     </xsl:when>
742     <xsl:when test="$language='perl' or $language='Perl'">
743       <xsl:apply-templates select="." mode="perl"/>
744     </xsl:when>
745     <xsl:when test="$language='idl' or $language='IDL'">
746       <xsl:apply-templates select="." mode="idl"/>
747     </xsl:when>
748     <xsl:when test="$language='cpp' or $language='c++' or $language='C++'">
749       <xsl:apply-templates select="." mode="cpp"/>
750     </xsl:when>
751     <xsl:otherwise>
752       <xsl:message>
753         <xsl:text>Unrecognized language on </xsl:text>
754         <xsl:value-of select="local-name(.)"/>
755         <xsl:text>: </xsl:text>
756         <xsl:value-of select="$language"/>
757       </xsl:message>
758       <xsl:apply-templates select=".">
759         <xsl:with-param name="language" select="$default-classsynopsis-language"/>
760       </xsl:apply-templates>
761     </xsl:otherwise>
762   </xsl:choose>
763 </xsl:template>
764
765 <xsl:template name="synop-break">
766   <xsl:if test="parent::classsynopsis                 or (following-sibling::fieldsynopsis                     |following-sibling::methodsynopsis                     |following-sibling::constructorsynopsis                     |following-sibling::destructorsynopsis)">
767     <br/>
768   </xsl:if>
769 </xsl:template>
770
771
772 <!-- ===== Java ======================================================== -->
773
774 <xsl:template match="classsynopsis" mode="java">
775   <pre>
776     <xsl:apply-templates select="." mode="common.html.attributes"/>
777     <xsl:call-template name="id.attribute"/>
778     <xsl:apply-templates select="ooclass[1]" mode="java"/>
779     <xsl:if test="ooclass[preceding-sibling::*]">
780       <xsl:text> extends</xsl:text>
781       <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="java"/>
782       <xsl:if test="oointerface|ooexception">
783         <br/>
784         <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
785       </xsl:if>
786     </xsl:if>
787     <xsl:if test="oointerface">
788       <xsl:text>implements</xsl:text>
789       <xsl:apply-templates select="oointerface" mode="java"/>
790       <xsl:if test="ooexception">
791         <br/>
792         <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
793       </xsl:if>
794     </xsl:if>
795     <xsl:if test="ooexception">
796       <xsl:text>throws</xsl:text>
797       <xsl:apply-templates select="ooexception" mode="java"/>
798     </xsl:if>
799     <xsl:text>&#160;{</xsl:text>
800     <br/>
801     <xsl:apply-templates select="constructorsynopsis                                  |destructorsynopsis                                  |fieldsynopsis                                  |methodsynopsis                                  |classsynopsisinfo" mode="java"/>
802     <xsl:text>}</xsl:text>
803   </pre>
804 </xsl:template>
805
806 <xsl:template match="classsynopsisinfo" mode="java">
807   <xsl:apply-templates mode="java"/>
808 </xsl:template>
809
810 <xsl:template match="ooclass|oointerface|ooexception" mode="java">
811   <xsl:choose>
812     <xsl:when test="preceding-sibling::*">
813       <xsl:text>, </xsl:text>
814     </xsl:when>
815     <xsl:otherwise>
816       <xsl:text> </xsl:text>
817     </xsl:otherwise>
818   </xsl:choose>
819   <span>
820     <xsl:apply-templates select="." mode="common.html.attributes"/>
821     <xsl:call-template name="id.attribute"/>
822     <xsl:apply-templates mode="java"/>
823   </span>
824 </xsl:template>
825
826 <xsl:template match="modifier|package" mode="java">
827   <span>
828     <xsl:apply-templates select="." mode="common.html.attributes"/>
829     <xsl:call-template name="id.attribute"/>
830     <xsl:apply-templates mode="java"/>
831     <xsl:if test="following-sibling::*">
832       <xsl:text>&#160;</xsl:text>
833     </xsl:if>
834   </span>
835 </xsl:template>
836
837 <xsl:template match="classname" mode="java">
838   <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
839     <xsl:text>, </xsl:text>
840   </xsl:if>
841   <span>
842     <xsl:apply-templates select="." mode="common.html.attributes"/>
843     <xsl:call-template name="id.attribute"/>
844     <xsl:apply-templates mode="java"/>
845   </span>
846 </xsl:template>
847
848 <xsl:template match="interfacename" mode="java">
849   <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
850     <xsl:text>, </xsl:text>
851   </xsl:if>
852   <span>
853     <xsl:apply-templates select="." mode="common.html.attributes"/>
854     <xsl:call-template name="id.attribute"/>
855     <xsl:apply-templates mode="java"/>
856   </span>
857 </xsl:template>
858
859 <xsl:template match="exceptionname" mode="java">
860   <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
861     <xsl:text>, </xsl:text>
862   </xsl:if>
863   <span>
864     <xsl:apply-templates select="." mode="common.html.attributes"/>
865     <xsl:call-template name="id.attribute"/>
866     <xsl:apply-templates mode="java"/>
867   </span>
868 </xsl:template>
869
870 <xsl:template match="fieldsynopsis" mode="java">
871   <code>
872     <xsl:apply-templates select="." mode="common.html.attributes"/>
873     <xsl:call-template name="id.attribute"/>
874     <xsl:if test="parent::classsynopsis">
875       <xsl:text>&#160;&#160;</xsl:text>
876     </xsl:if>
877     <xsl:apply-templates mode="java"/>
878     <xsl:text>;</xsl:text>
879   </code>
880   <xsl:call-template name="synop-break"/>
881 </xsl:template>
882
883 <xsl:template match="type" mode="java">
884   <span>
885     <xsl:apply-templates select="." mode="common.html.attributes"/>
886     <xsl:call-template name="id.attribute"/>
887     <xsl:apply-templates mode="java"/>
888     <xsl:text>&#160;</xsl:text>
889   </span>
890 </xsl:template>
891
892 <xsl:template match="varname" mode="java">
893   <span>
894     <xsl:apply-templates select="." mode="common.html.attributes"/>
895     <xsl:call-template name="id.attribute"/>
896     <xsl:apply-templates mode="java"/>
897     <xsl:text>&#160;</xsl:text>
898   </span>
899 </xsl:template>
900
901 <xsl:template match="initializer" mode="java">
902   <span>
903     <xsl:apply-templates select="." mode="common.html.attributes"/>
904     <xsl:call-template name="id.attribute"/>
905     <xsl:text>=&#160;</xsl:text>
906     <xsl:apply-templates mode="java"/>
907   </span>
908 </xsl:template>
909
910 <xsl:template match="void" mode="java">
911   <span>
912     <xsl:apply-templates select="." mode="common.html.attributes"/>
913     <xsl:call-template name="id.attribute"/>
914     <xsl:text>void&#160;</xsl:text>
915   </span>
916 </xsl:template>
917
918 <xsl:template match="methodname" mode="java">
919   <span>
920     <xsl:apply-templates select="." mode="common.html.attributes"/>
921     <xsl:call-template name="id.attribute"/>
922     <xsl:apply-templates mode="java"/>
923   </span>
924 </xsl:template>
925
926 <xsl:template match="methodparam" mode="java">
927   <xsl:param name="indent">0</xsl:param>
928   <xsl:if test="preceding-sibling::methodparam">
929     <xsl:text>,</xsl:text>
930     <br/>
931     <xsl:if test="$indent &gt; 0">
932       <xsl:call-template name="copy-string">
933         <xsl:with-param name="string">&#160;</xsl:with-param>
934         <xsl:with-param name="count" select="$indent + 1"/>
935       </xsl:call-template>
936     </xsl:if>
937   </xsl:if>
938   <span>
939     <xsl:apply-templates select="." mode="common.html.attributes"/>
940     <xsl:call-template name="id.attribute"/>
941     <xsl:apply-templates mode="java"/>
942   </span>
943 </xsl:template>
944
945 <xsl:template match="parameter" mode="java">
946   <span>
947     <xsl:apply-templates select="." mode="common.html.attributes"/>
948     <xsl:call-template name="id.attribute"/>
949     <xsl:apply-templates mode="java"/>
950   </span>
951 </xsl:template>
952
953 <xsl:template mode="java" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
954   <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
955   <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
956   <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
957   <xsl:variable name="decl">
958     <xsl:if test="parent::classsynopsis">
959       <xsl:text>&#160;&#160;</xsl:text>
960     </xsl:if>
961     <xsl:apply-templates select="$start-modifiers" mode="java"/>
962
963     <!-- type -->
964     <xsl:if test="local-name($notmod[1]) != 'methodname'">
965       <xsl:apply-templates select="$notmod[1]" mode="java"/>
966     </xsl:if>
967
968     <xsl:apply-templates select="methodname" mode="java"/>
969   </xsl:variable>
970
971   <code>
972     <xsl:apply-templates select="." mode="common.html.attributes"/>
973     <xsl:call-template name="id.attribute"/>
974     <xsl:copy-of select="$decl"/>
975     <xsl:text>(</xsl:text>
976     <xsl:apply-templates select="methodparam" mode="java">
977       <xsl:with-param name="indent" select="string-length($decl)"/>
978     </xsl:apply-templates>
979     <xsl:text>)</xsl:text>
980     <xsl:if test="exceptionname">
981       <br/>
982       <xsl:text>&#160;&#160;&#160;&#160;throws&#160;</xsl:text>
983       <xsl:apply-templates select="exceptionname" mode="java"/>
984     </xsl:if>
985     <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
986       <xsl:text> </xsl:text>
987       <xsl:apply-templates select="$end-modifiers" mode="java"/>
988     </xsl:if>
989     <xsl:text>;</xsl:text>
990   </code>
991   <xsl:call-template name="synop-break"/>
992 </xsl:template>
993
994 <!-- ===== C++ ========================================================= -->
995
996 <xsl:template match="classsynopsis" mode="cpp">
997   <pre>
998     <xsl:apply-templates select="." mode="common.html.attributes"/>
999     <xsl:call-template name="id.attribute"/>
1000     <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
1001     <xsl:if test="ooclass[preceding-sibling::*]">
1002       <xsl:text>: </xsl:text>
1003       <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="cpp"/>
1004       <xsl:if test="oointerface|ooexception">
1005         <br/>
1006         <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
1007       </xsl:if>
1008     </xsl:if>
1009     <xsl:if test="oointerface">
1010       <xsl:text> implements</xsl:text>
1011       <xsl:apply-templates select="oointerface" mode="cpp"/>
1012       <xsl:if test="ooexception">
1013         <br/>
1014         <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
1015       </xsl:if>
1016     </xsl:if>
1017     <xsl:if test="ooexception">
1018       <xsl:text> throws</xsl:text>
1019       <xsl:apply-templates select="ooexception" mode="cpp"/>
1020     </xsl:if>
1021     <xsl:text>&#160;{</xsl:text>
1022     <br/>
1023     <xsl:apply-templates select="constructorsynopsis                                  |destructorsynopsis                                  |fieldsynopsis                                  |methodsynopsis                                  |classsynopsisinfo" mode="cpp"/>
1024     <xsl:text>}</xsl:text>
1025   </pre>
1026 </xsl:template>
1027
1028 <xsl:template match="classsynopsisinfo" mode="cpp">
1029   <xsl:apply-templates mode="cpp"/>
1030 </xsl:template>
1031
1032 <xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
1033   <xsl:if test="preceding-sibling::*">
1034     <xsl:text>, </xsl:text>
1035   </xsl:if>
1036   <span>
1037     <xsl:apply-templates select="." mode="common.html.attributes"/>
1038     <xsl:call-template name="id.attribute"/>
1039     <xsl:apply-templates mode="cpp"/>
1040   </span>
1041 </xsl:template>
1042
1043 <xsl:template match="modifier|package" mode="cpp">
1044   <span>
1045     <xsl:apply-templates select="." mode="common.html.attributes"/>
1046     <xsl:call-template name="id.attribute"/>
1047     <xsl:apply-templates mode="cpp"/>
1048     <xsl:if test="following-sibling::*">
1049       <xsl:text>&#160;</xsl:text>
1050     </xsl:if>
1051   </span>
1052 </xsl:template>
1053
1054 <xsl:template match="classname" mode="cpp">
1055   <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
1056     <xsl:text>, </xsl:text>
1057   </xsl:if>
1058   <span>
1059     <xsl:apply-templates select="." mode="common.html.attributes"/>
1060     <xsl:call-template name="id.attribute"/>
1061     <xsl:apply-templates mode="cpp"/>
1062   </span>
1063 </xsl:template>
1064
1065 <xsl:template match="interfacename" mode="cpp">
1066   <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
1067     <xsl:text>, </xsl:text>
1068   </xsl:if>
1069   <span>
1070     <xsl:apply-templates select="." mode="common.html.attributes"/>
1071     <xsl:call-template name="id.attribute"/>
1072     <xsl:apply-templates mode="cpp"/>
1073   </span>
1074 </xsl:template>
1075
1076 <xsl:template match="exceptionname" mode="cpp">
1077   <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
1078     <xsl:text>, </xsl:text>
1079   </xsl:if>
1080   <span>
1081     <xsl:apply-templates select="." mode="common.html.attributes"/>
1082     <xsl:call-template name="id.attribute"/>
1083     <xsl:apply-templates mode="cpp"/>
1084   </span>
1085 </xsl:template>
1086
1087 <xsl:template match="fieldsynopsis" mode="cpp">
1088   <code>
1089     <xsl:apply-templates select="." mode="common.html.attributes"/>
1090     <xsl:call-template name="id.attribute"/>
1091     <xsl:if test="parent::classsynopsis">
1092       <xsl:text>&#160;&#160;</xsl:text>
1093     </xsl:if>
1094     <xsl:apply-templates mode="cpp"/>
1095     <xsl:text>;</xsl:text>
1096   </code>
1097   <xsl:call-template name="synop-break"/>
1098 </xsl:template>
1099
1100 <xsl:template match="type" mode="cpp">
1101   <span>
1102     <xsl:apply-templates select="." mode="common.html.attributes"/>
1103     <xsl:call-template name="id.attribute"/>
1104     <xsl:apply-templates mode="cpp"/>
1105     <xsl:text>&#160;</xsl:text>
1106   </span>
1107 </xsl:template>
1108
1109 <xsl:template match="varname" mode="cpp">
1110   <span>
1111     <xsl:apply-templates select="." mode="common.html.attributes"/>
1112     <xsl:call-template name="id.attribute"/>
1113     <xsl:apply-templates mode="cpp"/>
1114     <xsl:text>&#160;</xsl:text>
1115   </span>
1116 </xsl:template>
1117
1118 <xsl:template match="initializer" mode="cpp">
1119   <span>
1120     <xsl:apply-templates select="." mode="common.html.attributes"/>
1121     <xsl:call-template name="id.attribute"/>
1122     <xsl:text>=&#160;</xsl:text>
1123     <xsl:apply-templates mode="cpp"/>
1124   </span>
1125 </xsl:template>
1126
1127 <xsl:template match="void" mode="cpp">
1128   <span>
1129     <xsl:apply-templates select="." mode="common.html.attributes"/>
1130     <xsl:call-template name="id.attribute"/>
1131     <xsl:text>void&#160;</xsl:text>
1132   </span>
1133 </xsl:template>
1134
1135 <xsl:template match="methodname" mode="cpp">
1136   <span>
1137     <xsl:apply-templates select="." mode="common.html.attributes"/>
1138     <xsl:call-template name="id.attribute"/>
1139     <xsl:apply-templates mode="cpp"/>
1140   </span>
1141 </xsl:template>
1142
1143 <xsl:template match="methodparam" mode="cpp">
1144   <xsl:if test="preceding-sibling::methodparam">
1145     <xsl:text>, </xsl:text>
1146   </xsl:if>
1147   <span>
1148     <xsl:apply-templates select="." mode="common.html.attributes"/>
1149     <xsl:call-template name="id.attribute"/>
1150     <xsl:apply-templates mode="cpp"/>
1151   </span>
1152 </xsl:template>
1153
1154 <xsl:template match="parameter" mode="cpp">
1155   <span>
1156     <xsl:apply-templates select="." mode="common.html.attributes"/>
1157     <xsl:call-template name="id.attribute"/>
1158     <xsl:apply-templates mode="cpp"/>
1159   </span>
1160 </xsl:template>
1161
1162 <xsl:template mode="cpp" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1163   <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1164   <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
1165   <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1166
1167   <code>
1168     <xsl:apply-templates select="." mode="common.html.attributes"/>
1169     <xsl:call-template name="id.attribute"/>
1170     <xsl:if test="parent::classsynopsis">
1171       <xsl:text>&#160;&#160;</xsl:text>
1172     </xsl:if>
1173     <xsl:apply-templates select="$start-modifiers" mode="cpp"/>
1174
1175     <!-- type -->
1176     <xsl:if test="local-name($notmod[1]) != 'methodname'">
1177       <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
1178     </xsl:if>
1179
1180     <xsl:apply-templates select="methodname" mode="cpp"/>
1181     <xsl:text>(</xsl:text>
1182     <xsl:apply-templates select="methodparam" mode="cpp"/>
1183     <xsl:text>)</xsl:text>
1184     <xsl:if test="exceptionname">
1185       <br/>
1186       <xsl:text>&#160;&#160;&#160;&#160;throws&#160;</xsl:text>
1187       <xsl:apply-templates select="exceptionname" mode="cpp"/>
1188     </xsl:if>
1189     <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
1190       <xsl:text> </xsl:text>
1191       <xsl:apply-templates select="$end-modifiers" mode="cpp"/>
1192     </xsl:if>
1193     <xsl:text>;</xsl:text>
1194   </code>
1195   <xsl:call-template name="synop-break"/>
1196 </xsl:template>
1197
1198 <!-- ===== IDL ========================================================= -->
1199
1200 <xsl:template match="classsynopsis" mode="idl">
1201   <pre>
1202     <xsl:apply-templates select="." mode="common.html.attributes"/>
1203     <xsl:call-template name="id.attribute"/>
1204     <xsl:text>interface </xsl:text>
1205     <xsl:apply-templates select="ooclass[1]" mode="idl"/>
1206     <xsl:if test="ooclass[preceding-sibling::*]">
1207       <xsl:text>: </xsl:text>
1208       <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="idl"/>
1209       <xsl:if test="oointerface|ooexception">
1210         <br/>
1211         <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
1212       </xsl:if>
1213     </xsl:if>
1214     <xsl:if test="oointerface">
1215       <xsl:text> implements</xsl:text>
1216       <xsl:apply-templates select="oointerface" mode="idl"/>
1217       <xsl:if test="ooexception">
1218         <br/>
1219         <xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
1220       </xsl:if>
1221     </xsl:if>
1222     <xsl:if test="ooexception">
1223       <xsl:text> throws</xsl:text>
1224       <xsl:apply-templates select="ooexception" mode="idl"/>
1225     </xsl:if>
1226     <xsl:text>&#160;{</xsl:text>
1227     <br/>
1228     <xsl:apply-templates select="constructorsynopsis                                  |destructorsynopsis                                  |fieldsynopsis                                  |methodsynopsis                                  |classsynopsisinfo" mode="idl"/>
1229     <xsl:text>}</xsl:text>
1230   </pre>
1231 </xsl:template>
1232
1233 <xsl:template match="classsynopsisinfo" mode="idl">
1234   <xsl:apply-templates mode="idl"/>
1235 </xsl:template>
1236
1237 <xsl:template match="ooclass|oointerface|ooexception" mode="idl">
1238   <xsl:if test="preceding-sibling::*">
1239     <xsl:text>, </xsl:text>
1240   </xsl:if>
1241   <span>
1242     <xsl:apply-templates select="." mode="common.html.attributes"/>
1243     <xsl:call-template name="id.attribute"/>
1244     <xsl:apply-templates mode="idl"/>
1245   </span>
1246 </xsl:template>
1247
1248 <xsl:template match="modifier|package" mode="idl">
1249   <span>
1250     <xsl:apply-templates select="." mode="common.html.attributes"/>
1251     <xsl:call-template name="id.attribute"/>
1252     <xsl:apply-templates mode="idl"/>
1253     <xsl:if test="following-sibling::*">
1254       <xsl:text>&#160;</xsl:text>
1255     </xsl:if>
1256   </span>
1257 </xsl:template>
1258
1259 <xsl:template match="classname" mode="idl">
1260   <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
1261     <xsl:text>, </xsl:text>
1262   </xsl:if>
1263   <span>
1264     <xsl:apply-templates select="." mode="common.html.attributes"/>
1265     <xsl:call-template name="id.attribute"/>
1266     <xsl:apply-templates mode="idl"/>
1267   </span>
1268 </xsl:template>
1269
1270 <xsl:template match="interfacename" mode="idl">
1271   <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
1272     <xsl:text>, </xsl:text>
1273   </xsl:if>
1274   <span>
1275     <xsl:apply-templates select="." mode="common.html.attributes"/>
1276     <xsl:call-template name="id.attribute"/>
1277     <xsl:apply-templates mode="idl"/>
1278   </span>
1279 </xsl:template>
1280
1281 <xsl:template match="exceptionname" mode="idl">
1282   <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
1283     <xsl:text>, </xsl:text>
1284   </xsl:if>
1285   <span>
1286     <xsl:apply-templates select="." mode="common.html.attributes"/>
1287     <xsl:call-template name="id.attribute"/>
1288     <xsl:apply-templates mode="idl"/>
1289   </span>
1290 </xsl:template>
1291
1292 <xsl:template match="fieldsynopsis" mode="idl">
1293   <code>
1294     <xsl:apply-templates select="." mode="common.html.attributes"/>
1295     <xsl:call-template name="id.attribute"/>
1296     <xsl:if test="parent::classsynopsis">
1297       <xsl:text>&#160;&#160;</xsl:text>
1298     </xsl:if>
1299     <xsl:apply-templates mode="idl"/>
1300     <xsl:text>;</xsl:text>
1301   </code>
1302   <xsl:call-template name="synop-break"/>
1303 </xsl:template>
1304
1305 <xsl:template match="type" mode="idl">
1306   <span>
1307     <xsl:apply-templates select="." mode="common.html.attributes"/>
1308     <xsl:call-template name="id.attribute"/>
1309     <xsl:apply-templates mode="idl"/>
1310     <xsl:text>&#160;</xsl:text>
1311   </span>
1312 </xsl:template>
1313
1314 <xsl:template match="varname" mode="idl">
1315   <span>
1316     <xsl:apply-templates select="." mode="common.html.attributes"/>
1317     <xsl:call-template name="id.attribute"/>
1318     <xsl:apply-templates mode="idl"/>
1319     <xsl:text>&#160;</xsl:text>
1320   </span>
1321 </xsl:template>
1322
1323 <xsl:template match="initializer" mode="idl">
1324   <span>
1325     <xsl:apply-templates select="." mode="common.html.attributes"/>
1326     <xsl:call-template name="id.attribute"/>
1327     <xsl:text>=&#160;</xsl:text>
1328     <xsl:apply-templates mode="idl"/>
1329   </span>
1330 </xsl:template>
1331
1332 <xsl:template match="void" mode="idl">
1333   <span>
1334     <xsl:apply-templates select="." mode="common.html.attributes"/>
1335     <xsl:call-template name="id.attribute"/>
1336     <xsl:text>void&#160;</xsl:text>
1337   </span>
1338 </xsl:template>
1339
1340 <xsl:template match="methodname" mode="idl">
1341   <span>
1342     <xsl:apply-templates select="." mode="common.html.attributes"/>
1343     <xsl:call-template name="id.attribute"/>
1344     <xsl:apply-templates mode="idl"/>
1345   </span>
1346 </xsl:template>
1347
1348 <xsl:template match="methodparam" mode="idl">
1349   <xsl:if test="preceding-sibling::methodparam">
1350     <xsl:text>, </xsl:text>
1351   </xsl:if>
1352   <span>
1353     <xsl:apply-templates select="." mode="common.html.attributes"/>
1354     <xsl:call-template name="id.attribute"/>
1355     <xsl:apply-templates mode="idl"/>
1356   </span>
1357 </xsl:template>
1358
1359 <xsl:template match="parameter" mode="idl">
1360   <span>
1361     <xsl:apply-templates select="." mode="common.html.attributes"/>
1362     <xsl:call-template name="id.attribute"/>
1363     <xsl:apply-templates mode="idl"/>
1364   </span>
1365 </xsl:template>
1366
1367 <xsl:template mode="idl" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1368   <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1369   <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
1370   <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1371   <code>
1372     <xsl:apply-templates select="." mode="common.html.attributes"/>
1373     <xsl:call-template name="id.attribute"/>
1374     <xsl:if test="parent::classsynopsis">
1375       <xsl:text>&#160;&#160;</xsl:text>
1376     </xsl:if>
1377     <xsl:apply-templates select="$start-modifiers" mode="idl"/>
1378
1379     <!-- type -->
1380     <xsl:if test="local-name($notmod[1]) != 'methodname'">
1381       <xsl:apply-templates select="$notmod[1]" mode="idl"/>
1382     </xsl:if>
1383
1384     <xsl:apply-templates select="methodname" mode="idl"/>
1385     <xsl:text>(</xsl:text>
1386     <xsl:apply-templates select="methodparam" mode="idl"/>
1387     <xsl:text>)</xsl:text>
1388     <xsl:if test="exceptionname">
1389       <br/>
1390       <xsl:text>&#160;&#160;&#160;&#160;raises(</xsl:text>
1391       <xsl:apply-templates select="exceptionname" mode="idl"/>
1392       <xsl:text>)</xsl:text>
1393     </xsl:if>
1394     <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]">
1395       <xsl:text> </xsl:text>
1396       <xsl:apply-templates select="$end-modifiers" mode="idl"/>
1397     </xsl:if>
1398     <xsl:text>;</xsl:text>
1399   </code>
1400   <xsl:call-template name="synop-break"/>
1401 </xsl:template>
1402
1403 <!-- ===== Perl ======================================================== -->
1404
1405 <xsl:template match="classsynopsis" mode="perl">
1406   <pre>
1407     <xsl:apply-templates select="." mode="common.html.attributes"/>
1408     <xsl:call-template name="id.attribute"/>
1409     <xsl:text>package </xsl:text>
1410     <xsl:apply-templates select="ooclass[1]" mode="perl"/>
1411     <xsl:text>;</xsl:text>
1412     <br/>
1413
1414     <xsl:if test="ooclass[preceding-sibling::*]">
1415       <xsl:text>@ISA = (</xsl:text>
1416       <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="perl"/>
1417       <xsl:text>);</xsl:text>
1418       <br/>
1419     </xsl:if>
1420
1421     <xsl:apply-templates select="constructorsynopsis                                  |destructorsynopsis                                  |fieldsynopsis                                  |methodsynopsis                                  |classsynopsisinfo" mode="perl"/>
1422   </pre>
1423 </xsl:template>
1424
1425 <xsl:template match="classsynopsisinfo" mode="perl">
1426   <xsl:apply-templates mode="perl"/>
1427 </xsl:template>
1428
1429 <xsl:template match="ooclass|oointerface|ooexception" mode="perl">
1430   <xsl:if test="preceding-sibling::*">
1431     <xsl:text>, </xsl:text>
1432   </xsl:if>
1433   <span>
1434     <xsl:apply-templates select="." mode="common.html.attributes"/>
1435     <xsl:call-template name="id.attribute"/>
1436     <xsl:apply-templates mode="perl"/>
1437   </span>
1438 </xsl:template>
1439
1440 <xsl:template match="modifier|package" mode="perl">
1441   <span>
1442     <xsl:apply-templates select="." mode="common.html.attributes"/>
1443     <xsl:call-template name="id.attribute"/>
1444     <xsl:apply-templates mode="perl"/>
1445     <xsl:if test="following-sibling::*">
1446       <xsl:text>&#160;</xsl:text>
1447     </xsl:if>
1448   </span>
1449 </xsl:template>
1450
1451 <xsl:template match="classname" mode="perl">
1452   <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'">
1453     <xsl:text>, </xsl:text>
1454   </xsl:if>
1455   <span>
1456     <xsl:apply-templates select="." mode="common.html.attributes"/>
1457     <xsl:call-template name="id.attribute"/>
1458     <xsl:apply-templates mode="perl"/>
1459   </span>
1460 </xsl:template>
1461
1462 <xsl:template match="interfacename" mode="perl">
1463   <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'">
1464     <xsl:text>, </xsl:text>
1465   </xsl:if>
1466   <span>
1467     <xsl:apply-templates select="." mode="common.html.attributes"/>
1468     <xsl:call-template name="id.attribute"/>
1469     <xsl:apply-templates mode="perl"/>
1470   </span>
1471 </xsl:template>
1472
1473 <xsl:template match="exceptionname" mode="perl">
1474   <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'">
1475     <xsl:text>, </xsl:text>
1476   </xsl:if>
1477   <span>
1478     <xsl:apply-templates select="." mode="common.html.attributes"/>
1479     <xsl:call-template name="id.attribute"/>
1480     <xsl:apply-templates mode="perl"/>
1481   </span>
1482 </xsl:template>
1483
1484 <xsl:template match="fieldsynopsis" mode="perl">
1485   <code>
1486     <xsl:apply-templates select="." mode="common.html.attributes"/>
1487     <xsl:call-template name="id.attribute"/>
1488     <xsl:if test="parent::classsynopsis">
1489       <xsl:text>&#160;&#160;</xsl:text>
1490     </xsl:if>
1491     <xsl:apply-templates mode="perl"/>
1492     <xsl:text>;</xsl:text>
1493   </code>
1494   <xsl:call-template name="synop-break"/>
1495 </xsl:template>
1496
1497 <xsl:template match="type" mode="perl">
1498   <span>
1499     <xsl:apply-templates select="." mode="common.html.attributes"/>
1500     <xsl:call-template name="id.attribute"/>
1501     <xsl:apply-templates mode="perl"/>
1502     <xsl:text>&#160;</xsl:text>
1503   </span>
1504 </xsl:template>
1505
1506 <xsl:template match="varname" mode="perl">
1507   <span>
1508     <xsl:apply-templates select="." mode="common.html.attributes"/>
1509     <xsl:call-template name="id.attribute"/>
1510     <xsl:apply-templates mode="perl"/>
1511     <xsl:text>&#160;</xsl:text>
1512   </span>
1513 </xsl:template>
1514
1515 <xsl:template match="initializer" mode="perl">
1516   <span>
1517     <xsl:apply-templates select="." mode="common.html.attributes"/>
1518     <xsl:call-template name="id.attribute"/>
1519     <xsl:text>=&#160;</xsl:text>
1520     <xsl:apply-templates mode="perl"/>
1521   </span>
1522 </xsl:template>
1523
1524 <xsl:template match="void" mode="perl">
1525   <span>
1526     <xsl:apply-templates select="." mode="common.html.attributes"/>
1527     <xsl:call-template name="id.attribute"/>
1528     <xsl:text>void&#160;</xsl:text>
1529   </span>
1530 </xsl:template>
1531
1532 <xsl:template match="methodname" mode="perl">
1533   <span>
1534     <xsl:apply-templates select="." mode="common.html.attributes"/>
1535     <xsl:call-template name="id.attribute"/>
1536     <xsl:apply-templates mode="perl"/>
1537   </span>
1538 </xsl:template>
1539
1540 <xsl:template match="methodparam" mode="perl">
1541   <xsl:if test="preceding-sibling::methodparam">
1542     <xsl:text>, </xsl:text>
1543   </xsl:if>
1544   <span>
1545     <xsl:apply-templates select="." mode="common.html.attributes"/>
1546     <xsl:call-template name="id.attribute"/>
1547     <xsl:apply-templates mode="perl"/>
1548   </span>
1549 </xsl:template>
1550
1551 <xsl:template match="parameter" mode="perl">
1552   <span>
1553     <xsl:apply-templates select="." mode="common.html.attributes"/>
1554     <xsl:call-template name="id.attribute"/>
1555     <xsl:apply-templates mode="perl"/>
1556   </span>
1557 </xsl:template>
1558
1559 <xsl:template mode="perl" match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1560   <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[local-name(.) != 'modifier']]"/>
1561   <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/>
1562   <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"/>
1563
1564   <code>
1565     <xsl:apply-templates select="." mode="common.html.attributes"/>
1566     <xsl:call-template name="id.attribute"/>
1567     <xsl:text>sub </xsl:text>
1568
1569     <xsl:apply-templates select="methodname" mode="perl"/>
1570     <xsl:text> { ... };</xsl:text>
1571   </code>
1572   <xsl:call-template name="synop-break"/>
1573 </xsl:template>
1574
1575 <!-- Used when not occurring as a child of classsynopsis -->
1576 <xsl:template match="ooclass|oointerface|ooexception">
1577   <xsl:apply-templates/>
1578 </xsl:template>
1579
1580 <!-- ==================================================================== -->
1581
1582 <!-- * DocBook 5 allows linking elements (link, olink, and xref) -->
1583 <!-- * within the OO *synopsis elements (classsynopsis, fieldsynopsis, -->
1584 <!-- * methodsynopsis, constructorsynopsis, destructorsynopsis) and -->
1585 <!-- * their children. So we need to have mode="java|cpp|idl|perl" -->
1586 <!-- * per-mode matches for those linking elements in order for them -->
1587 <!-- * to be processed as expected. -->
1588
1589 <xsl:template match="link|olink|xref" mode="java">
1590   <xsl:apply-templates select="."/>
1591 </xsl:template>
1592
1593 <xsl:template match="link|olink|xref" mode="cpp">
1594   <xsl:apply-templates select="."/>
1595 </xsl:template>
1596
1597 <xsl:template match="link|olink|xref" mode="idl">
1598   <xsl:apply-templates select="."/>
1599 </xsl:template>
1600
1601 <xsl:template match="link|olink|xref" mode="perl">
1602   <xsl:apply-templates select="."/>
1603 </xsl:template>
1604
1605 <xsl:template match="link|olink|xref" mode="ansi-nontabular">
1606   <xsl:apply-templates select="."/>
1607 </xsl:template>
1608
1609 <xsl:template match="link|olink|xref" mode="ansi-tabular">
1610   <xsl:apply-templates select="."/>
1611 </xsl:template>
1612
1613 <xsl:template match="link|olink|xref" mode="kr-nontabular">
1614   <xsl:apply-templates select="."/>
1615 </xsl:template>
1616
1617 <xsl:template match="link|olink|xref" mode="kr-tabular">
1618   <xsl:apply-templates select="."/>
1619 </xsl:template>
1620
1621 </xsl:stylesheet>