1<?xml version='1.0'?>
2<!DOCTYPE xsl:stylesheet [
3<!ENTITY RE "&#10;">
4<!ENTITY nbsp "&#160;">
5]>
6<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7                version='1.0'>
8
9<!-- ********************************************************************
10     $Id$
11     ********************************************************************
12
13     This file is part of the XSL DocBook Stylesheet distribution.
14     See /README or http://nwalsh.com/docbook/xsl/ for copyright
15     and other information.
16
17     ******************************************************************** -->
18
19<!-- ==================================================================== -->
20
21<!-- synopsis is in verbatim -->
22
23<!-- ==================================================================== -->
24
25<xsl:template match="cmdsynopsis">
26  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
27
28  <div class="{name(.)}" id="{$id}">
29    <a name="{$id}"/>
30    <xsl:apply-templates/>
31  </div>
32</xsl:template>
33
34<xsl:template match="cmdsynopsis/command">
35  <br/>
36  <xsl:call-template name="inline.monoseq"/>
37  <xsl:text> </xsl:text>
38</xsl:template>
39
40<xsl:template match="cmdsynopsis/command[1]" priority="2">
41  <xsl:call-template name="inline.monoseq"/>
42  <xsl:text> </xsl:text>
43</xsl:template>
44
45<xsl:template match="group|arg">
46  <xsl:variable name="choice" select="@choice"/>
47  <xsl:variable name="rep" select="@rep"/>
48  <xsl:variable name="sepchar">
49    <xsl:choose>
50      <xsl:when test="ancestor-or-self::*/@sepchar">
51        <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
52      </xsl:when>
53      <xsl:otherwise>
54        <xsl:text> </xsl:text>
55      </xsl:otherwise>
56    </xsl:choose>
57  </xsl:variable>
58  <xsl:if test="position()>1"><xsl:value-of select="$sepchar"/></xsl:if>
59  <xsl:choose>
60    <xsl:when test="$choice='plain'">
61      <xsl:value-of select="$arg.choice.plain.open.str"/>
62    </xsl:when>
63    <xsl:when test="$choice='req'">
64      <xsl:value-of select="$arg.choice.req.open.str"/>
65    </xsl:when>
66    <xsl:when test="$choice='opt'">
67      <xsl:value-of select="$arg.choice.opt.open.str"/>
68    </xsl:when>
69    <xsl:otherwise>
70      <xsl:value-of select="$arg.choice.def.open.str"/>
71    </xsl:otherwise>
72  </xsl:choose>
73  <xsl:apply-templates/>
74  <xsl:choose>
75    <xsl:when test="$rep='repeat'">
76      <xsl:value-of select="$arg.rep.repeat.str"/>
77    </xsl:when>
78    <xsl:when test="$rep='norepeat'">
79      <xsl:value-of select="$arg.rep.norepeat.str"/>
80    </xsl:when>
81    <xsl:otherwise>
82      <xsl:value-of select="$arg.rep.def.str"/>
83    </xsl:otherwise>
84  </xsl:choose>
85  <xsl:choose>
86    <xsl:when test="$choice='plain'">
87      <xsl:value-of select="$arg.choice.plain.close.str"/>
88    </xsl:when>
89    <xsl:when test="$choice='req'">
90      <xsl:value-of select="$arg.choice.req.close.str"/>
91    </xsl:when>
92    <xsl:when test="$choice='opt'">
93      <xsl:value-of select="$arg.choice.opt.close.str"/>
94    </xsl:when>
95    <xsl:otherwise>
96      <xsl:value-of select="$arg.choice.def.close.str"/>
97    </xsl:otherwise>
98  </xsl:choose>
99</xsl:template>
100
101<xsl:template match="group/arg">
102  <xsl:variable name="choice" select="@choice"/>
103  <xsl:variable name="rep" select="@rep"/>
104  <xsl:if test="position()>1"><xsl:value-of select="$arg.or.sep"/></xsl:if>
105  <xsl:apply-templates/>
106</xsl:template>
107
108<xsl:template match="sbr">
109  <br/>
110</xsl:template>
111
112<!-- ==================================================================== -->
113
114<xsl:template match="synopfragmentref">
115  <xsl:variable name="target" select="id(@linkend)"/>
116  <xsl:variable name="snum">
117    <xsl:apply-templates select="$target" mode="synopfragment.number"/>
118  </xsl:variable>
119  <i>
120    <a href="#{@linkend}">
121      <xsl:text>(</xsl:text>
122      <xsl:value-of select="$snum"/>
123      <xsl:text>)</xsl:text>
124    </a>
125  </i>
126</xsl:template>
127
128<xsl:template match="synopfragment" mode="synopfragment.number">
129  <xsl:number format="1"/>
130</xsl:template>
131
132<xsl:template match="synopfragment">
133  <xsl:variable name="snum">
134    <xsl:apply-templates select="." mode="synopfragment.number"/>
135  </xsl:variable>
136  <p>
137    <a name="#{@id}">
138      <xsl:text>(</xsl:text>
139      <xsl:value-of select="$snum"/>
140      <xsl:text>)</xsl:text>
141    </a>
142    <xsl:text> </xsl:text>
143    <xsl:apply-templates/>
144  </p>
145</xsl:template>   
146
147<xsl:template match="funcsynopsis">
148  <xsl:call-template name="informal.object"/>
149</xsl:template>
150
151<xsl:template match="funcsynopsisinfo">
152  <pre class="{name(.)}"><xsl:apply-templates/></pre>
153</xsl:template>
154
155<xsl:template match="funcprototype">
156  <p>
157    <code>
158      <xsl:apply-templates/>
159      <xsl:if test="$funcsynopsis.style='kr'">
160        <xsl:apply-templates select="/paramdef" mode="kr-funcsynopsis-mode"/>
161      </xsl:if>
162    </code>
163  </p>
164</xsl:template>
165
166<xsl:template match="funcdef">
167  <code class="{name(.)}">
168    <xsl:apply-templates/>
169  </code>
170</xsl:template>
171
172<xsl:template match="funcdef/function">
173  <xsl:choose>
174    <xsl:when test="$funcsynopsis.decoration != 0">
175      <b class="fsfunc"><xsl:apply-templates/></b>
176    </xsl:when>
177    <xsl:otherwise>
178      <xsl:apply-templates/>
179    </xsl:otherwise>
180  </xsl:choose>
181</xsl:template>
182
183<xsl:template match="void">
184  <xsl:choose>
185    <xsl:when test="$funcsynopsis.style='ansi'">
186      <xsl:text>(void);</xsl:text>
187    </xsl:when>
188    <xsl:otherwise>
189      <xsl:text>();</xsl:text>
190    </xsl:otherwise>
191  </xsl:choose>
192</xsl:template>
193
194<xsl:template match="varargs">
195  <xsl:text>(...);</xsl:text>
196</xsl:template>
197
198<xsl:template match="paramdef">
199  <xsl:variable name="paramnum">
200    <xsl:number count="paramdef" format="1"/>
201  </xsl:variable>
202  <xsl:if test="$paramnum=1">(</xsl:if>
203  <xsl:choose>
204    <xsl:when test="$funcsynopsis.style='ansi'">
205      <xsl:apply-templates/>
206    </xsl:when>
207    <xsl:otherwise>
208      <xsl:apply-templates select="/parameter"/>
209    </xsl:otherwise>
210  </xsl:choose>
211  <xsl:choose>
212    <xsl:when test="following-sibling::paramdef">
213      <xsl:text>, </xsl:text>
214    </xsl:when>
215    <xsl:otherwise>
216      <xsl:text>);</xsl:text>
217    </xsl:otherwise>
218  </xsl:choose>
219</xsl:template>
220
221<xsl:template match="paramdef/parameter">
222  <xsl:choose>
223    <xsl:when test="$funcsynopsis.decoration != 0">
224      <var class="pdparam">
225        <xsl:apply-templates/>
226      </var>
227    </xsl:when>
228    <xsl:otherwise>
229      <xsl:apply-templates/>
230    </xsl:otherwise>
231  </xsl:choose>
232  <xsl:if test="following-sibling::parameter">
233    <xsl:text>, </xsl:text>
234  </xsl:if>
235</xsl:template>
236
237<xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
238  <br/>
239  <xsl:apply-templates/>
240  <xsl:text>;</xsl:text>
241</xsl:template>
242
243<xsl:template match="funcparams">
244  <xsl:text>(</xsl:text>
245  <xsl:apply-templates/>
246  <xsl:text>)</xsl:text>
247</xsl:template>
248
249<!-- ==================================================================== -->
250
251<xsl:variable name="default-classsynopsis-language">java</xsl:variable>
252
253<xsl:template match="classsynopsis">
254  <xsl:param name="language">
255    <xsl:choose>
256      <xsl:when test="@language">
257	<xsl:value-of select="@language"/>
258      </xsl:when>
259      <xsl:otherwise>
260	<xsl:value-of select="$default-classsynopsis-language"/>
261      </xsl:otherwise>
262    </xsl:choose>
263  </xsl:param>
264
265  <xsl:choose>
266    <xsl:when test="$language='java'">
267      <xsl:apply-templates select="." mode="java"/>
268    </xsl:when>
269    <xsl:when test="$language='perl'">
270      <xsl:apply-templates select="." mode="perl"/>
271    </xsl:when>
272    <xsl:when test="$language='idl'">
273      <xsl:apply-templates select="." mode="idl"/>
274    </xsl:when>
275    <xsl:when test="$language='cpp'">
276      <xsl:apply-templates select="." mode="cpp"/>
277    </xsl:when>
278    <xsl:otherwise>
279      <xsl:message>
280	<xsl:text>Unrecognized language on classsynopsis: </xsl:text>
281	<xsl:value-of select="$language"/>
282      </xsl:message>
283      <xsl:apply-templates select=".">
284	<xsl:with-param name="language"
285	  select="$default-classsynopsis-language"/>
286      </xsl:apply-templates>
287    </xsl:otherwise>
288  </xsl:choose>
289</xsl:template>
290
291<!-- ===== Java ======================================================== -->
292
293<xsl:template match="classsynopsis" mode="java">
294  <pre class="{name(.)}">
295    <xsl:apply-templates select="ooclass[1]" mode="java"/>
296    <xsl:if test="ooclass[position() &gt; 1]">
297      <xsl:text> extends</xsl:text>
298      <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="java"/>
299      <xsl:if test="oointerface|ooexception">
300	<xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
301      </xsl:if>
302    </xsl:if>
303    <xsl:if test="oointerface">
304      <xsl:text>implements</xsl:text>
305      <xsl:apply-templates select="oointerface" mode="java"/>
306      <xsl:if test="ooexception">
307	<xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
308      </xsl:if>
309    </xsl:if>
310    <xsl:if test="ooexception">
311      <xsl:text>throws</xsl:text>
312      <xsl:apply-templates select="ooexception" mode="java"/>
313    </xsl:if>
314    <xsl:text>&nbsp;{&RE;&RE;</xsl:text>
315    <xsl:apply-templates select="constructorsynopsis
316                                 |destructorsynopsis
317                                 |fieldsynopsis
318                                 |methodsynopsis
319                                 |classsynopsisinfo" mode="java"/>
320    <xsl:text>}</xsl:text>
321  </pre>
322</xsl:template>
323
324<xsl:template match="classsynopsisinfo" mode="java">
325  <xsl:apply-templates mode="java"/>
326</xsl:template>
327
328<xsl:template match="ooclass|oointerface|ooexception" mode="java">
329  <xsl:choose>
330    <xsl:when test="position() &gt; 1">
331      <xsl:text>, </xsl:text>
332    </xsl:when>
333    <xsl:otherwise>
334      <xsl:text> </xsl:text>
335    </xsl:otherwise>
336  </xsl:choose>
337  <span class="{name(.)}">
338    <xsl:apply-templates mode="java"/>
339  </span>
340</xsl:template>
341
342<xsl:template match="modifier" mode="java">
343  <span class="{name(.)}">
344    <xsl:apply-templates mode="java"/>
345    <xsl:text>&nbsp;</xsl:text>
346  </span>
347</xsl:template>
348
349<xsl:template match="classname" mode="java">
350  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
351    <xsl:text>, </xsl:text>
352  </xsl:if>
353  <span class="{name(.)}">
354    <xsl:apply-templates mode="java"/>
355  </span>
356</xsl:template>
357
358<xsl:template match="interfacename" mode="java">
359  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
360    <xsl:text>, </xsl:text>
361  </xsl:if>
362  <span class="{name(.)}">
363    <xsl:apply-templates mode="java"/>
364  </span>
365</xsl:template>
366
367<xsl:template match="exceptionname" mode="java">
368  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
369    <xsl:text>, </xsl:text>
370  </xsl:if>
371  <span class="{name(.)}">
372    <xsl:apply-templates mode="java"/>
373  </span>
374</xsl:template>
375
376<xsl:template match="fieldsynopsis" mode="java">
377  <div class="{name(.)}">
378    <xsl:text>&nbsp;&nbsp;</xsl:text>
379    <xsl:apply-templates mode="java"/>
380    <xsl:text>;</xsl:text>
381  </div>
382</xsl:template>
383
384<xsl:template match="type" mode="java">
385  <span class="{name(.)}">
386    <xsl:apply-templates mode="java"/>
387    <xsl:text>&nbsp;</xsl:text>
388  </span>
389</xsl:template>
390
391<xsl:template match="varname" mode="java">
392  <span class="{name(.)}">
393    <xsl:apply-templates mode="java"/>
394    <xsl:text>&nbsp;</xsl:text>
395  </span>
396</xsl:template>
397
398<xsl:template match="initializer" mode="java">
399  <span class="{name(.)}">
400    <xsl:text>=&nbsp;</xsl:text>
401    <xsl:apply-templates mode="java"/>
402  </span>
403</xsl:template>
404
405<xsl:template match="void" mode="java">
406  <span class="{name(.)}">
407    <xsl:text>void&nbsp;</xsl:text>
408  </span>
409</xsl:template>
410
411<xsl:template match="methodname" mode="java">
412  <span class="{name(.)}">
413    <xsl:apply-templates mode="java"/>
414  </span>
415</xsl:template>
416
417<xsl:template match="methodparam" mode="java">
418  <xsl:param name="indent">0</xsl:param>
419  <xsl:if test="position() &gt; 1">
420    <xsl:text>,&RE;</xsl:text>
421    <xsl:if test="$indent &gt; 0">
422      <xsl:call-template name="copy-string">
423	<xsl:with-param name="string">&nbsp;</xsl:with-param>
424	<xsl:with-param name="count" select="$indent + 1"/>
425      </xsl:call-template>
426    </xsl:if>
427  </xsl:if>
428  <span class="{name(.)}">
429    <xsl:apply-templates mode="java"/>
430  </span>
431</xsl:template>
432
433<xsl:template match="parameter" mode="java">
434  <span class="{name(.)}">
435    <xsl:apply-templates mode="java"/>
436  </span>
437</xsl:template>
438
439<xsl:template mode="java"
440  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
441  <xsl:variable name="modifiers" select="modifier"/>
442  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
443  <xsl:variable name="decl">
444    <xsl:text>  </xsl:text>
445    <xsl:apply-templates select="$modifiers" mode="java"/>
446
447    <!-- type -->
448    <xsl:if test="name($notmod[1]) != 'methodname'">
449      <xsl:apply-templates select="$notmod[1]" mode="java"/>
450    </xsl:if>
451
452    <xsl:apply-templates select="methodname" mode="java"/>
453  </xsl:variable>
454
455  <div class="{name(.)}">
456    <xsl:copy-of select="$decl"/>
457    <xsl:text>(</xsl:text>
458    <xsl:apply-templates select="methodparam" mode="java">
459      <xsl:with-param name="indent" select="string-length($decl)"/>
460    </xsl:apply-templates>
461    <xsl:text>)</xsl:text>
462    <xsl:if test="exceptionname">
463      <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;</xsl:text>
464      <xsl:apply-templates select="exceptionname" mode="java"/>
465    </xsl:if>
466    <xsl:text>;</xsl:text>
467  </div>
468</xsl:template>
469
470<!-- ===== C++ ========================================================= -->
471
472<xsl:template match="classsynopsis" mode="cpp">
473  <pre class="{name(.)}">
474    <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
475    <xsl:if test="ooclass[position() &gt; 1]">
476      <xsl:text>: </xsl:text>
477      <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="cpp"/>
478      <xsl:if test="oointerface|ooexception">
479	<xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
480      </xsl:if>
481    </xsl:if>
482    <xsl:if test="oointerface">
483      <xsl:text> implements</xsl:text>
484      <xsl:apply-templates select="oointerface" mode="cpp"/>
485      <xsl:if test="ooexception">
486	<xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
487      </xsl:if>
488    </xsl:if>
489    <xsl:if test="ooexception">
490      <xsl:text> throws</xsl:text>
491      <xsl:apply-templates select="ooexception" mode="cpp"/>
492    </xsl:if>
493    <xsl:text>&nbsp;{&RE;&RE;</xsl:text>
494    <xsl:apply-templates select="constructorsynopsis
495                                 |destructorsynopsis
496                                 |fieldsynopsis
497                                 |methodsynopsis
498                                 |classsynopsisinfo" mode="cpp"/>
499    <xsl:text>}</xsl:text>
500  </pre>
501</xsl:template>
502
503<xsl:template match="classsynopsisinfo" mode="cpp">
504  <xsl:apply-templates mode="cpp"/>
505</xsl:template>
506
507<xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
508  <xsl:if test="position() &gt; 1">
509    <xsl:text>, </xsl:text>
510  </xsl:if>
511  <span class="{name(.)}">
512    <xsl:apply-templates mode="cpp"/>
513  </span>
514</xsl:template>
515
516<xsl:template match="modifier" mode="cpp">
517  <span class="{name(.)}">
518    <xsl:apply-templates mode="cpp"/>
519    <xsl:text>&nbsp;</xsl:text>
520  </span>
521</xsl:template>
522
523<xsl:template match="classname" mode="cpp">
524  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
525    <xsl:text>, </xsl:text>
526  </xsl:if>
527  <span class="{name(.)}">
528    <xsl:apply-templates mode="cpp"/>
529  </span>
530</xsl:template>
531
532<xsl:template match="interfacename" mode="cpp">
533  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
534    <xsl:text>, </xsl:text>
535  </xsl:if>
536  <span class="{name(.)}">
537    <xsl:apply-templates mode="cpp"/>
538  </span>
539</xsl:template>
540
541<xsl:template match="exceptionname" mode="cpp">
542  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
543    <xsl:text>, </xsl:text>
544  </xsl:if>
545  <span class="{name(.)}">
546    <xsl:apply-templates mode="cpp"/>
547  </span>
548</xsl:template>
549
550<xsl:template match="fieldsynopsis" mode="cpp">
551  <div class="{name(.)}">
552    <xsl:text>&nbsp;&nbsp;</xsl:text>
553    <xsl:apply-templates mode="cpp"/>
554    <xsl:text>;</xsl:text>
555  </div>
556</xsl:template>
557
558<xsl:template match="type" mode="cpp">
559  <span class="{name(.)}">
560    <xsl:apply-templates mode="cpp"/>
561    <xsl:text>&nbsp;</xsl:text>
562  </span>
563</xsl:template>
564
565<xsl:template match="varname" mode="cpp">
566  <span class="{name(.)}">
567    <xsl:apply-templates mode="cpp"/>
568    <xsl:text>&nbsp;</xsl:text>
569  </span>
570</xsl:template>
571
572<xsl:template match="initializer" mode="cpp">
573  <span class="{name(.)}">
574    <xsl:text>=&nbsp;</xsl:text>
575    <xsl:apply-templates mode="cpp"/>
576  </span>
577</xsl:template>
578
579<xsl:template match="void" mode="cpp">
580  <span class="{name(.)}">
581    <xsl:text>void&nbsp;</xsl:text>
582  </span>
583</xsl:template>
584
585<xsl:template match="methodname" mode="cpp">
586  <span class="{name(.)}">
587    <xsl:apply-templates mode="cpp"/>
588  </span>
589</xsl:template>
590
591<xsl:template match="methodparam" mode="cpp">
592  <xsl:if test="position() &gt; 1">
593    <xsl:text>, </xsl:text>
594  </xsl:if>
595  <span class="{name(.)}">
596    <xsl:apply-templates mode="cpp"/>
597  </span>
598</xsl:template>
599
600<xsl:template match="parameter" mode="cpp">
601  <span class="{name(.)}">
602    <xsl:apply-templates mode="cpp"/>
603  </span>
604</xsl:template>
605
606<xsl:template mode="cpp"
607  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
608  <xsl:variable name="modifiers" select="modifier"/>
609  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
610  <xsl:variable name="type">
611  </xsl:variable>
612  <div class="{name(.)}">
613    <xsl:text>  </xsl:text>
614    <xsl:apply-templates select="$modifiers" mode="cpp"/>
615
616    <!-- type -->
617    <xsl:if test="name($notmod[1]) != 'methodname'">
618      <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
619    </xsl:if>
620
621    <xsl:apply-templates select="methodname" mode="cpp"/>
622    <xsl:text>(</xsl:text>
623    <xsl:apply-templates select="methodparam" mode="cpp"/>
624    <xsl:text>)</xsl:text>
625    <xsl:if test="exceptionname">
626      <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;</xsl:text>
627      <xsl:apply-templates select="exceptionname" mode="cpp"/>
628    </xsl:if>
629    <xsl:text>;</xsl:text>
630  </div>
631</xsl:template>
632
633<!-- ===== IDL ========================================================= -->
634
635<xsl:template match="classsynopsis" mode="idl">
636  <pre class="{name(.)}">
637    <xsl:text>interface </xsl:text>
638    <xsl:apply-templates select="ooclass[1]" mode="idl"/>
639    <xsl:if test="ooclass[position() &gt; 1]">
640      <xsl:text>: </xsl:text>
641      <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="idl"/>
642      <xsl:if test="oointerface|ooexception">
643	<xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
644      </xsl:if>
645    </xsl:if>
646    <xsl:if test="oointerface">
647      <xsl:text> implements</xsl:text>
648      <xsl:apply-templates select="oointerface" mode="idl"/>
649      <xsl:if test="ooexception">
650	<xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
651      </xsl:if>
652    </xsl:if>
653    <xsl:if test="ooexception">
654      <xsl:text> throws</xsl:text>
655      <xsl:apply-templates select="ooexception" mode="idl"/>
656    </xsl:if>
657    <xsl:text>&nbsp;{&RE;&RE;</xsl:text>
658    <xsl:apply-templates select="constructorsynopsis
659                                 |destructorsynopsis
660                                 |fieldsynopsis
661                                 |methodsynopsis
662                                 |classsynopsisinfo" mode="idl"/>
663    <xsl:text>}</xsl:text>
664  </pre>
665</xsl:template>
666
667<xsl:template match="classsynopsisinfo" mode="idl">
668  <xsl:apply-templates mode="idl"/>
669</xsl:template>
670
671<xsl:template match="ooclass|oointerface|ooexception" mode="idl">
672  <xsl:if test="position() &gt; 1">
673    <xsl:text>, </xsl:text>
674  </xsl:if>
675  <span class="{name(.)}">
676    <xsl:apply-templates mode="idl"/>
677  </span>
678</xsl:template>
679
680<xsl:template match="modifier" mode="idl">
681  <span class="{name(.)}">
682    <xsl:apply-templates mode="idl"/>
683    <xsl:text>&nbsp;</xsl:text>
684  </span>
685</xsl:template>
686
687<xsl:template match="classname" mode="idl">
688  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
689    <xsl:text>, </xsl:text>
690  </xsl:if>
691  <span class="{name(.)}">
692    <xsl:apply-templates mode="idl"/>
693  </span>
694</xsl:template>
695
696<xsl:template match="interfacename" mode="idl">
697  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
698    <xsl:text>, </xsl:text>
699  </xsl:if>
700  <span class="{name(.)}">
701    <xsl:apply-templates mode="idl"/>
702  </span>
703</xsl:template>
704
705<xsl:template match="exceptionname" mode="idl">
706  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
707    <xsl:text>, </xsl:text>
708  </xsl:if>
709  <span class="{name(.)}">
710    <xsl:apply-templates mode="idl"/>
711  </span>
712</xsl:template>
713
714<xsl:template match="fieldsynopsis" mode="idl">
715  <div class="{name(.)}">
716    <xsl:text>&nbsp;&nbsp;</xsl:text>
717    <xsl:apply-templates mode="idl"/>
718    <xsl:text>;</xsl:text>
719  </div>
720</xsl:template>
721
722<xsl:template match="type" mode="idl">
723  <span class="{name(.)}">
724    <xsl:apply-templates mode="idl"/>
725    <xsl:text>&nbsp;</xsl:text>
726  </span>
727</xsl:template>
728
729<xsl:template match="varname" mode="idl">
730  <span class="{name(.)}">
731    <xsl:apply-templates mode="idl"/>
732    <xsl:text>&nbsp;</xsl:text>
733  </span>
734</xsl:template>
735
736<xsl:template match="initializer" mode="idl">
737  <span class="{name(.)}">
738    <xsl:text>=&nbsp;</xsl:text>
739    <xsl:apply-templates mode="idl"/>
740  </span>
741</xsl:template>
742
743<xsl:template match="void" mode="idl">
744  <span class="{name(.)}">
745    <xsl:text>void&nbsp;</xsl:text>
746  </span>
747</xsl:template>
748
749<xsl:template match="methodname" mode="idl">
750  <span class="{name(.)}">
751    <xsl:apply-templates mode="idl"/>
752  </span>
753</xsl:template>
754
755<xsl:template match="methodparam" mode="idl">
756  <xsl:if test="position() &gt; 1">
757    <xsl:text>, </xsl:text>
758  </xsl:if>
759  <span class="{name(.)}">
760    <xsl:apply-templates mode="idl"/>
761  </span>
762</xsl:template>
763
764<xsl:template match="parameter" mode="idl">
765  <span class="{name(.)}">
766    <xsl:apply-templates mode="idl"/>
767  </span>
768</xsl:template>
769
770<xsl:template mode="idl"
771  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
772  <xsl:variable name="modifiers" select="modifier"/>
773  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
774  <xsl:variable name="type">
775  </xsl:variable>
776  <div class="{name(.)}">
777    <xsl:text>  </xsl:text>
778    <xsl:apply-templates select="$modifiers" mode="idl"/>
779
780    <!-- type -->
781    <xsl:if test="name($notmod[1]) != 'methodname'">
782      <xsl:apply-templates select="$notmod[1]" mode="idl"/>
783    </xsl:if>
784
785    <xsl:apply-templates select="methodname" mode="idl"/>
786    <xsl:text>(</xsl:text>
787    <xsl:apply-templates select="methodparam" mode="idl"/>
788    <xsl:text>)</xsl:text>
789    <xsl:if test="exceptionname">
790      <xsl:text>&RE;&nbsp;&nbsp;&nbsp;&nbsp;raises(</xsl:text>
791      <xsl:apply-templates select="exceptionname" mode="idl"/>
792      <xsl:text>)</xsl:text>
793    </xsl:if>
794    <xsl:text>;</xsl:text>
795  </div>
796</xsl:template>
797
798<!-- ===== Perl ======================================================== -->
799
800<xsl:template match="classsynopsis" mode="perl">
801  <pre class="{name(.)}">
802    <xsl:text>package </xsl:text>
803    <xsl:apply-templates select="ooclass[1]" mode="perl"/>
804    <xsl:text>;&RE;</xsl:text>
805
806    <xsl:if test="ooclass[position() &gt; 1]">
807      <xsl:text>@ISA = (</xsl:text>
808      <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="perl"/>
809      <xsl:text>);&RE;</xsl:text>
810    </xsl:if>
811
812    <xsl:apply-templates select="constructorsynopsis
813                                 |destructorsynopsis
814                                 |fieldsynopsis
815                                 |methodsynopsis
816                                 |classsynopsisinfo" mode="perl"/>
817  </pre>
818</xsl:template>
819
820<xsl:template match="classsynopsisinfo" mode="perl">
821  <xsl:apply-templates mode="perl"/>
822</xsl:template>
823
824<xsl:template match="ooclass|oointerface|ooexception" mode="perl">
825  <xsl:if test="position() &gt; 1">
826    <xsl:text>, </xsl:text>
827  </xsl:if>
828  <span class="{name(.)}">
829    <xsl:apply-templates mode="perl"/>
830  </span>
831</xsl:template>
832
833<xsl:template match="modifier" mode="perl">
834  <span class="{name(.)}">
835    <xsl:apply-templates mode="perl"/>
836    <xsl:text>&nbsp;</xsl:text>
837  </span>
838</xsl:template>
839
840<xsl:template match="classname" mode="perl">
841  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
842    <xsl:text>, </xsl:text>
843  </xsl:if>
844  <span class="{name(.)}">
845    <xsl:apply-templates mode="perl"/>
846  </span>
847</xsl:template>
848
849<xsl:template match="interfacename" mode="perl">
850  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
851    <xsl:text>, </xsl:text>
852  </xsl:if>
853  <span class="{name(.)}">
854    <xsl:apply-templates mode="perl"/>
855  </span>
856</xsl:template>
857
858<xsl:template match="exceptionname" mode="perl">
859  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
860    <xsl:text>, </xsl:text>
861  </xsl:if>
862  <span class="{name(.)}">
863    <xsl:apply-templates mode="perl"/>
864  </span>
865</xsl:template>
866
867<xsl:template match="fieldsynopsis" mode="perl">
868  <div class="{name(.)}">
869    <xsl:text>&nbsp;&nbsp;</xsl:text>
870    <xsl:apply-templates mode="perl"/>
871    <xsl:text>;</xsl:text>
872  </div>
873</xsl:template>
874
875<xsl:template match="type" mode="perl">
876  <span class="{name(.)}">
877    <xsl:apply-templates mode="perl"/>
878    <xsl:text>&nbsp;</xsl:text>
879  </span>
880</xsl:template>
881
882<xsl:template match="varname" mode="perl">
883  <span class="{name(.)}">
884    <xsl:apply-templates mode="perl"/>
885    <xsl:text>&nbsp;</xsl:text>
886  </span>
887</xsl:template>
888
889<xsl:template match="initializer" mode="perl">
890  <span class="{name(.)}">
891    <xsl:text>=&nbsp;</xsl:text>
892    <xsl:apply-templates mode="perl"/>
893  </span>
894</xsl:template>
895
896<xsl:template match="void" mode="perl">
897  <span class="{name(.)}">
898    <xsl:text>void&nbsp;</xsl:text>
899  </span>
900</xsl:template>
901
902<xsl:template match="methodname" mode="perl">
903  <span class="{name(.)}">
904    <xsl:apply-templates mode="perl"/>
905  </span>
906</xsl:template>
907
908<xsl:template match="methodparam" mode="perl">
909  <xsl:if test="position() &gt; 1">
910    <xsl:text>, </xsl:text>
911  </xsl:if>
912  <span class="{name(.)}">
913    <xsl:apply-templates mode="perl"/>
914  </span>
915</xsl:template>
916
917<xsl:template match="parameter" mode="perl">
918  <span class="{name(.)}">
919    <xsl:apply-templates mode="perl"/>
920  </span>
921</xsl:template>
922
923<xsl:template mode="perl"
924  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
925  <xsl:variable name="modifiers" select="modifier"/>
926  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
927  <xsl:variable name="type">
928  </xsl:variable>
929  <div class="{name(.)}">
930    <xsl:text>sub </xsl:text>
931
932    <xsl:apply-templates select="methodname" mode="perl"/>
933    <xsl:text> { ... };</xsl:text>
934  </div>
935</xsl:template>
936
937<!-- ==================================================================== -->
938
939</xsl:stylesheet>
940