1
<!-- Generate HTML documentation from the Telepathy specification.
2
The master copy of this stylesheet is in the Telepathy spec repository -
3
please make any changes there.
5
Copyright (C) 2006-2008 Collabora Limited
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 2.1 of the License, or (at your option) any later version.
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
23
xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
24
xmlns:html="http://www.w3.org/1999/xhtml"
25
exclude-result-prefixes="tp html">
26
<!--Don't move the declaration of the HTML namespace up here — XMLNSs
27
don't work ideally in the presence of two things that want to use the
28
absence of a prefix, sadly. -->
30
<xsl:param name="allow-undefined-interfaces" select="false()"/>
32
<xsl:template match="html:* | @*" mode="html">
34
<xsl:apply-templates mode="html"/>
38
<xsl:template match="tp:type" mode="html">
39
<xsl:call-template name="tp-type">
40
<xsl:with-param name="tp-type" select="string(.)"/>
44
<!-- tp:dbus-ref: reference a D-Bus interface, signal, method or property -->
45
<xsl:template match="tp:dbus-ref" mode="html">
46
<xsl:variable name="name">
48
<xsl:when test="@namespace">
49
<xsl:value-of select="@namespace"/>
50
<xsl:text>.</xsl:text>
53
<xsl:value-of select="string(.)"/>
57
<xsl:when test="//interface[@name=$name]
58
or //interface/method[concat(../@name, '.', @name)=$name]
59
or //interface/signal[concat(../@name, '.', @name)=$name]
60
or //interface/property[concat(../@name, '.', @name)=$name]
61
or //interface[@name=concat($name, '.DRAFT')]
62
or //interface/method[
63
concat(../@name, '.', @name)=concat($name, '.DRAFT')]
64
or //interface/signal[
65
concat(../@name, '.', @name)=concat($name, '.DRAFT')]
66
or //interface/property[
67
concat(../@name, '.', @name)=concat($name, '.DRAFT')]
69
<a xmlns="http://www.w3.org/1999/xhtml" href="#{$name}">
70
<xsl:value-of select="string(.)"/>
74
<xsl:when test="$allow-undefined-interfaces">
75
<span xmlns="http://www.w3.org/1999/xhtml" title="defined elsewhere">
76
<xsl:value-of select="string(.)"/>
81
<xsl:message terminate="yes">
82
<xsl:text>ERR: cannot find D-Bus interface, method, </xsl:text>
83
<xsl:text>signal or property called '</xsl:text>
84
<xsl:value-of select="$name"/>
85
<xsl:text>' </xsl:text>
91
<!-- tp:member-ref: reference a property of the current interface -->
92
<xsl:template match="tp:member-ref" mode="html">
93
<xsl:variable name="prefix" select="concat(ancestor::interface/@name,
95
<xsl:variable name="name" select="string(.)"/>
97
<xsl:if test="not(ancestor::interface)">
98
<xsl:message terminate="yes">
99
<xsl:text>ERR: Cannot use tp:member-ref when not in an</xsl:text>
100
<xsl:text> <interface> </xsl:text>
105
<xsl:when test="ancestor::interface/signal[@name=$name]"/>
106
<xsl:when test="ancestor::interface/method[@name=$name]"/>
107
<xsl:when test="ancestor::interface/property[@name=$name]"/>
109
<xsl:message terminate="yes">
110
<xsl:text>ERR: interface </xsl:text>
111
<xsl:value-of select="ancestor::interface/@name"/>
112
<xsl:text> has no signal/method/property called </xsl:text>
113
<xsl:value-of select="$name"/>
114
<xsl:text> </xsl:text>
119
<a xmlns="http://www.w3.org/1999/xhtml" href="#{$prefix}{$name}">
120
<xsl:value-of select="$name"/>
124
<xsl:template match="*" mode="identity">
126
<xsl:apply-templates mode="identity"/>
130
<xsl:template match="tp:docstring">
131
<xsl:apply-templates mode="html"/>
134
<xsl:template match="tp:added">
135
<p class="added" xmlns="http://www.w3.org/1999/xhtml">Added in
136
version <xsl:value-of select="@version"/>.
137
<xsl:apply-templates select="node()" mode="html"/></p>
140
<xsl:template match="tp:changed">
142
<xsl:when test="node()">
143
<p class="changed" xmlns="http://www.w3.org/1999/xhtml">Changed in
144
version <xsl:value-of select="@version"/>:
145
<xsl:apply-templates select="node()" mode="html"/></p>
148
<p class="changed">Changed in version
149
<xsl:value-of select="@version"/></p>
154
<xsl:template match="tp:deprecated">
155
<p class="deprecated" xmlns="http://www.w3.org/1999/xhtml">Deprecated
156
since version <xsl:value-of select="@version"/>.
157
<xsl:apply-templates select="node()" mode="html"/></p>
160
<xsl:template match="tp:rationale" mode="html">
161
<div xmlns="http://www.w3.org/1999/xhtml" class="rationale">
162
<xsl:apply-templates select="node()" mode="html"/>
166
<xsl:template match="tp:errors">
167
<h1 xmlns="http://www.w3.org/1999/xhtml">Errors</h1>
168
<xsl:apply-templates/>
171
<xsl:template match="tp:generic-types">
172
<h1 xmlns="http://www.w3.org/1999/xhtml">Generic types</h1>
173
<xsl:call-template name="do-types"/>
176
<xsl:template name="do-types">
177
<xsl:if test="tp:simple-type">
178
<h2 xmlns="http://www.w3.org/1999/xhtml">Simple types</h2>
179
<xsl:apply-templates select="tp:simple-type"/>
182
<xsl:if test="tp:enum">
183
<h2 xmlns="http://www.w3.org/1999/xhtml">Enumerated types:</h2>
184
<xsl:apply-templates select="tp:enum"/>
187
<xsl:if test="tp:flags">
188
<h2 xmlns="http://www.w3.org/1999/xhtml">Sets of flags:</h2>
189
<xsl:apply-templates select="tp:flags"/>
192
<xsl:if test="tp:struct">
193
<h2 xmlns="http://www.w3.org/1999/xhtml">Structure types</h2>
194
<xsl:apply-templates select="tp:struct"/>
197
<xsl:if test="tp:mapping">
198
<h2 xmlns="http://www.w3.org/1999/xhtml">Mapping types</h2>
199
<xsl:apply-templates select="tp:mapping"/>
202
<xsl:if test="tp:external-type">
203
<h2 xmlns="http://www.w3.org/1999/xhtml">Types defined elsewhere</h2>
204
<dl><xsl:apply-templates select="tp:external-type"/></dl>
208
<xsl:template match="tp:error">
209
<h2 xmlns="http://www.w3.org/1999/xhtml"><a name="{concat(../@namespace, '.', translate(@name, ' ', ''))}"></a><xsl:value-of select="concat(../@namespace, '.', translate(@name, ' ', ''))"/></h2>
210
<xsl:apply-templates select="tp:docstring"/>
211
<xsl:apply-templates select="tp:added"/>
212
<xsl:apply-templates select="tp:changed"/>
213
<xsl:apply-templates select="tp:deprecated"/>
216
<xsl:template match="/tp:spec/tp:copyright">
217
<div xmlns="http://www.w3.org/1999/xhtml">
218
<xsl:apply-templates mode="text"/>
221
<xsl:template match="/tp:spec/tp:license">
222
<div xmlns="http://www.w3.org/1999/xhtml" class="license">
223
<xsl:apply-templates mode="html"/>
227
<xsl:template match="tp:copyright"/>
228
<xsl:template match="tp:license"/>
230
<xsl:template match="interface">
231
<h1 xmlns="http://www.w3.org/1999/xhtml"><a name="{@name}"></a><xsl:value-of select="@name"/></h1>
233
<xsl:if test="@tp:causes-havoc">
234
<p xmlns="http://www.w3.org/1999/xhtml" class="causes-havoc">
235
This interface is <xsl:value-of select="@tp:causes-havoc"/>
236
and is likely to cause havoc to your API/ABI if bindings are generated.
237
Don't include it in libraries that care about compatibility.
241
<xsl:if test="tp:requires">
242
<p>Implementations of this interface must also implement:</p>
243
<ul xmlns="http://www.w3.org/1999/xhtml">
244
<xsl:for-each select="tp:requires">
245
<li><code><a href="#{@interface}"><xsl:value-of select="@interface"/></a></code></li>
250
<xsl:apply-templates select="tp:docstring" />
251
<xsl:apply-templates select="tp:added"/>
252
<xsl:apply-templates select="tp:changed"/>
253
<xsl:apply-templates select="tp:deprecated"/>
256
<xsl:when test="method">
257
<h2 xmlns="http://www.w3.org/1999/xhtml">Methods:</h2>
258
<xsl:apply-templates select="method"/>
261
<p xmlns="http://www.w3.org/1999/xhtml">Interface has no methods.</p>
266
<xsl:when test="signal">
267
<h2 xmlns="http://www.w3.org/1999/xhtml">Signals:</h2>
268
<xsl:apply-templates select="signal"/>
271
<p xmlns="http://www.w3.org/1999/xhtml">Interface has no signals.</p>
276
<xsl:when test="tp:property">
277
<h2 xmlns="http://www.w3.org/1999/xhtml">Telepathy Properties:</h2>
278
<p xmlns="http://www.w3.org/1999/xhtml">Accessed using the
279
<a href="#org.freedesktop.Telepathy.Properties">Telepathy
280
Properties</a> interface.</p>
281
<dl xmlns="http://www.w3.org/1999/xhtml">
282
<xsl:apply-templates select="tp:property"/>
286
<p xmlns="http://www.w3.org/1999/xhtml">Interface has no Telepathy
292
<xsl:when test="property">
293
<h2 xmlns="http://www.w3.org/1999/xhtml">D-Bus core Properties:</h2>
294
<p xmlns="http://www.w3.org/1999/xhtml">Accessed using the
295
org.freedesktop.DBus.Properties interface.</p>
296
<dl xmlns="http://www.w3.org/1999/xhtml">
297
<xsl:apply-templates select="property"/>
301
<p xmlns="http://www.w3.org/1999/xhtml">Interface has no D-Bus core
306
<xsl:call-template name="do-types"/>
310
<xsl:template match="tp:flags">
312
<xsl:if test="not(@name) or @name = ''">
313
<xsl:message terminate="yes">
314
<xsl:text>ERR: missing @name on a tp:flags type </xsl:text>
318
<xsl:if test="not(@type) or @type = ''">
319
<xsl:message terminate="yes">
320
<xsl:text>ERR: missing @type on tp:flags type</xsl:text>
321
<xsl:value-of select="@name"/>
322
<xsl:text> </xsl:text>
327
<a name="type-{@name}">
328
<xsl:value-of select="@name"/>
331
<xsl:apply-templates select="tp:docstring" />
332
<xsl:apply-templates select="tp:added"/>
333
<xsl:apply-templates select="tp:changed"/>
334
<xsl:apply-templates select="tp:deprecated"/>
335
<dl xmlns="http://www.w3.org/1999/xhtml">
336
<xsl:variable name="value-prefix">
338
<xsl:when test="@value-prefix">
339
<xsl:value-of select="@value-prefix"/>
342
<xsl:value-of select="@name"/>
346
<xsl:for-each select="tp:flag">
347
<dt xmlns="http://www.w3.org/1999/xhtml"><code><xsl:value-of select="concat($value-prefix, '_', @suffix)"/> = <xsl:value-of select="@value"/></code></dt>
349
<xsl:when test="tp:docstring">
350
<dd xmlns="http://www.w3.org/1999/xhtml">
351
<xsl:apply-templates select="tp:docstring" />
352
<xsl:apply-templates select="tp:added"/>
353
<xsl:apply-templates select="tp:changed"/>
354
<xsl:apply-templates select="tp:deprecated"/>
358
<dd xmlns="http://www.w3.org/1999/xhtml">(Undocumented)</dd>
365
<xsl:template match="tp:enum">
367
<xsl:if test="not(@name) or @name = ''">
368
<xsl:message terminate="yes">
369
<xsl:text>ERR: missing @name on a tp:enum type </xsl:text>
373
<xsl:if test="not(@type) or @type = ''">
374
<xsl:message terminate="yes">
375
<xsl:text>ERR: missing @type on tp:enum type</xsl:text>
376
<xsl:value-of select="@name"/>
377
<xsl:text> </xsl:text>
381
<h3 xmlns="http://www.w3.org/1999/xhtml">
382
<a name="type-{@name}">
383
<xsl:value-of select="@name"/>
386
<xsl:apply-templates select="tp:docstring" />
387
<xsl:apply-templates select="tp:added"/>
388
<xsl:apply-templates select="tp:changed"/>
389
<xsl:apply-templates select="tp:deprecated"/>
390
<dl xmlns="http://www.w3.org/1999/xhtml">
391
<xsl:variable name="value-prefix">
393
<xsl:when test="@value-prefix">
394
<xsl:value-of select="@value-prefix"/>
397
<xsl:value-of select="@name"/>
401
<xsl:for-each select="tp:enumvalue">
402
<dt xmlns="http://www.w3.org/1999/xhtml"><code><xsl:value-of select="concat($value-prefix, '_', @suffix)"/> = <xsl:value-of select="@value"/></code></dt>
404
<xsl:when test="tp:docstring">
405
<dd xmlns="http://www.w3.org/1999/xhtml">
406
<xsl:apply-templates select="tp:docstring" />
407
<xsl:apply-templates select="tp:added"/>
408
<xsl:apply-templates select="tp:changed"/>
409
<xsl:apply-templates select="tp:deprecated"/>
413
<dd xmlns="http://www.w3.org/1999/xhtml">(Undocumented)</dd>
420
<xsl:template match="property">
422
<xsl:if test="not(parent::interface)">
423
<xsl:message terminate="yes">
424
<xsl:text>ERR: property </xsl:text>
425
<xsl:value-of select="@name"/>
426
<xsl:text> does not have an interface as parent </xsl:text>
430
<xsl:if test="not(@name) or @name = ''">
431
<xsl:message terminate="yes">
432
<xsl:text>ERR: missing @name on a property of </xsl:text>
433
<xsl:value-of select="../@name"/>
434
<xsl:text> </xsl:text>
438
<xsl:if test="not(@type) or @type = ''">
439
<xsl:message terminate="yes">
440
<xsl:text>ERR: missing @type on property </xsl:text>
441
<xsl:value-of select="concat(../@name, '.', @name)"/>
442
<xsl:text>: '</xsl:text>
443
<xsl:value-of select="@access"/>
444
<xsl:text>' </xsl:text>
448
<dt xmlns="http://www.w3.org/1999/xhtml">
449
<a name="{concat(../@name, '.', @name)}">
450
<code><xsl:value-of select="@name"/></code>
452
<xsl:text> − </xsl:text>
453
<code><xsl:value-of select="@type"/></code>
454
<xsl:call-template name="parenthesized-tp-type"/>
455
<xsl:text>, </xsl:text>
457
<xsl:when test="@access = 'read'">
458
<xsl:text>read-only</xsl:text>
460
<xsl:when test="@access = 'write'">
461
<xsl:text>write-only</xsl:text>
463
<xsl:when test="@access = 'readwrite'">
464
<xsl:text>read/write</xsl:text>
467
<xsl:message terminate="yes">
468
<xsl:text>ERR: unknown or missing value for </xsl:text>
469
<xsl:text>@access on property </xsl:text>
470
<xsl:value-of select="concat(../@name, '.', @name)"/>
471
<xsl:text>: '</xsl:text>
472
<xsl:value-of select="@access"/>
473
<xsl:text>' </xsl:text>
478
<dd xmlns="http://www.w3.org/1999/xhtml">
479
<xsl:apply-templates select="tp:docstring"/>
480
<xsl:apply-templates select="tp:added"/>
481
<xsl:apply-templates select="tp:changed"/>
482
<xsl:apply-templates select="tp:deprecated"/>
486
<xsl:template match="tp:property">
487
<dt xmlns="http://www.w3.org/1999/xhtml">
488
<xsl:if test="@name">
489
<code><xsl:value-of select="@name"/></code> −
491
<code><xsl:value-of select="@type"/></code>
493
<dd xmlns="http://www.w3.org/1999/xhtml">
494
<xsl:apply-templates select="tp:docstring"/>
495
<xsl:apply-templates select="tp:added"/>
496
<xsl:apply-templates select="tp:changed"/>
497
<xsl:apply-templates select="tp:deprecated"/>
501
<xsl:template match="tp:mapping">
502
<div xmlns="http://www.w3.org/1999/xhtml" class="struct">
504
<a name="type-{@name}">
505
<xsl:value-of select="@name"/>
507
<xsl:for-each select="tp:member">
508
<xsl:value-of select="@type"/>
509
<xsl:text>: </xsl:text>
510
<xsl:value-of select="@name"/>
511
<xsl:if test="position() != last()"> → </xsl:if>
515
<div class="docstring">
516
<xsl:apply-templates select="tp:docstring"/>
517
<xsl:if test="string(@array-name) != ''">
518
<p>In bindings that need a separate name, arrays of
519
<xsl:value-of select="@name"/> should be called
520
<xsl:value-of select="@array-name"/>.</p>
526
<xsl:apply-templates select="tp:member" mode="members-in-docstring"/>
532
<xsl:template match="tp:docstring" mode="in-index"/>
534
<xsl:template match="tp:simple-type | tp:enum | tp:flags | tp:external-type"
536
− <xsl:value-of select="@type"/>
539
<xsl:template match="tp:simple-type">
541
<xsl:if test="not(@name) or @name = ''">
542
<xsl:message terminate="yes">
543
<xsl:text>ERR: missing @name on a tp:simple-type </xsl:text>
547
<xsl:if test="not(@type) or @type = ''">
548
<xsl:message terminate="yes">
549
<xsl:text>ERR: missing @type on tp:simple-type</xsl:text>
550
<xsl:value-of select="@name"/>
551
<xsl:text> </xsl:text>
555
<div xmlns="http://www.w3.org/1999/xhtml" class="simple-type">
557
<a name="type-{@name}">
558
<xsl:value-of select="@name"/>
559
</a> − <xsl:value-of select="@type"/>
561
<div class="docstring">
562
<xsl:apply-templates select="tp:docstring"/>
563
<xsl:apply-templates select="tp:added"/>
564
<xsl:apply-templates select="tp:changed"/>
565
<xsl:apply-templates select="tp:deprecated"/>
570
<xsl:template match="tp:external-type">
572
<xsl:if test="not(@name) or @name = ''">
573
<xsl:message terminate="yes">
574
<xsl:text>ERR: missing @name on a tp:external-type </xsl:text>
578
<xsl:if test="not(@type) or @type = ''">
579
<xsl:message terminate="yes">
580
<xsl:text>ERR: missing @type on tp:external-type</xsl:text>
581
<xsl:value-of select="@name"/>
582
<xsl:text> </xsl:text>
586
<div xmlns="http://www.w3.org/1999/xhtml" class="external-type">
588
<a name="type-{@name}">
589
<xsl:value-of select="@name"/>
590
</a> − <xsl:value-of select="@type"/>
592
<dd>Defined by: <xsl:value-of select="@from"/></dd>
596
<xsl:template match="tp:struct" mode="in-index">
597
− ( <xsl:for-each select="tp:member">
598
<xsl:value-of select="@type"/>
599
<xsl:if test="position() != last()">, </xsl:if>
603
<xsl:template match="tp:mapping" mode="in-index">
604
− a{ <xsl:for-each select="tp:member">
605
<xsl:value-of select="@type"/>
606
<xsl:if test="position() != last()"> → </xsl:if>
610
<xsl:template match="tp:struct">
611
<div xmlns="http://www.w3.org/1999/xhtml" class="struct">
613
<a name="type-{@name}">
614
<xsl:value-of select="@name"/>
616
<xsl:for-each select="tp:member">
617
<xsl:value-of select="@type"/>
618
<xsl:text>: </xsl:text>
619
<xsl:value-of select="@name"/>
620
<xsl:if test="position() != last()">, </xsl:if>
624
<div class="docstring">
625
<xsl:apply-templates select="tp:docstring"/>
626
<xsl:apply-templates select="tp:added"/>
627
<xsl:apply-templates select="tp:changed"/>
628
<xsl:apply-templates select="tp:deprecated"/>
631
<xsl:when test="string(@array-name) != ''">
632
<p>In bindings that need a separate name, arrays of
633
<xsl:value-of select="@name"/> should be called
634
<xsl:value-of select="@array-name"/>.</p>
637
<p>Arrays of <xsl:value-of select="@name"/> don't generally
644
<xsl:apply-templates select="tp:member" mode="members-in-docstring"/>
650
<xsl:template match="method">
652
<xsl:if test="not(parent::interface)">
653
<xsl:message terminate="yes">
654
<xsl:text>ERR: method </xsl:text>
655
<xsl:value-of select="@name"/>
656
<xsl:text> does not have an interface as parent </xsl:text>
660
<xsl:if test="not(@name) or @name = ''">
661
<xsl:message terminate="yes">
662
<xsl:text>ERR: missing @name on a method of </xsl:text>
663
<xsl:value-of select="../@name"/>
664
<xsl:text> </xsl:text>
668
<xsl:for-each select="arg">
669
<xsl:if test="not(@type) or @type = ''">
670
<xsl:message terminate="yes">
671
<xsl:text>ERR: an arg of method </xsl:text>
672
<xsl:value-of select="concat(../../@name, '.', ../@name)"/>
673
<xsl:text> has no type</xsl:text>
677
<xsl:when test="@direction='in'">
678
<xsl:if test="not(@name) or @name = ''">
679
<xsl:message terminate="yes">
680
<xsl:text>ERR: an 'in' arg of method </xsl:text>
681
<xsl:value-of select="concat(../../@name, '.', ../@name)"/>
682
<xsl:text> has no name</xsl:text>
686
<xsl:when test="@direction='out'">
687
<!-- FIXME: This is commented out until someone with a lot of time
688
on their hands goes through the spec adding names to all the "out"
691
<xsl:if test="not(@name) or @name = ''">
692
<xsl:message terminate="no">
693
<xsl:text>INFO: an 'out' arg of method </xsl:text>
694
<xsl:value-of select="concat(../../@name, '.', ../@name)"/>
695
<xsl:text> has no name</xsl:text>
700
<xsl:message terminate="yes">
701
<xsl:text>ERR: an arg of method </xsl:text>
702
<xsl:value-of select="concat(../../@name, '.', ../@name)"/>
703
<xsl:text> has direction neither 'in' nor 'out'</xsl:text>
709
<div xmlns="http://www.w3.org/1999/xhtml" class="method">
710
<h3 xmlns="http://www.w3.org/1999/xhtml">
711
<a name="{concat(../@name, concat('.', @name))}">
712
<xsl:value-of select="@name"/>
714
<xsl:for-each xmlns="" select="arg[@direction='in']">
715
<xsl:value-of select="@type"/>: <xsl:value-of select="@name"/>
716
<xsl:if test="position() != last()">, </xsl:if>
720
<xsl:when test="arg[@direction='out']">
721
<xsl:for-each xmlns="" select="arg[@direction='out']">
722
<xsl:value-of select="@type"/>
723
<xsl:if test="position() != last()">, </xsl:if>
726
<xsl:otherwise>nothing</xsl:otherwise>
729
<div xmlns="http://www.w3.org/1999/xhtml" class="docstring">
730
<xsl:apply-templates select="tp:docstring" />
731
<xsl:apply-templates select="tp:added"/>
732
<xsl:apply-templates select="tp:changed"/>
733
<xsl:apply-templates select="tp:deprecated"/>
736
<xsl:if test="arg[@direction='in']">
737
<div xmlns="http://www.w3.org/1999/xhtml">
739
<dl xmlns="http://www.w3.org/1999/xhtml">
740
<xsl:apply-templates select="arg[@direction='in']"
741
mode="parameters-in-docstring"/>
746
<xsl:if test="arg[@direction='out']">
747
<div xmlns="http://www.w3.org/1999/xhtml">
749
<dl xmlns="http://www.w3.org/1999/xhtml">
750
<xsl:apply-templates select="arg[@direction='out']"
751
mode="returns-in-docstring"/>
756
<xsl:if test="tp:possible-errors">
757
<div xmlns="http://www.w3.org/1999/xhtml">
758
<h4>Possible errors</h4>
759
<dl xmlns="http://www.w3.org/1999/xhtml">
760
<xsl:apply-templates select="tp:possible-errors/tp:error"/>
768
<xsl:template name="tp-type">
769
<xsl:param name="tp-type"/>
770
<xsl:param name="type"/>
772
<xsl:variable name="single-type">
774
<xsl:when test="contains($tp-type, '[]')">
775
<xsl:value-of select="substring-before($tp-type, '[]')"/>
778
<xsl:value-of select="$tp-type"/>
783
<xsl:variable name="type-of-tp-type">
784
<xsl:if test="contains($tp-type, '[]')">
785
<!-- one 'a', plus one for each [ after the [], and delete all ] -->
786
<xsl:value-of select="concat('a',
787
translate(substring-after($tp-type, '[]'), '[]', 'a'))"/>
791
<xsl:when test="//tp:simple-type[@name=$single-type]">
792
<xsl:value-of select="string(//tp:simple-type[@name=$single-type]/@type)"/>
794
<xsl:when test="//tp:struct[@name=$single-type]">
795
<xsl:text>(</xsl:text>
796
<xsl:for-each select="//tp:struct[@name=$single-type]/tp:member">
797
<xsl:value-of select="@type"/>
799
<xsl:text>)</xsl:text>
801
<xsl:when test="//tp:enum[@name=$single-type]">
802
<xsl:value-of select="string(//tp:enum[@name=$single-type]/@type)"/>
804
<xsl:when test="//tp:flags[@name=$single-type]">
805
<xsl:value-of select="string(//tp:flags[@name=$single-type]/@type)"/>
807
<xsl:when test="//tp:mapping[@name=$single-type]">
808
<xsl:text>a{</xsl:text>
809
<xsl:for-each select="//tp:mapping[@name=$single-type]/tp:member">
810
<xsl:value-of select="@type"/>
812
<xsl:text>}</xsl:text>
814
<xsl:when test="//tp:external-type[@name=$single-type]">
815
<xsl:value-of select="string(//tp:external-type[@name=$single-type]/@type)"/>
818
<xsl:message terminate="yes">
819
<xsl:text>ERR: Unable to find type '</xsl:text>
820
<xsl:value-of select="$tp-type"/>
821
<xsl:text>' </xsl:text>
827
<xsl:if test="string($type) != '' and
828
string($type-of-tp-type) != string($type)">
829
<xsl:message terminate="yes">
830
<xsl:text>ERR: tp:type '</xsl:text>
831
<xsl:value-of select="$tp-type"/>
832
<xsl:text>' has D-Bus type '</xsl:text>
833
<xsl:value-of select="$type-of-tp-type"/>
834
<xsl:text>' but has been used with type='</xsl:text>
835
<xsl:value-of select="$type"/>
836
<xsl:text>' </xsl:text>
840
<a href="#type-{$single-type}"><xsl:value-of select="$tp-type"/></a>
844
<xsl:template name="parenthesized-tp-type">
845
<xsl:if test="@tp:type">
846
<xsl:text> (</xsl:text>
847
<xsl:call-template name="tp-type">
848
<xsl:with-param name="tp-type" select="@tp:type"/>
849
<xsl:with-param name="type" select="@type"/>
851
<xsl:text>)</xsl:text>
855
<xsl:template match="tp:member" mode="members-in-docstring">
856
<dt xmlns="http://www.w3.org/1999/xhtml">
857
<code><xsl:value-of select="@name"/></code> −
858
<code><xsl:value-of select="@type"/></code>
859
<xsl:call-template name="parenthesized-tp-type"/>
861
<dd xmlns="http://www.w3.org/1999/xhtml">
863
<xsl:when test="tp:docstring">
864
<xsl:apply-templates select="tp:docstring" />
867
<em>(undocumented)</em>
873
<xsl:template match="arg" mode="parameters-in-docstring">
874
<dt xmlns="http://www.w3.org/1999/xhtml">
875
<code><xsl:value-of select="@name"/></code> −
876
<code><xsl:value-of select="@type"/></code>
877
<xsl:call-template name="parenthesized-tp-type"/>
879
<dd xmlns="http://www.w3.org/1999/xhtml">
880
<xsl:apply-templates select="tp:docstring" />
884
<xsl:template match="arg" mode="returns-in-docstring">
885
<dt xmlns="http://www.w3.org/1999/xhtml">
886
<xsl:if test="@name">
887
<code><xsl:value-of select="@name"/></code> −
889
<code><xsl:value-of select="@type"/></code>
890
<xsl:call-template name="parenthesized-tp-type"/>
892
<dd xmlns="http://www.w3.org/1999/xhtml">
893
<xsl:apply-templates select="tp:docstring"/>
897
<xsl:template match="tp:possible-errors/tp:error">
898
<dt xmlns="http://www.w3.org/1999/xhtml">
899
<code><xsl:value-of select="@name"/></code>
901
<dd xmlns="http://www.w3.org/1999/xhtml">
902
<xsl:variable name="name" select="@name"/>
904
<xsl:when test="tp:docstring">
905
<xsl:apply-templates select="tp:docstring"/>
907
<xsl:when test="//tp:errors/tp:error[concat(../@namespace, '.', translate(@name, ' ', ''))=$name]/tp:docstring">
908
<xsl:apply-templates select="//tp:errors/tp:error[concat(../@namespace, '.', translate(@name, ' ', ''))=$name]/tp:docstring"/> <em xmlns="http://www.w3.org/1999/xhtml">(generic description)</em>
917
<xsl:template match="signal">
919
<xsl:if test="not(parent::interface)">
920
<xsl:message terminate="yes">
921
<xsl:text>ERR: signal </xsl:text>
922
<xsl:value-of select="@name"/>
923
<xsl:text> does not have an interface as parent </xsl:text>
927
<xsl:if test="not(@name) or @name = ''">
928
<xsl:message terminate="yes">
929
<xsl:text>ERR: missing @name on a signal of </xsl:text>
930
<xsl:value-of select="../@name"/>
931
<xsl:text> </xsl:text>
935
<xsl:for-each select="arg">
936
<xsl:if test="not(@type) or @type = ''">
937
<xsl:message terminate="yes">
938
<xsl:text>ERR: an arg of signal </xsl:text>
939
<xsl:value-of select="concat(../../@name, '.', ../@name)"/>
940
<xsl:text> has no type</xsl:text>
943
<xsl:if test="not(@name) or @name = ''">
944
<xsl:message terminate="yes">
945
<xsl:text>ERR: an arg of signal </xsl:text>
946
<xsl:value-of select="concat(../../@name, '.', ../@name)"/>
947
<xsl:text> has no name</xsl:text>
951
<xsl:when test="not(@direction)"/>
952
<xsl:when test="@direction='in'">
953
<xsl:message terminate="no">
954
<xsl:text>INFO: an arg of signal </xsl:text>
955
<xsl:value-of select="concat(../../@name, '.', ../@name)"/>
956
<xsl:text> has unnecessary direction 'in'</xsl:text>
960
<xsl:message terminate="yes">
961
<xsl:text>ERR: an arg of signal </xsl:text>
962
<xsl:value-of select="concat(../../@name, '.', ../@name)"/>
963
<xsl:text> has direction other than 'in'</xsl:text>
969
<div xmlns="http://www.w3.org/1999/xhtml" class="signal">
970
<h3 xmlns="http://www.w3.org/1999/xhtml">
971
<a name="{concat(../@name, concat('.', @name))}">
972
<xsl:value-of select="@name"/>
974
<xsl:for-each xmlns="" select="arg">
975
<xsl:value-of select="@type"/>: <xsl:value-of select="@name"/>
976
<xsl:if test="position() != last()">, </xsl:if>
980
<div xmlns="http://www.w3.org/1999/xhtml" class="docstring">
981
<xsl:apply-templates select="tp:docstring"/>
982
<xsl:apply-templates select="tp:added"/>
983
<xsl:apply-templates select="tp:changed"/>
984
<xsl:apply-templates select="tp:deprecated"/>
988
<div xmlns="http://www.w3.org/1999/xhtml">
990
<dl xmlns="http://www.w3.org/1999/xhtml">
991
<xsl:apply-templates select="arg" mode="parameters-in-docstring"/>
998
<xsl:output method="xml" indent="no" encoding="ascii"
999
omit-xml-declaration="yes"
1000
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
1001
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
1003
<xsl:template match="/tp:spec">
1004
<html xmlns="http://www.w3.org/1999/xhtml">
1007
<xsl:value-of select="tp:title"/>
1008
<xsl:if test="tp:version">
1009
<xsl:text> version </xsl:text>
1010
<xsl:value-of select="tp:version"/>
1013
<style type="text/css">
1016
font-family: sans-serif;
1023
padding-bottom: 5px;
1025
background: #dadae2;
1033
a:link, a:visited, a:link:hover, a:visited:hover {
1039
border-bottom: black solid 1px;
1040
padding-bottom: 10px;
1041
background: #dadae2;
1049
padding-bottom: 5px;
1050
background: #abacba;
1051
border-bottom: black solid 1px;
1056
font-weight: normal;
1061
border-right:#abacba solid 1px;
1062
border-left: #abacba solid 1px;
1064
border: #abacba solid 1px;
1067
padding-right: 10px;
1070
background: #dadae2;
1073
text-decoration: none;
1074
border-bottom: #e29625 dotted 1px;
1076
font-weight: normal;
1084
padding-bottom: 10px;
1085
border-bottom: #abacba solid 1px;
1089
padding-bottom: 2px;
1096
font-weight: normal;
1103
.method, .signal, .property {
1109
border-left: 0.25em solid #808080;
1110
padding-left: 0.5em;
1115
background: #ffffff;
1119
background: #ffffff;
1122
border: 1px solid #666;
1129
<xsl:value-of select="tp:title" />
1131
<xsl:if test="tp:version">
1132
<h2>Version <xsl:value-of select="string(tp:version)"/></h2>
1134
<xsl:apply-templates select="tp:copyright"/>
1135
<xsl:apply-templates select="tp:license"/>
1136
<xsl:apply-templates select="tp:docstring"/>
1140
<xsl:for-each select="//node/interface">
1141
<li><code><a href="#{@name}"><xsl:value-of select="@name"/></a></code></li>
1145
<xsl:apply-templates select="//node"/>
1146
<xsl:apply-templates select="tp:generic-types"/>
1147
<xsl:apply-templates select="tp:errors"/>
1150
<h2>Index of interfaces</h2>
1152
<xsl:for-each select="//node/interface">
1153
<li><code><a href="#{@name}"><xsl:value-of select="@name"/></a></code></li>
1156
<h2>Index of types</h2>
1158
<xsl:for-each select="//tp:simple-type | //tp:enum | //tp:flags | //tp:mapping | //tp:struct | //tp:external-type">
1159
<xsl:sort select="@name"/>
1162
<a href="#type-{@name}">
1163
<xsl:value-of select="@name"/>
1166
<xsl:apply-templates mode="in-index" select="."/>
1174
<xsl:template match="node">
1175
<xsl:apply-templates />
1178
<xsl:template match="text()">
1179
<xsl:if test="normalize-space(.) != ''">
1180
<xsl:message terminate="yes">
1181
<xsl:text>Stray text: {{{</xsl:text>
1182
<xsl:value-of select="." />
1183
<xsl:text>}}} </xsl:text>
1188
<xsl:template match="*">
1189
<xsl:message terminate="yes">
1190
<xsl:text>Unrecognised element: {</xsl:text>
1191
<xsl:value-of select="namespace-uri(.)" />
1192
<xsl:text>}</xsl:text>
1193
<xsl:value-of select="local-name(.)" />
1194
<xsl:text> </xsl:text>
1199
<!-- vim:set sw=2 sts=2 et: -->