~ubuntu-branches/ubuntu/vivid/yelp-xsl/vivid-proposed

« back to all changes in this revision

Viewing changes to xslt/docbook/html/db2html-classsynopsis.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-11-29 10:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20101129100013-1fxze8fm1fegxl8w
Tags: upstream-2.31.6
ImportĀ upstreamĀ versionĀ 2.31.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
 
2
<!--
 
3
This program is free software; you can redistribute it and/or modify it under
 
4
the terms of the GNU Lesser General Public License as published by the Free
 
5
Software Foundation; either version 2 of the License, or (at your option) any
 
6
later version.
 
7
 
 
8
This program is distributed in the hope that it will be useful, but WITHOUT
 
9
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
10
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 
11
details.
 
12
 
 
13
You should have received a copy of the GNU Lesser General Public License
 
14
along with this program; see the file COPYING.LGPL.  If not, write to the
 
15
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
16
02111-1307, USA.
 
17
-->
 
18
 
 
19
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
20
                xmlns:db="http://docbook.org/ns/docbook"
 
21
                xmlns="http://www.w3.org/1999/xhtml"
 
22
                version="1.0">
 
23
 
 
24
<!--!!==========================================================================
 
25
DocBook to HTML - Class Synopses
 
26
:Requires: db2html-inline db2html-xref gettext
 
27
 
 
28
REMARK: Describe this module.  Implmentation note: for C++, we expect the first
 
29
modifier to be the visibility
 
30
-->
 
31
 
 
32
<xsl:variable name="cpp.tab" select="'&#160;&#160;&#160;&#160;'"/>
 
33
<xsl:variable name="python.tab" select="'&#160;&#160;&#160;&#160;'"/>
 
34
 
 
35
 
 
36
<!-- FIXME: document PI -->
 
37
<!--@@==========================================================================
 
38
db2html.classsynopsis.language
 
39
The default programming language used to format #{classsynopsis} elements
 
40
 
 
41
REMARK: Describe this param
 
42
-->
 
43
<xsl:param name="db2html.classsynopsis.language">
 
44
  <xsl:choose>
 
45
    <xsl:when test="/processing-instruction('db2html.classsynopsis.language')">
 
46
      <xsl:value-of
 
47
       select="/processing-instruction('db2html.classsynopsis.language')"/>
 
48
    </xsl:when>
 
49
    <xsl:otherwise>
 
50
      <xsl:value-of select="'cpp'"/>
 
51
    </xsl:otherwise>
 
52
  </xsl:choose>
 
53
</xsl:param>
 
54
 
 
55
 
 
56
<!-- == Matched Templates == -->
 
57
 
 
58
<!-- = *synopsis = -->
 
59
<xsl:template match="
 
60
              classsynopsis     | constructorsynopsis    | fieldsynopsis |
 
61
              methodsynopsis    | destructorsynopsis     |
 
62
              db:classsynopsis  | db:constructorsynopsis | db:fieldsynopsis |
 
63
              db:methodsynopsis | db:destructorsynopsis  |">
 
64
  <xsl:variable name="language">
 
65
    <xsl:choose>
 
66
      <xsl:when test="@language">
 
67
        <xsl:value-of select="@language"/>
 
68
      </xsl:when>
 
69
      <xsl:otherwise>
 
70
        <xsl:value-of select="$db2html.classsynopsis.language"/>
 
71
      </xsl:otherwise>
 
72
    </xsl:choose>
 
73
  </xsl:variable>
 
74
  <div>
 
75
    <xsl:choose>
 
76
      <xsl:when test="@lang | @xml:lang">
 
77
        <xsl:attribute name="dir">
 
78
          <xsl:call-template name="l10n.direction">
 
79
            <xsl:with-param name="lang" select="@lang | @xml:lang"/>
 
80
          </xsl:call-template>
 
81
        </xsl:attribute>
 
82
      </xsl:when>
 
83
      <xsl:otherwise>
 
84
        <xsl:attribute name="dir">
 
85
          <xsl:text>ltr</xsl:text>
 
86
        </xsl:attribute>
 
87
      </xsl:otherwise>
 
88
    </xsl:choose>
 
89
    <xsl:attribute name="class">
 
90
      <xsl:text>synopsis </xsl:text>
 
91
      <xsl:value-of select="local-name(.)"/>
 
92
    </xsl:attribute>
 
93
    <xsl:call-template name="db2html.anchor"/>
 
94
    <pre class="contents {local-name(.)} classsynopsis-{$language}">
 
95
      <xsl:choose>
 
96
        <xsl:when test="$language = 'cpp'">
 
97
          <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
98
        </xsl:when>
 
99
        <xsl:when test="$language = 'python'">
 
100
          <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
101
        </xsl:when>
 
102
        <xsl:otherwise>
 
103
          <xsl:message>
 
104
            <xsl:text>No information about the language '</xsl:text>
 
105
            <xsl:value-of select="$language"/>
 
106
            <xsl:text>' for classsynopsis.</xsl:text>
 
107
          </xsl:message>
 
108
        </xsl:otherwise>
 
109
      </xsl:choose>
 
110
    </pre>
 
111
  </div>
 
112
</xsl:template>
 
113
 
 
114
<!-- = classsynopsisinfo = -->
 
115
<xsl:template match="classsynopsisinfo | db:classsynopsisinfo">
 
116
  <xsl:apply-templates/>
 
117
  <!-- FIXME? -->
 
118
  <xsl:text>&#x000A;</xsl:text>
 
119
</xsl:template>
 
120
 
 
121
<!-- = methodparam = -->
 
122
<xsl:template match="methodparam | db:methodparam">
 
123
  <span class="methodparam">
 
124
    <xsl:for-each select="*">
 
125
      <xsl:if test="position() != 1">
 
126
        <xsl:text> </xsl:text>
 
127
      </xsl:if>
 
128
      <xsl:apply-templates select="."/>
 
129
    </xsl:for-each>
 
130
  </span>
 
131
</xsl:template>
 
132
 
 
133
<!--#* db2html.class.cpp.modifier -->
 
134
<xsl:template name="db2html.class.cpp.modifier">
 
135
  <!-- For C++, we expect the first modifier to be the visibility -->
 
136
  <xsl:variable name="prec" select="self::*[../self::classsynopsis]/preceding-sibling::constructorsynopsis |
 
137
                                    self::*[../self::classsynopsis]/preceding-sibling::destructorsynopsis  |
 
138
                                    self::*[../self::classsynopsis]/preceding-sibling::fieldsynopsis       |
 
139
                                    self::*[../self::classsynopsis]/preceding-sibling::methodsynopsis      |
 
140
                                    self::*[../self::db:classsynopsis]/preceding-sibling::db:constructorsynopsis |
 
141
                                    self::*[../self::db:classsynopsis]/preceding-sibling::db:destructorsynopsis  |
 
142
                                    self::*[../self::db:classsynopsis]/preceding-sibling::db:fieldsynopsis       |
 
143
                                    self::*[../self::db:classsynopsis]/preceding-sibling::db:methodsynopsis      "/>
 
144
  <xsl:choose>
 
145
    <xsl:when test="not($prec[modifier][last()][modifier[1] = current()/modifier[1]]) and
 
146
                    not($prec[db:modifier][last()][db:modifier[1] = current()/db:modifier[1]])">
 
147
      <xsl:if test="$prec"><xsl:text>&#x000A;</xsl:text></xsl:if>
 
148
      <xsl:apply-templates select="(modifier | db:modifier)[1]"/>
 
149
      <xsl:text>:&#x000A;</xsl:text>
 
150
    </xsl:when>
 
151
    <xsl:when test="$prec and (name($prec[last()]) != name(.))">
 
152
      <xsl:text>&#x000A;</xsl:text>
 
153
    </xsl:when>
 
154
  </xsl:choose>
 
155
</xsl:template>
 
156
 
 
157
 
 
158
<!--%%==========================================================================
 
159
db2html.class.cpp.mode
 
160
 
 
161
REMARK: Describe this mode
 
162
-->
 
163
<xsl:template mode="db2html.class.cpp.mode" match="*">
 
164
  <xsl:apply-templates select="."/>
 
165
</xsl:template>
 
166
 
 
167
<!-- = classsynopsis % db2html.class.cpp.mode = -->
 
168
<xsl:template mode="db2html.class.cpp.mode"
 
169
              match="classsynopsis | db:classsynopsis">
 
170
  <!-- classsynopsis = element classsynopsis {
 
171
         attribute language { ... }?,
 
172
         attribute class { ... }?,
 
173
         ooclass+,
 
174
         (classsynopsisinfo  | constructorsynopsis |
 
175
          destructorsynopsis | fieldsynopsis       |
 
176
          methodsynopsis     )
 
177
       }
 
178
  -->
 
179
  <xsl:if test="@class = 'class' or not(@class)">
 
180
    <span class="ooclass">
 
181
      <xsl:for-each select="ooclass[1]/modifier | db:ooclass[1]/db:modifier">
 
182
        <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
183
        <xsl:text> </xsl:text>
 
184
      </xsl:for-each>
 
185
      <xsl:text>class </xsl:text>
 
186
      <xsl:apply-templates mode="db2html.class.cpp.mode"
 
187
                           select="ooclass[1]/classname |
 
188
                                   db:ooclass[1]/db:classname"/>
 
189
    </span>
 
190
    <xsl:if test="ooclass[2] or db:ooclass[2]">
 
191
      <xsl:text> : </xsl:text>
 
192
      <xsl:for-each select="ooclass[position() != 1] |
 
193
                            db:ooclass[position() != 1]">
 
194
        <xsl:if test="position() != 1">
 
195
          <xsl:text>, </xsl:text>
 
196
        </xsl:if>
 
197
        <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
198
      </xsl:for-each>
 
199
    </xsl:if>
 
200
    <xsl:text>&#x000A;{&#x000A;</xsl:text>
 
201
    <xsl:apply-templates mode="db2html.class.cpp.mode"
 
202
                         select="
 
203
                           classsynopsisinfo      |
 
204
                           constructorsynopsis    | destructorsynopsis    |
 
205
                           fieldsynopsis          | methodsynopsis        |
 
206
                           db:classsynopsisinfo   |
 
207
                           db:constructorsynopsis | db:destructorsynopsis |
 
208
                           db:fieldsynopsis       | db:methodsynopsis     "/>
 
209
    <xsl:text>}&#x000A;</xsl:text>
 
210
  </xsl:if>
 
211
</xsl:template>
 
212
 
 
213
<!-- = constructorsynopsis % db2html.class.cpp.mode = -->
 
214
<xsl:template mode="db2html.class.cpp.mode"
 
215
              match="constructorsynopsis | db:constructorsynopsis">
 
216
  <!-- constructorsynopsis = element constructorsynopsis {
 
217
         attribute language { ... }?,
 
218
         modifier+,
 
219
         methodname?,
 
220
         (methodparam+ | void?)
 
221
       }
 
222
  -->
 
223
  <xsl:call-template name="db2html.class.cpp.modifier"/>
 
224
  <xsl:value-of select="$cpp.tab"/>
 
225
  <xsl:for-each select="modifier[position() != 1] | db:modifier[position() != 1]">
 
226
    <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
227
    <xsl:text> </xsl:text>
 
228
  </xsl:for-each>
 
229
  <xsl:choose>
 
230
    <xsl:when test="methodname or db:methodname">
 
231
      <xsl:apply-templates mode="db2html.class.cpp.mode"
 
232
                           select="methodname | db:methodname"/>
 
233
    </xsl:when>
 
234
    <xsl:when test="../self::classsynopsis[ooclass]">
 
235
      <span class="methodname">
 
236
        <xsl:value-of select="../ooclass/classname"/>
 
237
      </span>
 
238
    </xsl:when>
 
239
    <xsl:when test="../self::db:classsynopsis[db:ooclass]">
 
240
      <span class="methodname">
 
241
        <xsl:value-of select="../db:ooclass/db:classname"/>
 
242
      </span>
 
243
    </xsl:when>
 
244
  </xsl:choose>
 
245
  <xsl:text>(</xsl:text>
 
246
  <xsl:for-each select="methodparam | db:methodparam">
 
247
    <xsl:if test="position() != 1">
 
248
      <xsl:text>, </xsl:text>
 
249
    </xsl:if>
 
250
    <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
251
  </xsl:for-each>
 
252
  <xsl:text>);&#x000A;</xsl:text>
 
253
</xsl:template>
 
254
 
 
255
<!-- = destructorsynopsis % db2html.class.cpp.mode = -->
 
256
<xsl:template mode="db2html.class.cpp.mode"
 
257
              match="destructorsynopsis | db:destructorsynopsis">
 
258
  <!-- destructorsynopsis = element destructorsynopsis {
 
259
         attribute language { ... }?,
 
260
         modifier+,
 
261
         methodname?,
 
262
         (methodparam+ | void?)
 
263
       }
 
264
  -->
 
265
  <xsl:call-template name="db2html.class.cpp.modifier"/>
 
266
  <xsl:value-of select="$cpp.tab"/>
 
267
  <xsl:for-each select="modifier[position() != 1] | db:modifier[position() != 1]">
 
268
    <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
269
    <xsl:text> </xsl:text>
 
270
  </xsl:for-each>
 
271
  <xsl:choose>
 
272
    <xsl:when test="methodname">
 
273
      <xsl:apply-templates mode="db2html.class.cpp.mode"
 
274
                           select="methodname | db:methodname"/>
 
275
    </xsl:when>
 
276
    <xsl:when test="../self::classsynopsis[ooclass]">
 
277
      <span class="methodname">
 
278
        <xsl:text>~</xsl:text>
 
279
        <xsl:value-of select="../ooclass/classname"/>
 
280
      </span>
 
281
    </xsl:when>
 
282
    <xsl:when test="../self::db:classsynopsis[db:ooclass]">
 
283
      <span class="methodname">
 
284
        <xsl:value-of select="../db:ooclass/db:classname"/>
 
285
      </span>
 
286
    </xsl:when>
 
287
  </xsl:choose>
 
288
  <xsl:text>(</xsl:text>
 
289
  <xsl:for-each select="methodparam | db:methodparam">
 
290
    <!-- FIXME: should we do each methodparam on its own line? -->
 
291
    <xsl:if test="position() != 1">
 
292
      <xsl:text>, </xsl:text>
 
293
    </xsl:if>
 
294
    <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
295
  </xsl:for-each>
 
296
  <xsl:text>);&#x000A;</xsl:text>
 
297
</xsl:template>
 
298
 
 
299
<!-- = fieldsynopsis % db2html.class.cpp.mode = -->
 
300
<xsl:template mode="db2html.class.cpp.mode"
 
301
              match="fieldsynopsis | db:fieldsynopsis">
 
302
  <!-- fieldsynopsis = element fieldsynopsis {
 
303
         attribute language { ... }?,
 
304
         modifier+,
 
305
         type,
 
306
         varname,
 
307
         initializer?
 
308
       }
 
309
  -->
 
310
  <xsl:call-template name="db2html.class.cpp.modifier"/>
 
311
  <xsl:value-of select="$cpp.tab"/>
 
312
  <xsl:for-each select="modifier[position() != 1] | db:modifier[position() != 1]">
 
313
    <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
314
    <xsl:text> </xsl:text>
 
315
  </xsl:for-each>
 
316
  <xsl:if test="type or db:type">
 
317
    <xsl:apply-templates mode="db2html.class.cpp.mode" select="type | db:type"/>
 
318
    <xsl:text> </xsl:text>
 
319
  </xsl:if>
 
320
  <xsl:apply-templates mode="db2html.class.cpp.mode"
 
321
                       select="varname | db:varname"/>
 
322
  <xsl:if test="initializer or db:initializer">
 
323
    <xsl:text> = </xsl:text>
 
324
    <xsl:apply-templates mode="db2html.class.cpp.mode"
 
325
                         select="initializer | db:initializer"/>
 
326
  </xsl:if>
 
327
  <xsl:text>;&#x000A;</xsl:text>
 
328
</xsl:template>
 
329
 
 
330
<!-- = methodparam % db2html.class.cpp.mode = -->
 
331
<xsl:template mode="db2html.class.cpp.mode"
 
332
              match="methodparam | db:methodparam">
 
333
  <span class="methodparam">
 
334
    <xsl:for-each select="*">
 
335
      <xsl:if test="position() != 1">
 
336
        <xsl:text> </xsl:text>
 
337
      </xsl:if>
 
338
      <xsl:if test="self::initializer or self::db:initializer">
 
339
        <xsl:text>= </xsl:text>
 
340
      </xsl:if>
 
341
      <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
342
    </xsl:for-each>
 
343
  </span>
 
344
</xsl:template>
 
345
 
 
346
<!-- = methodsynopsis % db2html.class.cpp.mode = -->
 
347
<xsl:template mode="db2html.class.cpp.mode"
 
348
              match="methodsynopsis | db:methodsynopsis">
 
349
  <!-- methodsynopsis = element methodsynopsis {
 
350
         attribute language { ... }?,
 
351
         modifier+,
 
352
         (type | void),
 
353
         methodname,
 
354
         (methodparam+ | void?)
 
355
       }
 
356
  -->
 
357
  <xsl:call-template name="db2html.class.cpp.modifier"/>
 
358
  <xsl:value-of select="$cpp.tab"/>
 
359
  <!-- Parens for document order -->
 
360
  <xsl:for-each select="(methodname/preceding-sibling::modifier |
 
361
                         db:methodname/preceding-sibling::db:modifier)[position() != 1]">
 
362
    <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
363
    <xsl:text> </xsl:text>
 
364
  </xsl:for-each>
 
365
  <xsl:apply-templates mode="db2html.class.cpp.mode"
 
366
                       select="type | methodname/preceding-sibling::void |
 
367
                               db:type | db:methodname/preceding-sibling::db:void"/>
 
368
  <xsl:text> </xsl:text>
 
369
  <xsl:apply-templates mode="db2html.class.cpp.mode"
 
370
                       select="methodname | db:methodname"/>
 
371
  <xsl:text>(</xsl:text>
 
372
  <xsl:for-each select="methodparam | db:methodparam">
 
373
    <xsl:if test="position() != 1">
 
374
      <xsl:text>, </xsl:text>
 
375
    </xsl:if>
 
376
    <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
377
  </xsl:for-each>
 
378
  <xsl:text>)</xsl:text>
 
379
  <xsl:for-each select="methodname/following-sibling::modifier |
 
380
                        db:methodname/following-sibling::db:modifier">
 
381
    <xsl:text> </xsl:text>
 
382
    <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
 
383
  </xsl:for-each>
 
384
  <xsl:text>;&#x000A;</xsl:text>
 
385
</xsl:template>
 
386
 
 
387
 
 
388
<!--%%==========================================================================
 
389
db2html.class.python.mode
 
390
 
 
391
REMARK: Describe this mode
 
392
-->
 
393
<xsl:template mode="db2html.class.python.mode" match="*">
 
394
  <xsl:apply-templates select="."/>
 
395
</xsl:template>
 
396
 
 
397
<!-- = classsynopsis % db2html.class.python.mode = -->
 
398
<xsl:template mode="db2html.class.python.mode"
 
399
              match="classsynopsis | db:classsynopsis">
 
400
  <!-- classsynopsis = element classsynopsis {
 
401
         attribute language { ... }?,
 
402
         attribute class { ... }?,
 
403
         ooclass+,
 
404
         (classsynopsisinfo  | constructorsynopsis |
 
405
          destructorsynopsis | fieldsynopsis       |
 
406
          methodsynopsis     )
 
407
       }
 
408
  -->
 
409
  <xsl:if test="@class = 'class' or not(@class)">
 
410
    <xsl:text>class </xsl:text>
 
411
    <xsl:apply-templates mode="db2html.class.python.mode"
 
412
                         select="ooclass[1] | db:ooclass[1]"/>
 
413
    <xsl:if test="ooclass[2] or db:ooclass[2]">
 
414
      <xsl:text>(</xsl:text>
 
415
      <xsl:for-each select="(ooclass | db:ooclass)[position() != 1]">
 
416
        <xsl:if test="position() != 1">
 
417
          <xsl:text>, </xsl:text>
 
418
        </xsl:if>
 
419
        <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
420
      </xsl:for-each>
 
421
      <xsl:text>)</xsl:text>
 
422
    </xsl:if>
 
423
    <xsl:text>:&#x000A;</xsl:text>
 
424
    <xsl:for-each select="classsynopsisinfo     | constructorsynopsis    |
 
425
                          destructorsynopsis    | fieldsynopsis          |
 
426
                          methodsynopsis        |
 
427
                          db:classsynopsisinfo  | db:constructorsynopsis |
 
428
                          db:destructorsynopsis | db:fieldsynopsis       |
 
429
                          db:methodsynopsis     ">
 
430
      <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
431
      <xsl:if test="position() != last() and local-name(following-sibling::*[1]) != local-name(.)">
 
432
        <xsl:text>&#x000A;</xsl:text>
 
433
      </xsl:if>
 
434
    </xsl:for-each>
 
435
  </xsl:if>
 
436
</xsl:template>
 
437
 
 
438
<!-- = constructorsynopsis % db2html.class.python.mode = -->
 
439
<xsl:template mode="db2html.class.python.mode"
 
440
              match="constructorsynopsis | db:constructorsynopsis">
 
441
  <!-- constructorsynopsis = element constructorsynopsis {
 
442
         attribute language { ... }?,
 
443
         modifier+,
 
444
         methodname?,
 
445
         (methodparam+ | void?)
 
446
       }
 
447
  -->
 
448
  <xsl:variable name="tab">
 
449
    <xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
 
450
      <xsl:value-of select="$python.tab"/>
 
451
    </xsl:if>
 
452
  </xsl:variable>
 
453
  <xsl:for-each select="modifier | db:modifier">
 
454
    <xsl:value-of select="$tab"/>
 
455
    <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
456
    <xsl:text>&#x000A;</xsl:text>
 
457
  </xsl:for-each>
 
458
  <xsl:value-of select="$tab"/>
 
459
  <xsl:choose>
 
460
    <xsl:when test="methodname">
 
461
      <xsl:apply-templates mode="db2html.class.python.mode" select="methodname"/>
 
462
    </xsl:when>
 
463
    <xsl:when test="db:methodname">
 
464
      <xsl:apply-templates mode="db2html.class.python.mode" select="db:methodname"/>
 
465
    </xsl:when>
 
466
    <xsl:when test="../self::classsynopsis[ooclass]">
 
467
      <span class="methodname">
 
468
        <xsl:value-of select="../ooclass/classname"/>
 
469
      </span>
 
470
    </xsl:when>
 
471
    <xsl:when test="../self::db:classsynopsis[db:ooclass]">
 
472
      <span class="methodname">
 
473
        <xsl:value-of select="../db:ooclass/db:classname"/>
 
474
      </span>
 
475
    </xsl:when>
 
476
  </xsl:choose>
 
477
  <xsl:text>(</xsl:text>
 
478
  <xsl:for-each select="methodparam | db:methodparam">
 
479
    <xsl:if test="position() != 1">
 
480
      <xsl:text>, </xsl:text>
 
481
    </xsl:if>
 
482
    <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
483
  </xsl:for-each>
 
484
  <xsl:text>)</xsl:text>
 
485
  <xsl:if test="type or db:type">
 
486
    <xsl:text> -&gt; </xsl:text>
 
487
    <xsl:apply-templates mode="db2html.class.python.mode" select="type | db:type"/>
 
488
  </xsl:if>
 
489
  <xsl:text>&#x000A;</xsl:text>
 
490
</xsl:template>
 
491
 
 
492
<!-- = destructorsynopsis % db2html.class.python.mode = -->
 
493
<xsl:template mode="db2html.class.python.mode"
 
494
              match="destructorsynopsis | db:destructorsynopsis">
 
495
  <!-- destructorsynopsis = element destructorsynopsis {
 
496
         attribute language { ... }?,
 
497
         modifier+,
 
498
         methodname?,
 
499
         (methodparam+ | void?)
 
500
       }
 
501
  -->
 
502
  <xsl:variable name="tab">
 
503
    <xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
 
504
      <xsl:value-of select="$python.tab"/>
 
505
    </xsl:if>
 
506
  </xsl:variable>
 
507
  <xsl:for-each select="modifier | db:modifier">
 
508
    <xsl:value-of select="$tab"/>
 
509
    <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
510
    <xsl:text>&#x000A;</xsl:text>
 
511
  </xsl:for-each>
 
512
  <xsl:value-of select="$tab"/>
 
513
  <xsl:choose>
 
514
    <xsl:when test="methodname">
 
515
      <xsl:apply-templates mode="db2html.class.python.mode" select="methodname"/>
 
516
    </xsl:when>
 
517
    <xsl:when test="db:methodname">
 
518
      <xsl:apply-templates mode="db2html.class.python.mode" select="db:methodname"/>
 
519
    </xsl:when>
 
520
    <xsl:otherwise>
 
521
      <span class="methodname">
 
522
        <xsl:text>__del__</xsl:text>
 
523
      </span>
 
524
    </xsl:otherwise>
 
525
  </xsl:choose>
 
526
  <xsl:text>(</xsl:text>
 
527
  <xsl:for-each select="methodparam | db:methodparam">
 
528
    <xsl:if test="position() != 1">
 
529
      <xsl:text>, </xsl:text>
 
530
    </xsl:if>
 
531
    <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
532
  </xsl:for-each>
 
533
  <xsl:text>)</xsl:text>
 
534
  <xsl:if test="type or db:type">
 
535
    <xsl:text> -&gt; </xsl:text>
 
536
    <xsl:apply-templates mode="db2html.class.python.mode" select="type | db:type"/>
 
537
  </xsl:if>
 
538
  <xsl:text>&#x000A;</xsl:text>
 
539
</xsl:template>
 
540
 
 
541
<!-- = fieldsynopsis % db2html.class.python.mode = -->
 
542
<xsl:template mode="db2html.class.python.mode"
 
543
              match="fieldsynopsis | db:fieldsynopsis">
 
544
  <!-- fieldsynopsis = element fieldsynopsis {
 
545
         attribute language { ... }?,
 
546
         modifier+,
 
547
         type,
 
548
         varname,
 
549
         initializer?
 
550
       }
 
551
  -->
 
552
  <xsl:variable name="tab">
 
553
    <xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
 
554
      <xsl:value-of select="$python.tab"/>
 
555
    </xsl:if>
 
556
  </xsl:variable>
 
557
  <xsl:for-each select="modifier | db:modifier">
 
558
    <xsl:value-of select="$tab"/>
 
559
    <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
560
    <xsl:text>&#x000A;</xsl:text>
 
561
  </xsl:for-each>
 
562
  <xsl:value-of select="$tab"/>
 
563
  <xsl:apply-templates mode="db2html.class.python.mode"
 
564
                       select="varname | db:varname"/>
 
565
  <xsl:if test="initializer or db:initializer">
 
566
    <xsl:text>=</xsl:text>
 
567
    <xsl:apply-templates mode="db2html.class.python.mode"
 
568
                         select="initializer | db:initializer"/>
 
569
  </xsl:if>
 
570
  <xsl:text>&#x000A;</xsl:text>
 
571
</xsl:template>
 
572
 
 
573
<!-- = methodparam % db2html.class.python.mode = -->
 
574
<xsl:template mode="db2html.class.python.mode"
 
575
              match="methodparam | db:methodparam">
 
576
  <span class="methodparam">
 
577
    <xsl:apply-templates mode="db2html.class.python.mode"
 
578
                         select="parameter | db:parameter"/>
 
579
    <xsl:if test="modifier or type or db:modifier or db:type">
 
580
      <xsl:text>: </xsl:text>
 
581
      <xsl:apply-templates mode="db2html.class.python.mode"
 
582
                           select="(modifier | type | db:modifier | db:type)[1]"/>
 
583
      <xsl:if test="initializer or db:initializer">
 
584
        <xsl:text> </xsl:text>
 
585
      </xsl:if>
 
586
    </xsl:if>
 
587
    <xsl:if test="initializer or db:initializer">
 
588
      <xsl:text>=</xsl:text>
 
589
      <xsl:if test="modifier or type or db:modifier or db:type">
 
590
        <xsl:text> </xsl:text>
 
591
      </xsl:if>
 
592
      <xsl:apply-templates mode="db2html.class.python.mode"
 
593
                           select="initializer | db:initializer"/>
 
594
    </xsl:if>
 
595
  </span>
 
596
</xsl:template>
 
597
 
 
598
<!-- = methodsynopsis % db2html.class.python.mode = -->
 
599
<xsl:template mode="db2html.class.python.mode"
 
600
              match="methodsynopsis | db:methodsynopsis">
 
601
  <!-- methodsynopsis = element methodsynopsis {
 
602
         attribute language { ... }?,
 
603
         modifier+,
 
604
         (type | void),
 
605
         methodname,
 
606
         (methodparam+ | void?)
 
607
       }
 
608
  -->
 
609
  <xsl:variable name="tab">
 
610
    <xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
 
611
      <xsl:value-of select="$python.tab"/>
 
612
    </xsl:if>
 
613
  </xsl:variable>
 
614
  <xsl:for-each select="modifier | db:modifier">
 
615
    <xsl:value-of select="$tab"/>
 
616
    <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
617
    <xsl:text>&#x000A;</xsl:text>
 
618
  </xsl:for-each>
 
619
  <xsl:value-of select="$tab"/>
 
620
  <xsl:text>def </xsl:text>
 
621
  <xsl:apply-templates mode="db2html.class.python.mode"
 
622
                       select="methodname | db:methodname"/>
 
623
  <xsl:text>(</xsl:text>
 
624
  <xsl:for-each select="methodparam | db:methodparam">
 
625
    <xsl:if test="position() != 1">
 
626
      <xsl:text>, </xsl:text>
 
627
    </xsl:if>
 
628
    <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
 
629
  </xsl:for-each>
 
630
  <xsl:text>)</xsl:text>
 
631
  <xsl:if test="type or db:type">
 
632
    <xsl:text> -&gt; </xsl:text>
 
633
    <xsl:apply-templates mode="db2html.class.python.mode" select="type | db:type"/>
 
634
  </xsl:if>
 
635
  <xsl:text>&#x000A;</xsl:text>
 
636
</xsl:template>
 
637
 
 
638
</xsl:stylesheet>