1 | <?xml version='1.0'?>
|
---|
2 | <!DOCTYPE xsl:stylesheet [
|
---|
3 | <!ENTITY nbsp " ">
|
---|
4 | ]>
|
---|
5 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
6 | version='1.0'>
|
---|
7 |
|
---|
8 | <!-- ********************************************************************
|
---|
9 | $Id: synop.xsl,v 1.17 2005/05/10 12:02:04 xmldoc Exp $
|
---|
10 | ********************************************************************
|
---|
11 |
|
---|
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.
|
---|
15 |
|
---|
16 | ******************************************************************** -->
|
---|
17 |
|
---|
18 | <!-- ==================================================================== -->
|
---|
19 |
|
---|
20 | <!-- synopsis is in verbatim -->
|
---|
21 |
|
---|
22 | <!-- ==================================================================== -->
|
---|
23 |
|
---|
24 | <xsl:template match="cmdsynopsis">
|
---|
25 | <div class="{name(.)}">
|
---|
26 | <p>
|
---|
27 | <xsl:call-template name="anchor"/>
|
---|
28 | <xsl:apply-templates/>
|
---|
29 | </p>
|
---|
30 | </div>
|
---|
31 | </xsl:template>
|
---|
32 |
|
---|
33 | <xsl:template match="cmdsynopsis/command">
|
---|
34 | <br/>
|
---|
35 | <xsl:call-template name="inline.monoseq"/>
|
---|
36 | <xsl:text> </xsl:text>
|
---|
37 | </xsl:template>
|
---|
38 |
|
---|
39 | <xsl:template match="cmdsynopsis/command[1]" priority="2">
|
---|
40 | <xsl:call-template name="inline.monoseq"/>
|
---|
41 | <xsl:text> </xsl:text>
|
---|
42 | </xsl:template>
|
---|
43 |
|
---|
44 | <xsl:template match="group|arg" name="group-or-arg">
|
---|
45 | <xsl:variable name="choice" select="@choice"/>
|
---|
46 | <xsl:variable name="rep" select="@rep"/>
|
---|
47 | <xsl:variable name="sepchar">
|
---|
48 | <xsl:choose>
|
---|
49 | <xsl:when test="ancestor-or-self::*/@sepchar">
|
---|
50 | <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
|
---|
51 | </xsl:when>
|
---|
52 | <xsl:otherwise>
|
---|
53 | <xsl:text> </xsl:text>
|
---|
54 | </xsl:otherwise>
|
---|
55 | </xsl:choose>
|
---|
56 | </xsl:variable>
|
---|
57 | <xsl:if test="position()>1"><xsl:value-of select="$sepchar"/></xsl:if>
|
---|
58 | <xsl:choose>
|
---|
59 | <xsl:when test="$choice='plain'">
|
---|
60 | <xsl:value-of select="$arg.choice.plain.open.str"/>
|
---|
61 | </xsl:when>
|
---|
62 | <xsl:when test="$choice='req'">
|
---|
63 | <xsl:value-of select="$arg.choice.req.open.str"/>
|
---|
64 | </xsl:when>
|
---|
65 | <xsl:when test="$choice='opt'">
|
---|
66 | <xsl:value-of select="$arg.choice.opt.open.str"/>
|
---|
67 | </xsl:when>
|
---|
68 | <xsl:otherwise>
|
---|
69 | <xsl:value-of select="$arg.choice.def.open.str"/>
|
---|
70 | </xsl:otherwise>
|
---|
71 | </xsl:choose>
|
---|
72 | <xsl:apply-templates/>
|
---|
73 | <xsl:choose>
|
---|
74 | <xsl:when test="$rep='repeat'">
|
---|
75 | <xsl:value-of select="$arg.rep.repeat.str"/>
|
---|
76 | </xsl:when>
|
---|
77 | <xsl:when test="$rep='norepeat'">
|
---|
78 | <xsl:value-of select="$arg.rep.norepeat.str"/>
|
---|
79 | </xsl:when>
|
---|
80 | <xsl:otherwise>
|
---|
81 | <xsl:value-of select="$arg.rep.def.str"/>
|
---|
82 | </xsl:otherwise>
|
---|
83 | </xsl:choose>
|
---|
84 | <xsl:choose>
|
---|
85 | <xsl:when test="$choice='plain'">
|
---|
86 | <xsl:value-of select="$arg.choice.plain.close.str"/>
|
---|
87 | </xsl:when>
|
---|
88 | <xsl:when test="$choice='req'">
|
---|
89 | <xsl:value-of select="$arg.choice.req.close.str"/>
|
---|
90 | </xsl:when>
|
---|
91 | <xsl:when test="$choice='opt'">
|
---|
92 | <xsl:value-of select="$arg.choice.opt.close.str"/>
|
---|
93 | </xsl:when>
|
---|
94 | <xsl:otherwise>
|
---|
95 | <xsl:value-of select="$arg.choice.def.close.str"/>
|
---|
96 | </xsl:otherwise>
|
---|
97 | </xsl:choose>
|
---|
98 | </xsl:template>
|
---|
99 |
|
---|
100 | <xsl:template match="group/arg">
|
---|
101 | <xsl:variable name="choice" select="@choice"/>
|
---|
102 | <xsl:variable name="rep" select="@rep"/>
|
---|
103 | <xsl:if test="position()>1"><xsl:value-of select="$arg.or.sep"/></xsl:if>
|
---|
104 | <xsl:call-template name="group-or-arg"/>
|
---|
105 | </xsl:template>
|
---|
106 |
|
---|
107 | <xsl:template match="sbr">
|
---|
108 | <br/>
|
---|
109 | </xsl:template>
|
---|
110 |
|
---|
111 | <!-- ==================================================================== -->
|
---|
112 |
|
---|
113 | <xsl:template match="synopfragmentref">
|
---|
114 | <xsl:variable name="target" select="key('id',@linkend)"/>
|
---|
115 | <xsl:variable name="snum">
|
---|
116 | <xsl:apply-templates select="$target" mode="synopfragment.number"/>
|
---|
117 | </xsl:variable>
|
---|
118 | <i>
|
---|
119 | <a href="#{@linkend}">
|
---|
120 | <xsl:text>(</xsl:text>
|
---|
121 | <xsl:value-of select="$snum"/>
|
---|
122 | <xsl:text>)</xsl:text>
|
---|
123 | </a>
|
---|
124 | <xsl:text> </xsl:text>
|
---|
125 | <xsl:apply-templates/>
|
---|
126 | </i>
|
---|
127 | </xsl:template>
|
---|
128 |
|
---|
129 | <xsl:template match="synopfragment" mode="synopfragment.number">
|
---|
130 | <xsl:number format="1"/>
|
---|
131 | </xsl:template>
|
---|
132 |
|
---|
133 | <xsl:template match="synopfragment">
|
---|
134 | <xsl:variable name="snum">
|
---|
135 | <xsl:apply-templates select="." mode="synopfragment.number"/>
|
---|
136 | </xsl:variable>
|
---|
137 | <p>
|
---|
138 | <a name="{@id}">
|
---|
139 | <xsl:text>(</xsl:text>
|
---|
140 | <xsl:value-of select="$snum"/>
|
---|
141 | <xsl:text>)</xsl:text>
|
---|
142 | </a>
|
---|
143 | <xsl:text> </xsl:text>
|
---|
144 | <xsl:apply-templates/>
|
---|
145 | </p>
|
---|
146 | </xsl:template>
|
---|
147 |
|
---|
148 | <xsl:template match="funcsynopsis">
|
---|
149 | <xsl:call-template name="informal.object"/>
|
---|
150 | </xsl:template>
|
---|
151 |
|
---|
152 | <xsl:template match="funcsynopsisinfo">
|
---|
153 | <pre class="{name(.)}"><xsl:apply-templates/></pre>
|
---|
154 | </xsl:template>
|
---|
155 |
|
---|
156 | <!-- ====================================================================== -->
|
---|
157 | <!-- funcprototype -->
|
---|
158 | <!--
|
---|
159 |
|
---|
160 | funcprototype ::= (funcdef,
|
---|
161 | (void|varargs|paramdef+))
|
---|
162 |
|
---|
163 | funcdef ::= (#PCDATA|type|replaceable|function)*
|
---|
164 |
|
---|
165 | paramdef ::= (#PCDATA|type|replaceable|parameter|funcparams)*
|
---|
166 | -->
|
---|
167 |
|
---|
168 | <xsl:template match="funcprototype">
|
---|
169 | <xsl:variable name="html-style">
|
---|
170 | <xsl:call-template name="dbhtml-attribute">
|
---|
171 | <xsl:with-param name="pis"
|
---|
172 | select="ancestor::funcsynopsis//processing-instruction('dbhtml')"/>
|
---|
173 | <xsl:with-param name="attribute" select="'funcsynopsis-style'"/>
|
---|
174 | </xsl:call-template>
|
---|
175 | </xsl:variable>
|
---|
176 |
|
---|
177 | <xsl:variable name="style">
|
---|
178 | <xsl:choose>
|
---|
179 | <xsl:when test="$html-style != ''">
|
---|
180 | <xsl:value-of select="$html-style"/>
|
---|
181 | </xsl:when>
|
---|
182 | <xsl:otherwise>
|
---|
183 | <xsl:value-of select="$funcsynopsis.style"/>
|
---|
184 | </xsl:otherwise>
|
---|
185 | </xsl:choose>
|
---|
186 | </xsl:variable>
|
---|
187 |
|
---|
188 | <xsl:variable name="tabular-p"
|
---|
189 | select="$funcsynopsis.tabular.threshold > 0
|
---|
190 | and string-length(.) > $funcsynopsis.tabular.threshold"/>
|
---|
191 |
|
---|
192 | <xsl:choose>
|
---|
193 | <xsl:when test="$style = 'kr' and $tabular-p">
|
---|
194 | <xsl:apply-templates select="." mode="kr-tabular"/>
|
---|
195 | </xsl:when>
|
---|
196 | <xsl:when test="$style = 'kr'">
|
---|
197 | <xsl:apply-templates select="." mode="kr-nontabular"/>
|
---|
198 | </xsl:when>
|
---|
199 | <xsl:when test="$style = 'ansi' and $tabular-p">
|
---|
200 | <xsl:apply-templates select="." mode="ansi-tabular"/>
|
---|
201 | </xsl:when>
|
---|
202 | <xsl:otherwise>
|
---|
203 | <xsl:apply-templates select="." mode="ansi-nontabular"/>
|
---|
204 | </xsl:otherwise>
|
---|
205 | </xsl:choose>
|
---|
206 | </xsl:template>
|
---|
207 |
|
---|
208 | <!-- ====================================================================== -->
|
---|
209 | <!-- funcprototype: kr, non-tabular -->
|
---|
210 |
|
---|
211 | <xsl:template match="funcprototype" mode="kr-nontabular">
|
---|
212 | <p>
|
---|
213 | <xsl:apply-templates mode="kr-nontabular"/>
|
---|
214 | <xsl:if test="paramdef">
|
---|
215 | <br/>
|
---|
216 | <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/>
|
---|
217 | </xsl:if>
|
---|
218 | </p>
|
---|
219 | </xsl:template>
|
---|
220 |
|
---|
221 | <xsl:template match="funcdef" mode="kr-nontabular">
|
---|
222 | <code class="{name(.)}">
|
---|
223 | <xsl:apply-templates mode="kr-nontabular"/>
|
---|
224 | <xsl:text>(</xsl:text>
|
---|
225 | </code>
|
---|
226 | </xsl:template>
|
---|
227 |
|
---|
228 | <xsl:template match="funcdef/function" mode="kr-nontabular">
|
---|
229 | <xsl:choose>
|
---|
230 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
231 | <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
|
---|
232 | </xsl:when>
|
---|
233 | <xsl:otherwise>
|
---|
234 | <xsl:apply-templates mode="kr-nontabular"/>
|
---|
235 | </xsl:otherwise>
|
---|
236 | </xsl:choose>
|
---|
237 | </xsl:template>
|
---|
238 |
|
---|
239 | <xsl:template match="void" mode="kr-nontabular">
|
---|
240 | <code>)</code>
|
---|
241 | <xsl:text>;</xsl:text>
|
---|
242 | </xsl:template>
|
---|
243 |
|
---|
244 | <xsl:template match="varargs" mode="kr-nontabular">
|
---|
245 | <xsl:text>...</xsl:text>
|
---|
246 | <code>)</code>
|
---|
247 | <xsl:text>;</xsl:text>
|
---|
248 | </xsl:template>
|
---|
249 |
|
---|
250 | <xsl:template match="paramdef" mode="kr-nontabular">
|
---|
251 | <xsl:apply-templates select="parameter" mode="kr-nontabular"/>
|
---|
252 | <xsl:choose>
|
---|
253 | <xsl:when test="following-sibling::*">
|
---|
254 | <xsl:text>, </xsl:text>
|
---|
255 | </xsl:when>
|
---|
256 | <xsl:otherwise>
|
---|
257 | <code>)</code>
|
---|
258 | <xsl:text>;</xsl:text>
|
---|
259 | </xsl:otherwise>
|
---|
260 | </xsl:choose>
|
---|
261 | </xsl:template>
|
---|
262 |
|
---|
263 | <xsl:template match="paramdef/parameter" mode="kr-nontabular">
|
---|
264 | <xsl:choose>
|
---|
265 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
266 | <var class="pdparam">
|
---|
267 | <xsl:apply-templates mode="kr-nontabular"/>
|
---|
268 | </var>
|
---|
269 | </xsl:when>
|
---|
270 | <xsl:otherwise>
|
---|
271 | <xsl:apply-templates mode="kr-nontabular"/>
|
---|
272 | </xsl:otherwise>
|
---|
273 | </xsl:choose>
|
---|
274 | </xsl:template>
|
---|
275 |
|
---|
276 | <xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
|
---|
277 | <xsl:if test="preceding-sibling::paramdef"><br/></xsl:if>
|
---|
278 | <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
|
---|
279 | <xsl:text>;</xsl:text>
|
---|
280 | </xsl:template>
|
---|
281 |
|
---|
282 | <xsl:template match="paramdef/parameter" mode="kr-funcsynopsis-mode">
|
---|
283 | <xsl:choose>
|
---|
284 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
285 | <var class="pdparam">
|
---|
286 | <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
|
---|
287 | </var>
|
---|
288 | </xsl:when>
|
---|
289 | <xsl:otherwise>
|
---|
290 | <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
|
---|
291 | </xsl:otherwise>
|
---|
292 | </xsl:choose>
|
---|
293 | </xsl:template>
|
---|
294 |
|
---|
295 | <xsl:template match="funcparams" mode="kr-funcsynopsis-mode">
|
---|
296 | <code>(</code>
|
---|
297 | <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
|
---|
298 | <code>)</code>
|
---|
299 | <xsl:text>;</xsl:text>
|
---|
300 | </xsl:template>
|
---|
301 |
|
---|
302 | <!-- ====================================================================== -->
|
---|
303 | <!-- funcprototype: kr, tabular -->
|
---|
304 |
|
---|
305 | <xsl:template match="funcprototype" mode="kr-tabular">
|
---|
306 | <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"
|
---|
307 | style="padding-bottom: 1em">
|
---|
308 | <tr>
|
---|
309 | <td>
|
---|
310 | <xsl:apply-templates select="funcdef" mode="kr-tabular"/>
|
---|
311 | </td>
|
---|
312 | <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="kr-tabular"/>
|
---|
313 | </tr>
|
---|
314 | <xsl:for-each select="(void|varargs|paramdef)[position() > 1]">
|
---|
315 | <tr>
|
---|
316 | <td> </td>
|
---|
317 | <xsl:apply-templates select="." mode="kr-tabular"/>
|
---|
318 | </tr>
|
---|
319 | </xsl:for-each>
|
---|
320 | </table>
|
---|
321 | <xsl:if test="paramdef">
|
---|
322 | <table border="0" summary="Function argument synopsis"
|
---|
323 | cellspacing="0" cellpadding="0">
|
---|
324 | <xsl:if test="following-sibling::funcprototype">
|
---|
325 | <xsl:attribute name="style">padding-bottom: 1em</xsl:attribute>
|
---|
326 | </xsl:if>
|
---|
327 | <xsl:apply-templates select="paramdef" mode="kr-tabular-funcsynopsis-mode"/>
|
---|
328 | </table>
|
---|
329 | </xsl:if>
|
---|
330 | </xsl:template>
|
---|
331 |
|
---|
332 | <xsl:template match="funcdef" mode="kr-tabular">
|
---|
333 | <code class="{name(.)}">
|
---|
334 | <xsl:apply-templates mode="kr-tabular"/>
|
---|
335 | <xsl:text>(</xsl:text>
|
---|
336 | </code>
|
---|
337 | </xsl:template>
|
---|
338 |
|
---|
339 | <xsl:template match="funcdef/function" mode="kr-tabular">
|
---|
340 | <xsl:choose>
|
---|
341 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
342 | <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
|
---|
343 | </xsl:when>
|
---|
344 | <xsl:otherwise>
|
---|
345 | <xsl:apply-templates mode="kr-tabular"/>
|
---|
346 | </xsl:otherwise>
|
---|
347 | </xsl:choose>
|
---|
348 | </xsl:template>
|
---|
349 |
|
---|
350 | <xsl:template match="void" mode="kr-tabular">
|
---|
351 | <td>
|
---|
352 | <code>)</code>
|
---|
353 | <xsl:text>;</xsl:text>
|
---|
354 | </td>
|
---|
355 | <td> </td>
|
---|
356 | </xsl:template>
|
---|
357 |
|
---|
358 | <xsl:template match="varargs" mode="kr-tabular">
|
---|
359 | <td>
|
---|
360 | <xsl:text>...</xsl:text>
|
---|
361 | <code>)</code>
|
---|
362 | <xsl:text>;</xsl:text>
|
---|
363 | </td>
|
---|
364 | <td> </td>
|
---|
365 | </xsl:template>
|
---|
366 |
|
---|
367 | <xsl:template match="paramdef" mode="kr-tabular">
|
---|
368 | <td>
|
---|
369 | <xsl:apply-templates select="parameter" mode="kr-tabular"/>
|
---|
370 | <xsl:choose>
|
---|
371 | <xsl:when test="following-sibling::*">
|
---|
372 | <xsl:text>, </xsl:text>
|
---|
373 | </xsl:when>
|
---|
374 | <xsl:otherwise>
|
---|
375 | <code>)</code>
|
---|
376 | <xsl:text>;</xsl:text>
|
---|
377 | </xsl:otherwise>
|
---|
378 | </xsl:choose>
|
---|
379 | </td>
|
---|
380 | <td> </td>
|
---|
381 | </xsl:template>
|
---|
382 |
|
---|
383 | <xsl:template match="paramdef/parameter" mode="kr-tabular">
|
---|
384 | <xsl:choose>
|
---|
385 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
386 | <var class="pdparam">
|
---|
387 | <xsl:apply-templates mode="kr-tabular"/>
|
---|
388 | </var>
|
---|
389 | </xsl:when>
|
---|
390 | <xsl:otherwise>
|
---|
391 | <xsl:apply-templates mode="kr-tabular"/>
|
---|
392 | </xsl:otherwise>
|
---|
393 | </xsl:choose>
|
---|
394 | </xsl:template>
|
---|
395 |
|
---|
396 | <xsl:template match="paramdef" mode="kr-tabular-funcsynopsis-mode">
|
---|
397 | <tr>
|
---|
398 | <xsl:choose>
|
---|
399 | <xsl:when test="type and funcparams">
|
---|
400 | <td>
|
---|
401 | <xsl:apply-templates select="type" mode="kr-tabular-funcsynopsis-mode"/>
|
---|
402 | <xsl:text> </xsl:text>
|
---|
403 | </td>
|
---|
404 | <td>
|
---|
405 | <xsl:apply-templates select="type/following-sibling::node()"
|
---|
406 | mode="kr-tabular-funcsynopsis-mode"/>
|
---|
407 | </td>
|
---|
408 | </xsl:when>
|
---|
409 | <xsl:when test="funcparams">
|
---|
410 | <td colspan="2">
|
---|
411 | <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
|
---|
412 | </td>
|
---|
413 | </xsl:when>
|
---|
414 | <xsl:otherwise>
|
---|
415 | <td>
|
---|
416 | <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]"
|
---|
417 | mode="kr-tabular-funcsynopsis-mode"/>
|
---|
418 | <xsl:text> </xsl:text>
|
---|
419 | </td>
|
---|
420 | <td>
|
---|
421 | <xsl:apply-templates select="parameter"
|
---|
422 | mode="kr-tabular"/>
|
---|
423 | <xsl:apply-templates select="parameter/following-sibling::node()[not(self::parameter)]"
|
---|
424 | mode="kr-tabular-funcsynopsis-mode"/>
|
---|
425 | <xsl:text>;</xsl:text>
|
---|
426 | </td>
|
---|
427 | </xsl:otherwise>
|
---|
428 | </xsl:choose>
|
---|
429 | </tr>
|
---|
430 | </xsl:template>
|
---|
431 |
|
---|
432 | <xsl:template match="paramdef/parameter" mode="kr-tabular-funcsynopsis-mode">
|
---|
433 | <xsl:choose>
|
---|
434 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
435 | <var class="pdparam">
|
---|
436 | <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
|
---|
437 | </var>
|
---|
438 | </xsl:when>
|
---|
439 | <xsl:otherwise>
|
---|
440 | <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
|
---|
441 | </xsl:otherwise>
|
---|
442 | </xsl:choose>
|
---|
443 | </xsl:template>
|
---|
444 |
|
---|
445 | <xsl:template match="funcparams" mode="kr-tabular-funcsynopsis-mode">
|
---|
446 | <code>(</code>
|
---|
447 | <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
|
---|
448 | <code>)</code>
|
---|
449 | <xsl:text>;</xsl:text>
|
---|
450 | </xsl:template>
|
---|
451 |
|
---|
452 | <!-- ====================================================================== -->
|
---|
453 | <!-- funcprototype: ansi, non-tabular -->
|
---|
454 |
|
---|
455 | <xsl:template match="funcprototype" mode="ansi-nontabular">
|
---|
456 | <p>
|
---|
457 | <xsl:apply-templates mode="ansi-nontabular"/>
|
---|
458 | </p>
|
---|
459 | </xsl:template>
|
---|
460 |
|
---|
461 | <xsl:template match="funcdef" mode="ansi-nontabular">
|
---|
462 | <code class="{name(.)}">
|
---|
463 | <xsl:apply-templates mode="ansi-nontabular"/>
|
---|
464 | <xsl:text>(</xsl:text>
|
---|
465 | </code>
|
---|
466 | </xsl:template>
|
---|
467 |
|
---|
468 | <xsl:template match="funcdef/function" mode="ansi-nontabular">
|
---|
469 | <xsl:choose>
|
---|
470 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
471 | <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
|
---|
472 | </xsl:when>
|
---|
473 | <xsl:otherwise>
|
---|
474 | <xsl:apply-templates mode="ansi-nontabular"/>
|
---|
475 | </xsl:otherwise>
|
---|
476 | </xsl:choose>
|
---|
477 | </xsl:template>
|
---|
478 |
|
---|
479 | <xsl:template match="void" mode="ansi-nontabular">
|
---|
480 | <code>void)</code>
|
---|
481 | <xsl:text>;</xsl:text>
|
---|
482 | </xsl:template>
|
---|
483 |
|
---|
484 | <xsl:template match="varargs" mode="ansi-nontabular">
|
---|
485 | <xsl:text>...</xsl:text>
|
---|
486 | <code>)</code>
|
---|
487 | <xsl:text>;</xsl:text>
|
---|
488 | </xsl:template>
|
---|
489 |
|
---|
490 | <xsl:template match="paramdef" mode="ansi-nontabular">
|
---|
491 | <xsl:apply-templates mode="ansi-nontabular"/>
|
---|
492 | <xsl:choose>
|
---|
493 | <xsl:when test="following-sibling::*">
|
---|
494 | <xsl:text>, </xsl:text>
|
---|
495 | </xsl:when>
|
---|
496 | <xsl:otherwise>
|
---|
497 | <code>)</code>
|
---|
498 | <xsl:text>;</xsl:text>
|
---|
499 | </xsl:otherwise>
|
---|
500 | </xsl:choose>
|
---|
501 | </xsl:template>
|
---|
502 |
|
---|
503 | <xsl:template match="paramdef/parameter" mode="ansi-nontabular">
|
---|
504 | <xsl:choose>
|
---|
505 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
506 | <var class="pdparam">
|
---|
507 | <xsl:apply-templates mode="ansi-nontabular"/>
|
---|
508 | </var>
|
---|
509 | </xsl:when>
|
---|
510 | <xsl:otherwise>
|
---|
511 | <xsl:apply-templates mode="ansi-nontabular"/>
|
---|
512 | </xsl:otherwise>
|
---|
513 | </xsl:choose>
|
---|
514 | </xsl:template>
|
---|
515 |
|
---|
516 | <xsl:template match="funcparams" mode="ansi-nontabular">
|
---|
517 | <code>(</code>
|
---|
518 | <xsl:apply-templates mode="ansi-nontabular"/>
|
---|
519 | <code>)</code>
|
---|
520 | </xsl:template>
|
---|
521 |
|
---|
522 | <!-- ====================================================================== -->
|
---|
523 | <!-- funcprototype: ansi, tabular -->
|
---|
524 |
|
---|
525 | <xsl:template match="funcprototype" mode="ansi-tabular">
|
---|
526 | <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
|
---|
527 | <xsl:if test="following-sibling::funcprototype">
|
---|
528 | <xsl:attribute name="style">padding-bottom: 1em</xsl:attribute>
|
---|
529 | </xsl:if>
|
---|
530 | <tr>
|
---|
531 | <td>
|
---|
532 | <xsl:apply-templates select="funcdef" mode="ansi-tabular"/>
|
---|
533 | </td>
|
---|
534 | <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="ansi-tabular"/>
|
---|
535 | </tr>
|
---|
536 | <xsl:for-each select="(void|varargs|paramdef)[position() > 1]">
|
---|
537 | <tr>
|
---|
538 | <td> </td>
|
---|
539 | <xsl:apply-templates select="." mode="ansi-tabular"/>
|
---|
540 | </tr>
|
---|
541 | </xsl:for-each>
|
---|
542 | </table>
|
---|
543 | </xsl:template>
|
---|
544 |
|
---|
545 | <xsl:template match="funcdef" mode="ansi-tabular">
|
---|
546 | <code class="{name(.)}">
|
---|
547 | <xsl:apply-templates mode="ansi-tabular"/>
|
---|
548 | <xsl:text>(</xsl:text>
|
---|
549 | </code>
|
---|
550 | </xsl:template>
|
---|
551 |
|
---|
552 | <xsl:template match="funcdef/function" mode="ansi-tabular">
|
---|
553 | <xsl:choose>
|
---|
554 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
555 | <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
|
---|
556 | </xsl:when>
|
---|
557 | <xsl:otherwise>
|
---|
558 | <xsl:apply-templates mode="kr-tabular"/>
|
---|
559 | </xsl:otherwise>
|
---|
560 | </xsl:choose>
|
---|
561 | </xsl:template>
|
---|
562 |
|
---|
563 | <xsl:template match="void" mode="ansi-tabular">
|
---|
564 | <td>
|
---|
565 | <code>void)</code>
|
---|
566 | <xsl:text>;</xsl:text>
|
---|
567 | </td>
|
---|
568 | <td> </td>
|
---|
569 | </xsl:template>
|
---|
570 |
|
---|
571 | <xsl:template match="varargs" mode="ansi-tabular">
|
---|
572 | <td>
|
---|
573 | <xsl:text>...</xsl:text>
|
---|
574 | <code>)</code>
|
---|
575 | <xsl:text>;</xsl:text>
|
---|
576 | </td>
|
---|
577 | <td> </td>
|
---|
578 | </xsl:template>
|
---|
579 |
|
---|
580 | <xsl:template match="paramdef" mode="ansi-tabular">
|
---|
581 | <xsl:choose>
|
---|
582 | <xsl:when test="type and funcparams">
|
---|
583 | <td>
|
---|
584 | <xsl:apply-templates select="type" mode="kr-tabular-funcsynopsis-mode"/>
|
---|
585 | <xsl:text> </xsl:text>
|
---|
586 | </td>
|
---|
587 | <td>
|
---|
588 | <xsl:apply-templates select="type/following-sibling::node()"
|
---|
589 | mode="kr-tabular-funcsynopsis-mode"/>
|
---|
590 | </td>
|
---|
591 | </xsl:when>
|
---|
592 | <xsl:otherwise>
|
---|
593 | <td>
|
---|
594 | <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]"
|
---|
595 | mode="ansi-tabular"/>
|
---|
596 | <xsl:text> </xsl:text>
|
---|
597 | </td>
|
---|
598 | <td>
|
---|
599 | <xsl:apply-templates select="parameter"
|
---|
600 | mode="ansi-tabular"/>
|
---|
601 | <xsl:apply-templates select="parameter/following-sibling::node()[not(self::parameter)]"
|
---|
602 | mode="ansi-tabular"/>
|
---|
603 | <xsl:choose>
|
---|
604 | <xsl:when test="following-sibling::*">
|
---|
605 | <xsl:text>, </xsl:text>
|
---|
606 | </xsl:when>
|
---|
607 | <xsl:otherwise>
|
---|
608 | <code>)</code>
|
---|
609 | <xsl:text>;</xsl:text>
|
---|
610 | </xsl:otherwise>
|
---|
611 | </xsl:choose>
|
---|
612 | </td>
|
---|
613 | </xsl:otherwise>
|
---|
614 | </xsl:choose>
|
---|
615 | </xsl:template>
|
---|
616 |
|
---|
617 | <xsl:template match="paramdef/parameter" mode="ansi-tabular">
|
---|
618 | <xsl:choose>
|
---|
619 | <xsl:when test="$funcsynopsis.decoration != 0">
|
---|
620 | <var class="pdparam">
|
---|
621 | <xsl:apply-templates mode="ansi-tabular"/>
|
---|
622 | </var>
|
---|
623 | </xsl:when>
|
---|
624 | <xsl:otherwise>
|
---|
625 | <xsl:apply-templates mode="ansi-tabular"/>
|
---|
626 | </xsl:otherwise>
|
---|
627 | </xsl:choose>
|
---|
628 | </xsl:template>
|
---|
629 |
|
---|
630 | <xsl:template match="funcparams" mode="ansi-tabular">
|
---|
631 | <code>(</code>
|
---|
632 | <xsl:apply-templates/>
|
---|
633 | <code>)</code>
|
---|
634 | </xsl:template>
|
---|
635 |
|
---|
636 | <!-- ====================================================================== -->
|
---|
637 |
|
---|
638 | <xsl:variable name="default-classsynopsis-language">java</xsl:variable>
|
---|
639 |
|
---|
640 | <xsl:template match="classsynopsis
|
---|
641 | |fieldsynopsis
|
---|
642 | |methodsynopsis
|
---|
643 | |constructorsynopsis
|
---|
644 | |destructorsynopsis">
|
---|
645 | <xsl:param name="language">
|
---|
646 | <xsl:choose>
|
---|
647 | <xsl:when test="@language">
|
---|
648 | <xsl:value-of select="@language"/>
|
---|
649 | </xsl:when>
|
---|
650 | <xsl:otherwise>
|
---|
651 | <xsl:value-of select="$default-classsynopsis-language"/>
|
---|
652 | </xsl:otherwise>
|
---|
653 | </xsl:choose>
|
---|
654 | </xsl:param>
|
---|
655 |
|
---|
656 | <xsl:choose>
|
---|
657 | <xsl:when test="$language='java'">
|
---|
658 | <xsl:apply-templates select="." mode="java"/>
|
---|
659 | </xsl:when>
|
---|
660 | <xsl:when test="$language='perl'">
|
---|
661 | <xsl:apply-templates select="." mode="perl"/>
|
---|
662 | </xsl:when>
|
---|
663 | <xsl:when test="$language='idl'">
|
---|
664 | <xsl:apply-templates select="." mode="idl"/>
|
---|
665 | </xsl:when>
|
---|
666 | <xsl:when test="$language='cpp'">
|
---|
667 | <xsl:apply-templates select="." mode="cpp"/>
|
---|
668 | </xsl:when>
|
---|
669 | <xsl:otherwise>
|
---|
670 | <xsl:message>
|
---|
671 | <xsl:text>Unrecognized language on </xsl:text>
|
---|
672 | <xsl:value-of select="name(.)"/>
|
---|
673 | <xsl:text>: </xsl:text>
|
---|
674 | <xsl:value-of select="$language"/>
|
---|
675 | </xsl:message>
|
---|
676 | <xsl:apply-templates select=".">
|
---|
677 | <xsl:with-param name="language"
|
---|
678 | select="$default-classsynopsis-language"/>
|
---|
679 | </xsl:apply-templates>
|
---|
680 | </xsl:otherwise>
|
---|
681 | </xsl:choose>
|
---|
682 | </xsl:template>
|
---|
683 |
|
---|
684 | <xsl:template name="synop-break">
|
---|
685 | <xsl:if test="parent::classsynopsis
|
---|
686 | or (following-sibling::fieldsynopsis
|
---|
687 | |following-sibling::methodsynopsis
|
---|
688 | |following-sibling::constructorsynopsis
|
---|
689 | |following-sibling::destructorsynopsis)">
|
---|
690 | <br/>
|
---|
691 | </xsl:if>
|
---|
692 | </xsl:template>
|
---|
693 |
|
---|
694 |
|
---|
695 | <!-- ===== Java ======================================================== -->
|
---|
696 |
|
---|
697 | <xsl:template match="classsynopsis" mode="java">
|
---|
698 | <pre class="{name(.)}">
|
---|
699 | <xsl:apply-templates select="ooclass[1]" mode="java"/>
|
---|
700 | <xsl:if test="ooclass[position() > 1]">
|
---|
701 | <xsl:text> extends</xsl:text>
|
---|
702 | <xsl:apply-templates select="ooclass[position() > 1]" mode="java"/>
|
---|
703 | <xsl:if test="oointerface|ooexception">
|
---|
704 | <br/>
|
---|
705 | <xsl:text> </xsl:text>
|
---|
706 | </xsl:if>
|
---|
707 | </xsl:if>
|
---|
708 | <xsl:if test="oointerface">
|
---|
709 | <xsl:text>implements</xsl:text>
|
---|
710 | <xsl:apply-templates select="oointerface" mode="java"/>
|
---|
711 | <xsl:if test="ooexception">
|
---|
712 | <br/>
|
---|
713 | <xsl:text> </xsl:text>
|
---|
714 | </xsl:if>
|
---|
715 | </xsl:if>
|
---|
716 | <xsl:if test="ooexception">
|
---|
717 | <xsl:text>throws</xsl:text>
|
---|
718 | <xsl:apply-templates select="ooexception" mode="java"/>
|
---|
719 | </xsl:if>
|
---|
720 | <xsl:text> {</xsl:text>
|
---|
721 | <br/>
|
---|
722 | <xsl:apply-templates select="constructorsynopsis
|
---|
723 | |destructorsynopsis
|
---|
724 | |fieldsynopsis
|
---|
725 | |methodsynopsis
|
---|
726 | |classsynopsisinfo" mode="java"/>
|
---|
727 | <xsl:text>}</xsl:text>
|
---|
728 | </pre>
|
---|
729 | </xsl:template>
|
---|
730 |
|
---|
731 | <xsl:template match="classsynopsisinfo" mode="java">
|
---|
732 | <xsl:apply-templates mode="java"/>
|
---|
733 | </xsl:template>
|
---|
734 |
|
---|
735 | <xsl:template match="ooclass|oointerface|ooexception" mode="java">
|
---|
736 | <xsl:choose>
|
---|
737 | <xsl:when test="position() > 1">
|
---|
738 | <xsl:text>, </xsl:text>
|
---|
739 | </xsl:when>
|
---|
740 | <xsl:otherwise>
|
---|
741 | <xsl:text> </xsl:text>
|
---|
742 | </xsl:otherwise>
|
---|
743 | </xsl:choose>
|
---|
744 | <span class="{name(.)}">
|
---|
745 | <xsl:apply-templates mode="java"/>
|
---|
746 | </span>
|
---|
747 | </xsl:template>
|
---|
748 |
|
---|
749 | <xsl:template match="modifier" mode="java">
|
---|
750 | <span class="{name(.)}">
|
---|
751 | <xsl:apply-templates mode="java"/>
|
---|
752 | <xsl:text> </xsl:text>
|
---|
753 | </span>
|
---|
754 | </xsl:template>
|
---|
755 |
|
---|
756 | <xsl:template match="classname" mode="java">
|
---|
757 | <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
|
---|
758 | <xsl:text>, </xsl:text>
|
---|
759 | </xsl:if>
|
---|
760 | <span class="{name(.)}">
|
---|
761 | <xsl:apply-templates mode="java"/>
|
---|
762 | </span>
|
---|
763 | </xsl:template>
|
---|
764 |
|
---|
765 | <xsl:template match="interfacename" mode="java">
|
---|
766 | <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
|
---|
767 | <xsl:text>, </xsl:text>
|
---|
768 | </xsl:if>
|
---|
769 | <span class="{name(.)}">
|
---|
770 | <xsl:apply-templates mode="java"/>
|
---|
771 | </span>
|
---|
772 | </xsl:template>
|
---|
773 |
|
---|
774 | <xsl:template match="exceptionname" mode="java">
|
---|
775 | <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
|
---|
776 | <xsl:text>, </xsl:text>
|
---|
777 | </xsl:if>
|
---|
778 | <span class="{name(.)}">
|
---|
779 | <xsl:apply-templates mode="java"/>
|
---|
780 | </span>
|
---|
781 | </xsl:template>
|
---|
782 |
|
---|
783 | <xsl:template match="fieldsynopsis" mode="java">
|
---|
784 | <code class="{name(.)}">
|
---|
785 | <xsl:if test="parent::classsynopsis">
|
---|
786 | <xsl:text> </xsl:text>
|
---|
787 | </xsl:if>
|
---|
788 | <xsl:apply-templates mode="java"/>
|
---|
789 | <xsl:text>;</xsl:text>
|
---|
790 | </code>
|
---|
791 | <xsl:call-template name="synop-break"/>
|
---|
792 | </xsl:template>
|
---|
793 |
|
---|
794 | <xsl:template match="type" mode="java">
|
---|
795 | <span class="{name(.)}">
|
---|
796 | <xsl:apply-templates mode="java"/>
|
---|
797 | <xsl:text> </xsl:text>
|
---|
798 | </span>
|
---|
799 | </xsl:template>
|
---|
800 |
|
---|
801 | <xsl:template match="varname" mode="java">
|
---|
802 | <span class="{name(.)}">
|
---|
803 | <xsl:apply-templates mode="java"/>
|
---|
804 | <xsl:text> </xsl:text>
|
---|
805 | </span>
|
---|
806 | </xsl:template>
|
---|
807 |
|
---|
808 | <xsl:template match="initializer" mode="java">
|
---|
809 | <span class="{name(.)}">
|
---|
810 | <xsl:text>= </xsl:text>
|
---|
811 | <xsl:apply-templates mode="java"/>
|
---|
812 | </span>
|
---|
813 | </xsl:template>
|
---|
814 |
|
---|
815 | <xsl:template match="void" mode="java">
|
---|
816 | <span class="{name(.)}">
|
---|
817 | <xsl:text>void </xsl:text>
|
---|
818 | </span>
|
---|
819 | </xsl:template>
|
---|
820 |
|
---|
821 | <xsl:template match="methodname" mode="java">
|
---|
822 | <span class="{name(.)}">
|
---|
823 | <xsl:apply-templates mode="java"/>
|
---|
824 | </span>
|
---|
825 | </xsl:template>
|
---|
826 |
|
---|
827 | <xsl:template match="methodparam" mode="java">
|
---|
828 | <xsl:param name="indent">0</xsl:param>
|
---|
829 | <xsl:if test="position() > 1">
|
---|
830 | <xsl:text>,</xsl:text>
|
---|
831 | <br/>
|
---|
832 | <xsl:if test="$indent > 0">
|
---|
833 | <xsl:call-template name="copy-string">
|
---|
834 | <xsl:with-param name="string"> </xsl:with-param>
|
---|
835 | <xsl:with-param name="count" select="$indent + 1"/>
|
---|
836 | </xsl:call-template>
|
---|
837 | </xsl:if>
|
---|
838 | </xsl:if>
|
---|
839 | <span class="{name(.)}">
|
---|
840 | <xsl:apply-templates mode="java"/>
|
---|
841 | </span>
|
---|
842 | </xsl:template>
|
---|
843 |
|
---|
844 | <xsl:template match="parameter" mode="java">
|
---|
845 | <span class="{name(.)}">
|
---|
846 | <xsl:apply-templates mode="java"/>
|
---|
847 | </span>
|
---|
848 | </xsl:template>
|
---|
849 |
|
---|
850 | <xsl:template mode="java"
|
---|
851 | match="constructorsynopsis|destructorsynopsis|methodsynopsis">
|
---|
852 | <xsl:variable name="modifiers" select="modifier"/>
|
---|
853 | <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
|
---|
854 | <xsl:variable name="decl">
|
---|
855 | <xsl:if test="parent::classsynopsis">
|
---|
856 | <xsl:text> </xsl:text>
|
---|
857 | </xsl:if>
|
---|
858 | <xsl:apply-templates select="$modifiers" mode="java"/>
|
---|
859 |
|
---|
860 | <!-- type -->
|
---|
861 | <xsl:if test="name($notmod[1]) != 'methodname'">
|
---|
862 | <xsl:apply-templates select="$notmod[1]" mode="java"/>
|
---|
863 | </xsl:if>
|
---|
864 |
|
---|
865 | <xsl:apply-templates select="methodname" mode="java"/>
|
---|
866 | </xsl:variable>
|
---|
867 |
|
---|
868 | <code class="{name(.)}">
|
---|
869 | <xsl:copy-of select="$decl"/>
|
---|
870 | <xsl:text>(</xsl:text>
|
---|
871 | <xsl:apply-templates select="methodparam" mode="java">
|
---|
872 | <xsl:with-param name="indent" select="string-length($decl)"/>
|
---|
873 | </xsl:apply-templates>
|
---|
874 | <xsl:text>)</xsl:text>
|
---|
875 | <xsl:if test="exceptionname">
|
---|
876 | <br/>
|
---|
877 | <xsl:text> throws </xsl:text>
|
---|
878 | <xsl:apply-templates select="exceptionname" mode="java"/>
|
---|
879 | </xsl:if>
|
---|
880 | <xsl:text>;</xsl:text>
|
---|
881 | </code>
|
---|
882 | <xsl:call-template name="synop-break"/>
|
---|
883 | </xsl:template>
|
---|
884 |
|
---|
885 | <!-- ===== C++ ========================================================= -->
|
---|
886 |
|
---|
887 | <xsl:template match="classsynopsis" mode="cpp">
|
---|
888 | <pre class="{name(.)}">
|
---|
889 | <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
|
---|
890 | <xsl:if test="ooclass[position() > 1]">
|
---|
891 | <xsl:text>: </xsl:text>
|
---|
892 | <xsl:apply-templates select="ooclass[position() > 1]" mode="cpp"/>
|
---|
893 | <xsl:if test="oointerface|ooexception">
|
---|
894 | <br/>
|
---|
895 | <xsl:text> </xsl:text>
|
---|
896 | </xsl:if>
|
---|
897 | </xsl:if>
|
---|
898 | <xsl:if test="oointerface">
|
---|
899 | <xsl:text> implements</xsl:text>
|
---|
900 | <xsl:apply-templates select="oointerface" mode="cpp"/>
|
---|
901 | <xsl:if test="ooexception">
|
---|
902 | <br/>
|
---|
903 | <xsl:text> </xsl:text>
|
---|
904 | </xsl:if>
|
---|
905 | </xsl:if>
|
---|
906 | <xsl:if test="ooexception">
|
---|
907 | <xsl:text> throws</xsl:text>
|
---|
908 | <xsl:apply-templates select="ooexception" mode="cpp"/>
|
---|
909 | </xsl:if>
|
---|
910 | <xsl:text> {</xsl:text>
|
---|
911 | <br/>
|
---|
912 | <xsl:apply-templates select="constructorsynopsis
|
---|
913 | |destructorsynopsis
|
---|
914 | |fieldsynopsis
|
---|
915 | |methodsynopsis
|
---|
916 | |classsynopsisinfo" mode="cpp"/>
|
---|
917 | <xsl:text>}</xsl:text>
|
---|
918 | </pre>
|
---|
919 | </xsl:template>
|
---|
920 |
|
---|
921 | <xsl:template match="classsynopsisinfo" mode="cpp">
|
---|
922 | <xsl:apply-templates mode="cpp"/>
|
---|
923 | </xsl:template>
|
---|
924 |
|
---|
925 | <xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
|
---|
926 | <xsl:if test="position() > 1">
|
---|
927 | <xsl:text>, </xsl:text>
|
---|
928 | </xsl:if>
|
---|
929 | <span class="{name(.)}">
|
---|
930 | <xsl:apply-templates mode="cpp"/>
|
---|
931 | </span>
|
---|
932 | </xsl:template>
|
---|
933 |
|
---|
934 | <xsl:template match="modifier" mode="cpp">
|
---|
935 | <span class="{name(.)}">
|
---|
936 | <xsl:apply-templates mode="cpp"/>
|
---|
937 | <xsl:text> </xsl:text>
|
---|
938 | </span>
|
---|
939 | </xsl:template>
|
---|
940 |
|
---|
941 | <xsl:template match="classname" mode="cpp">
|
---|
942 | <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
|
---|
943 | <xsl:text>, </xsl:text>
|
---|
944 | </xsl:if>
|
---|
945 | <span class="{name(.)}">
|
---|
946 | <xsl:apply-templates mode="cpp"/>
|
---|
947 | </span>
|
---|
948 | </xsl:template>
|
---|
949 |
|
---|
950 | <xsl:template match="interfacename" mode="cpp">
|
---|
951 | <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
|
---|
952 | <xsl:text>, </xsl:text>
|
---|
953 | </xsl:if>
|
---|
954 | <span class="{name(.)}">
|
---|
955 | <xsl:apply-templates mode="cpp"/>
|
---|
956 | </span>
|
---|
957 | </xsl:template>
|
---|
958 |
|
---|
959 | <xsl:template match="exceptionname" mode="cpp">
|
---|
960 | <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
|
---|
961 | <xsl:text>, </xsl:text>
|
---|
962 | </xsl:if>
|
---|
963 | <span class="{name(.)}">
|
---|
964 | <xsl:apply-templates mode="cpp"/>
|
---|
965 | </span>
|
---|
966 | </xsl:template>
|
---|
967 |
|
---|
968 | <xsl:template match="fieldsynopsis" mode="cpp">
|
---|
969 | <code class="{name(.)}">
|
---|
970 | <xsl:if test="parent::classsynopsis">
|
---|
971 | <xsl:text> </xsl:text>
|
---|
972 | </xsl:if>
|
---|
973 | <xsl:apply-templates mode="cpp"/>
|
---|
974 | <xsl:text>;</xsl:text>
|
---|
975 | </code>
|
---|
976 | <xsl:call-template name="synop-break"/>
|
---|
977 | </xsl:template>
|
---|
978 |
|
---|
979 | <xsl:template match="type" mode="cpp">
|
---|
980 | <span class="{name(.)}">
|
---|
981 | <xsl:apply-templates mode="cpp"/>
|
---|
982 | <xsl:text> </xsl:text>
|
---|
983 | </span>
|
---|
984 | </xsl:template>
|
---|
985 |
|
---|
986 | <xsl:template match="varname" mode="cpp">
|
---|
987 | <span class="{name(.)}">
|
---|
988 | <xsl:apply-templates mode="cpp"/>
|
---|
989 | <xsl:text> </xsl:text>
|
---|
990 | </span>
|
---|
991 | </xsl:template>
|
---|
992 |
|
---|
993 | <xsl:template match="initializer" mode="cpp">
|
---|
994 | <span class="{name(.)}">
|
---|
995 | <xsl:text>= </xsl:text>
|
---|
996 | <xsl:apply-templates mode="cpp"/>
|
---|
997 | </span>
|
---|
998 | </xsl:template>
|
---|
999 |
|
---|
1000 | <xsl:template match="void" mode="cpp">
|
---|
1001 | <span class="{name(.)}">
|
---|
1002 | <xsl:text>void </xsl:text>
|
---|
1003 | </span>
|
---|
1004 | </xsl:template>
|
---|
1005 |
|
---|
1006 | <xsl:template match="methodname" mode="cpp">
|
---|
1007 | <span class="{name(.)}">
|
---|
1008 | <xsl:apply-templates mode="cpp"/>
|
---|
1009 | </span>
|
---|
1010 | </xsl:template>
|
---|
1011 |
|
---|
1012 | <xsl:template match="methodparam" mode="cpp">
|
---|
1013 | <xsl:if test="position() > 1">
|
---|
1014 | <xsl:text>, </xsl:text>
|
---|
1015 | </xsl:if>
|
---|
1016 | <span class="{name(.)}">
|
---|
1017 | <xsl:apply-templates mode="cpp"/>
|
---|
1018 | </span>
|
---|
1019 | </xsl:template>
|
---|
1020 |
|
---|
1021 | <xsl:template match="parameter" mode="cpp">
|
---|
1022 | <span class="{name(.)}">
|
---|
1023 | <xsl:apply-templates mode="cpp"/>
|
---|
1024 | </span>
|
---|
1025 | </xsl:template>
|
---|
1026 |
|
---|
1027 | <xsl:template mode="cpp"
|
---|
1028 | match="constructorsynopsis|destructorsynopsis|methodsynopsis">
|
---|
1029 | <xsl:variable name="modifiers" select="modifier"/>
|
---|
1030 | <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
|
---|
1031 |
|
---|
1032 | <code class="{name(.)}">
|
---|
1033 | <xsl:if test="parent::classsynopsis">
|
---|
1034 | <xsl:text> </xsl:text>
|
---|
1035 | </xsl:if>
|
---|
1036 | <xsl:apply-templates select="$modifiers" mode="cpp"/>
|
---|
1037 |
|
---|
1038 | <!-- type -->
|
---|
1039 | <xsl:if test="name($notmod[1]) != 'methodname'">
|
---|
1040 | <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
|
---|
1041 | </xsl:if>
|
---|
1042 |
|
---|
1043 | <xsl:apply-templates select="methodname" mode="cpp"/>
|
---|
1044 | <xsl:text>(</xsl:text>
|
---|
1045 | <xsl:apply-templates select="methodparam" mode="cpp"/>
|
---|
1046 | <xsl:text>)</xsl:text>
|
---|
1047 | <xsl:if test="exceptionname">
|
---|
1048 | <br/>
|
---|
1049 | <xsl:text> throws </xsl:text>
|
---|
1050 | <xsl:apply-templates select="exceptionname" mode="cpp"/>
|
---|
1051 | </xsl:if>
|
---|
1052 | <xsl:text>;</xsl:text>
|
---|
1053 | </code>
|
---|
1054 | <xsl:call-template name="synop-break"/>
|
---|
1055 | </xsl:template>
|
---|
1056 |
|
---|
1057 | <!-- ===== IDL ========================================================= -->
|
---|
1058 |
|
---|
1059 | <xsl:template match="classsynopsis" mode="idl">
|
---|
1060 | <pre class="{name(.)}">
|
---|
1061 | <xsl:text>interface </xsl:text>
|
---|
1062 | <xsl:apply-templates select="ooclass[1]" mode="idl"/>
|
---|
1063 | <xsl:if test="ooclass[position() > 1]">
|
---|
1064 | <xsl:text>: </xsl:text>
|
---|
1065 | <xsl:apply-templates select="ooclass[position() > 1]" mode="idl"/>
|
---|
1066 | <xsl:if test="oointerface|ooexception">
|
---|
1067 | <br/>
|
---|
1068 | <xsl:text> </xsl:text>
|
---|
1069 | </xsl:if>
|
---|
1070 | </xsl:if>
|
---|
1071 | <xsl:if test="oointerface">
|
---|
1072 | <xsl:text> implements</xsl:text>
|
---|
1073 | <xsl:apply-templates select="oointerface" mode="idl"/>
|
---|
1074 | <xsl:if test="ooexception">
|
---|
1075 | <br/>
|
---|
1076 | <xsl:text> </xsl:text>
|
---|
1077 | </xsl:if>
|
---|
1078 | </xsl:if>
|
---|
1079 | <xsl:if test="ooexception">
|
---|
1080 | <xsl:text> throws</xsl:text>
|
---|
1081 | <xsl:apply-templates select="ooexception" mode="idl"/>
|
---|
1082 | </xsl:if>
|
---|
1083 | <xsl:text> {</xsl:text>
|
---|
1084 | <br/>
|
---|
1085 | <xsl:apply-templates select="constructorsynopsis
|
---|
1086 | |destructorsynopsis
|
---|
1087 | |fieldsynopsis
|
---|
1088 | |methodsynopsis
|
---|
1089 | |classsynopsisinfo" mode="idl"/>
|
---|
1090 | <xsl:text>}</xsl:text>
|
---|
1091 | </pre>
|
---|
1092 | </xsl:template>
|
---|
1093 |
|
---|
1094 | <xsl:template match="classsynopsisinfo" mode="idl">
|
---|
1095 | <xsl:apply-templates mode="idl"/>
|
---|
1096 | </xsl:template>
|
---|
1097 |
|
---|
1098 | <xsl:template match="ooclass|oointerface|ooexception" mode="idl">
|
---|
1099 | <xsl:if test="position() > 1">
|
---|
1100 | <xsl:text>, </xsl:text>
|
---|
1101 | </xsl:if>
|
---|
1102 | <span class="{name(.)}">
|
---|
1103 | <xsl:apply-templates mode="idl"/>
|
---|
1104 | </span>
|
---|
1105 | </xsl:template>
|
---|
1106 |
|
---|
1107 | <xsl:template match="modifier" mode="idl">
|
---|
1108 | <span class="{name(.)}">
|
---|
1109 | <xsl:apply-templates mode="idl"/>
|
---|
1110 | <xsl:text> </xsl:text>
|
---|
1111 | </span>
|
---|
1112 | </xsl:template>
|
---|
1113 |
|
---|
1114 | <xsl:template match="classname" mode="idl">
|
---|
1115 | <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
|
---|
1116 | <xsl:text>, </xsl:text>
|
---|
1117 | </xsl:if>
|
---|
1118 | <span class="{name(.)}">
|
---|
1119 | <xsl:apply-templates mode="idl"/>
|
---|
1120 | </span>
|
---|
1121 | </xsl:template>
|
---|
1122 |
|
---|
1123 | <xsl:template match="interfacename" mode="idl">
|
---|
1124 | <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
|
---|
1125 | <xsl:text>, </xsl:text>
|
---|
1126 | </xsl:if>
|
---|
1127 | <span class="{name(.)}">
|
---|
1128 | <xsl:apply-templates mode="idl"/>
|
---|
1129 | </span>
|
---|
1130 | </xsl:template>
|
---|
1131 |
|
---|
1132 | <xsl:template match="exceptionname" mode="idl">
|
---|
1133 | <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
|
---|
1134 | <xsl:text>, </xsl:text>
|
---|
1135 | </xsl:if>
|
---|
1136 | <span class="{name(.)}">
|
---|
1137 | <xsl:apply-templates mode="idl"/>
|
---|
1138 | </span>
|
---|
1139 | </xsl:template>
|
---|
1140 |
|
---|
1141 | <xsl:template match="fieldsynopsis" mode="idl">
|
---|
1142 | <code class="{name(.)}">
|
---|
1143 | <xsl:if test="parent::classsynopsis">
|
---|
1144 | <xsl:text> </xsl:text>
|
---|
1145 | </xsl:if>
|
---|
1146 | <xsl:apply-templates mode="idl"/>
|
---|
1147 | <xsl:text>;</xsl:text>
|
---|
1148 | </code>
|
---|
1149 | <xsl:call-template name="synop-break"/>
|
---|
1150 | </xsl:template>
|
---|
1151 |
|
---|
1152 | <xsl:template match="type" mode="idl">
|
---|
1153 | <span class="{name(.)}">
|
---|
1154 | <xsl:apply-templates mode="idl"/>
|
---|
1155 | <xsl:text> </xsl:text>
|
---|
1156 | </span>
|
---|
1157 | </xsl:template>
|
---|
1158 |
|
---|
1159 | <xsl:template match="varname" mode="idl">
|
---|
1160 | <span class="{name(.)}">
|
---|
1161 | <xsl:apply-templates mode="idl"/>
|
---|
1162 | <xsl:text> </xsl:text>
|
---|
1163 | </span>
|
---|
1164 | </xsl:template>
|
---|
1165 |
|
---|
1166 | <xsl:template match="initializer" mode="idl">
|
---|
1167 | <span class="{name(.)}">
|
---|
1168 | <xsl:text>= </xsl:text>
|
---|
1169 | <xsl:apply-templates mode="idl"/>
|
---|
1170 | </span>
|
---|
1171 | </xsl:template>
|
---|
1172 |
|
---|
1173 | <xsl:template match="void" mode="idl">
|
---|
1174 | <span class="{name(.)}">
|
---|
1175 | <xsl:text>void </xsl:text>
|
---|
1176 | </span>
|
---|
1177 | </xsl:template>
|
---|
1178 |
|
---|
1179 | <xsl:template match="methodname" mode="idl">
|
---|
1180 | <span class="{name(.)}">
|
---|
1181 | <xsl:apply-templates mode="idl"/>
|
---|
1182 | </span>
|
---|
1183 | </xsl:template>
|
---|
1184 |
|
---|
1185 | <xsl:template match="methodparam" mode="idl">
|
---|
1186 | <xsl:if test="position() > 1">
|
---|
1187 | <xsl:text>, </xsl:text>
|
---|
1188 | </xsl:if>
|
---|
1189 | <span class="{name(.)}">
|
---|
1190 | <xsl:apply-templates mode="idl"/>
|
---|
1191 | </span>
|
---|
1192 | </xsl:template>
|
---|
1193 |
|
---|
1194 | <xsl:template match="parameter" mode="idl">
|
---|
1195 | <span class="{name(.)}">
|
---|
1196 | <xsl:apply-templates mode="idl"/>
|
---|
1197 | </span>
|
---|
1198 | </xsl:template>
|
---|
1199 |
|
---|
1200 | <xsl:template mode="idl"
|
---|
1201 | match="constructorsynopsis|destructorsynopsis|methodsynopsis">
|
---|
1202 | <xsl:variable name="modifiers" select="modifier"/>
|
---|
1203 | <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
|
---|
1204 |
|
---|
1205 | <code class="{name(.)}">
|
---|
1206 | <xsl:if test="parent::classsynopsis">
|
---|
1207 | <xsl:text> </xsl:text>
|
---|
1208 | </xsl:if>
|
---|
1209 | <xsl:apply-templates select="$modifiers" mode="idl"/>
|
---|
1210 |
|
---|
1211 | <!-- type -->
|
---|
1212 | <xsl:if test="name($notmod[1]) != 'methodname'">
|
---|
1213 | <xsl:apply-templates select="$notmod[1]" mode="idl"/>
|
---|
1214 | </xsl:if>
|
---|
1215 |
|
---|
1216 | <xsl:apply-templates select="methodname" mode="idl"/>
|
---|
1217 | <xsl:text>(</xsl:text>
|
---|
1218 | <xsl:apply-templates select="methodparam" mode="idl"/>
|
---|
1219 | <xsl:text>)</xsl:text>
|
---|
1220 | <xsl:if test="exceptionname">
|
---|
1221 | <br/>
|
---|
1222 | <xsl:text> raises(</xsl:text>
|
---|
1223 | <xsl:apply-templates select="exceptionname" mode="idl"/>
|
---|
1224 | <xsl:text>)</xsl:text>
|
---|
1225 | </xsl:if>
|
---|
1226 | <xsl:text>;</xsl:text>
|
---|
1227 | </code>
|
---|
1228 | <xsl:call-template name="synop-break"/>
|
---|
1229 | </xsl:template>
|
---|
1230 |
|
---|
1231 | <!-- ===== Perl ======================================================== -->
|
---|
1232 |
|
---|
1233 | <xsl:template match="classsynopsis" mode="perl">
|
---|
1234 | <pre class="{name(.)}">
|
---|
1235 | <xsl:text>package </xsl:text>
|
---|
1236 | <xsl:apply-templates select="ooclass[1]" mode="perl"/>
|
---|
1237 | <xsl:text>;</xsl:text>
|
---|
1238 | <br/>
|
---|
1239 |
|
---|
1240 | <xsl:if test="ooclass[position() > 1]">
|
---|
1241 | <xsl:text>@ISA = (</xsl:text>
|
---|
1242 | <xsl:apply-templates select="ooclass[position() > 1]" mode="perl"/>
|
---|
1243 | <xsl:text>);</xsl:text>
|
---|
1244 | <br/>
|
---|
1245 | </xsl:if>
|
---|
1246 |
|
---|
1247 | <xsl:apply-templates select="constructorsynopsis
|
---|
1248 | |destructorsynopsis
|
---|
1249 | |fieldsynopsis
|
---|
1250 | |methodsynopsis
|
---|
1251 | |classsynopsisinfo" mode="perl"/>
|
---|
1252 | </pre>
|
---|
1253 | </xsl:template>
|
---|
1254 |
|
---|
1255 | <xsl:template match="classsynopsisinfo" mode="perl">
|
---|
1256 | <xsl:apply-templates mode="perl"/>
|
---|
1257 | </xsl:template>
|
---|
1258 |
|
---|
1259 | <xsl:template match="ooclass|oointerface|ooexception" mode="perl">
|
---|
1260 | <xsl:if test="position() > 1">
|
---|
1261 | <xsl:text>, </xsl:text>
|
---|
1262 | </xsl:if>
|
---|
1263 | <span class="{name(.)}">
|
---|
1264 | <xsl:apply-templates mode="perl"/>
|
---|
1265 | </span>
|
---|
1266 | </xsl:template>
|
---|
1267 |
|
---|
1268 | <xsl:template match="modifier" mode="perl">
|
---|
1269 | <span class="{name(.)}">
|
---|
1270 | <xsl:apply-templates mode="perl"/>
|
---|
1271 | <xsl:text> </xsl:text>
|
---|
1272 | </span>
|
---|
1273 | </xsl:template>
|
---|
1274 |
|
---|
1275 | <xsl:template match="classname" mode="perl">
|
---|
1276 | <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
|
---|
1277 | <xsl:text>, </xsl:text>
|
---|
1278 | </xsl:if>
|
---|
1279 | <span class="{name(.)}">
|
---|
1280 | <xsl:apply-templates mode="perl"/>
|
---|
1281 | </span>
|
---|
1282 | </xsl:template>
|
---|
1283 |
|
---|
1284 | <xsl:template match="interfacename" mode="perl">
|
---|
1285 | <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
|
---|
1286 | <xsl:text>, </xsl:text>
|
---|
1287 | </xsl:if>
|
---|
1288 | <span class="{name(.)}">
|
---|
1289 | <xsl:apply-templates mode="perl"/>
|
---|
1290 | </span>
|
---|
1291 | </xsl:template>
|
---|
1292 |
|
---|
1293 | <xsl:template match="exceptionname" mode="perl">
|
---|
1294 | <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
|
---|
1295 | <xsl:text>, </xsl:text>
|
---|
1296 | </xsl:if>
|
---|
1297 | <span class="{name(.)}">
|
---|
1298 | <xsl:apply-templates mode="perl"/>
|
---|
1299 | </span>
|
---|
1300 | </xsl:template>
|
---|
1301 |
|
---|
1302 | <xsl:template match="fieldsynopsis" mode="perl">
|
---|
1303 | <code class="{name(.)}">
|
---|
1304 | <xsl:if test="parent::classsynopsis">
|
---|
1305 | <xsl:text> </xsl:text>
|
---|
1306 | </xsl:if>
|
---|
1307 | <xsl:apply-templates mode="perl"/>
|
---|
1308 | <xsl:text>;</xsl:text>
|
---|
1309 | </code>
|
---|
1310 | <xsl:call-template name="synop-break"/>
|
---|
1311 | </xsl:template>
|
---|
1312 |
|
---|
1313 | <xsl:template match="type" mode="perl">
|
---|
1314 | <span class="{name(.)}">
|
---|
1315 | <xsl:apply-templates mode="perl"/>
|
---|
1316 | <xsl:text> </xsl:text>
|
---|
1317 | </span>
|
---|
1318 | </xsl:template>
|
---|
1319 |
|
---|
1320 | <xsl:template match="varname" mode="perl">
|
---|
1321 | <span class="{name(.)}">
|
---|
1322 | <xsl:apply-templates mode="perl"/>
|
---|
1323 | <xsl:text> </xsl:text>
|
---|
1324 | </span>
|
---|
1325 | </xsl:template>
|
---|
1326 |
|
---|
1327 | <xsl:template match="initializer" mode="perl">
|
---|
1328 | <span class="{name(.)}">
|
---|
1329 | <xsl:text>= </xsl:text>
|
---|
1330 | <xsl:apply-templates mode="perl"/>
|
---|
1331 | </span>
|
---|
1332 | </xsl:template>
|
---|
1333 |
|
---|
1334 | <xsl:template match="void" mode="perl">
|
---|
1335 | <span class="{name(.)}">
|
---|
1336 | <xsl:text>void </xsl:text>
|
---|
1337 | </span>
|
---|
1338 | </xsl:template>
|
---|
1339 |
|
---|
1340 | <xsl:template match="methodname" mode="perl">
|
---|
1341 | <span class="{name(.)}">
|
---|
1342 | <xsl:apply-templates mode="perl"/>
|
---|
1343 | </span>
|
---|
1344 | </xsl:template>
|
---|
1345 |
|
---|
1346 | <xsl:template match="methodparam" mode="perl">
|
---|
1347 | <xsl:if test="position() > 1">
|
---|
1348 | <xsl:text>, </xsl:text>
|
---|
1349 | </xsl:if>
|
---|
1350 | <span class="{name(.)}">
|
---|
1351 | <xsl:apply-templates mode="perl"/>
|
---|
1352 | </span>
|
---|
1353 | </xsl:template>
|
---|
1354 |
|
---|
1355 | <xsl:template match="parameter" mode="perl">
|
---|
1356 | <span class="{name(.)}">
|
---|
1357 | <xsl:apply-templates mode="perl"/>
|
---|
1358 | </span>
|
---|
1359 | </xsl:template>
|
---|
1360 |
|
---|
1361 | <xsl:template mode="perl"
|
---|
1362 | match="constructorsynopsis|destructorsynopsis|methodsynopsis">
|
---|
1363 | <xsl:variable name="modifiers" select="modifier"/>
|
---|
1364 | <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
|
---|
1365 |
|
---|
1366 | <code class="{name(.)}">
|
---|
1367 | <xsl:text>sub </xsl:text>
|
---|
1368 |
|
---|
1369 | <xsl:apply-templates select="methodname" mode="perl"/>
|
---|
1370 | <xsl:text> { ... };</xsl:text>
|
---|
1371 | </code>
|
---|
1372 | <xsl:call-template name="synop-break"/>
|
---|
1373 | </xsl:template>
|
---|
1374 |
|
---|
1375 | <!-- ==================================================================== -->
|
---|
1376 |
|
---|
1377 | </xsl:stylesheet>
|
---|