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, 2007 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
Library 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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
exclude-result-prefixes="tp">
25
<!--Don't move the declaration of the HTML namespace up here - XMLNSs
26
don't work ideally in the presence of two things that want to use the
27
absence of a prefix, sadly. -->
29
<xsl:template match="*" mode="identity">
31
<xsl:apply-templates mode="identity"/>
35
<xsl:template match="tp:docstring">
36
<xsl:apply-templates select="node()" mode="identity"/>
39
<xsl:template match="tp:errors">
40
<h1 xmlns="http://www.w3.org/1999/xhtml">Errors</h1>
41
<xsl:apply-templates/>
44
<xsl:template match="tp:generic-types">
45
<h1 xmlns="http://www.w3.org/1999/xhtml">Generic types</h1>
46
<xsl:call-template name="do-types"/>
49
<xsl:template name="do-types">
50
<xsl:if test="tp:simple-type">
51
<h2 xmlns="http://www.w3.org/1999/xhtml">Simple types</h2>
52
<xsl:apply-templates select="tp:simple-type"/>
55
<xsl:if test="tp:enum">
56
<h2 xmlns="http://www.w3.org/1999/xhtml">Enumerated types:</h2>
57
<xsl:apply-templates select="tp:enum"/>
60
<xsl:if test="tp:flags">
61
<h2 xmlns="http://www.w3.org/1999/xhtml">Sets of flags:</h2>
62
<xsl:apply-templates select="tp:flags"/>
65
<xsl:if test="tp:struct">
66
<h2 xmlns="http://www.w3.org/1999/xhtml">Structure types</h2>
67
<xsl:apply-templates select="tp:struct"/>
70
<xsl:if test="tp:mapping">
71
<h2 xmlns="http://www.w3.org/1999/xhtml">Mapping types</h2>
72
<xsl:apply-templates select="tp:mapping"/>
75
<xsl:if test="tp:external-type">
76
<h2 xmlns="http://www.w3.org/1999/xhtml">Types defined elsewhere</h2>
77
<dl><xsl:apply-templates select="tp:external-type"/></dl>
81
<xsl:template match="tp:error">
82
<h2 xmlns="http://www.w3.org/1999/xhtml"><a name="{concat(../@namespace, '.', translate(@name, ' ', ''))}"></a><xsl:value-of select="concat(../@namespace, '.', translate(@name, ' ', ''))"/></h2>
83
<xsl:apply-templates select="tp:docstring"/>
86
<xsl:template match="/tp:spec/tp:copyright">
87
<div xmlns="http://www.w3.org/1999/xhtml">
88
<xsl:apply-templates/>
91
<xsl:template match="/tp:spec/tp:license">
92
<div xmlns="http://www.w3.org/1999/xhtml" class="license">
93
<xsl:apply-templates mode="identity"/>
97
<xsl:template match="tp:copyright"/>
98
<xsl:template match="tp:license"/>
100
<xsl:template match="interface">
101
<h1 xmlns="http://www.w3.org/1999/xhtml"><a name="{@name}"></a><xsl:value-of select="@name"/></h1>
103
<xsl:if test="@tp:causes-havoc">
104
<p xmlns="http://www.w3.org/1999/xhtml" class="causes-havoc">
105
This interface is <xsl:value-of select="@tp:causes-havoc"/>
106
and is likely to cause havoc to your API/ABI if bindings are generated.
107
Don't include it in libraries that care about compatibility.
111
<xsl:if test="tp:requires">
112
<p>Implementations of this interface must also implement:</p>
113
<ul xmlns="http://www.w3.org/1999/xhtml">
114
<xsl:for-each select="tp:requires">
115
<li><code><a href="#{@interface}"><xsl:value-of select="@interface"/></a></code></li>
120
<xsl:apply-templates select="tp:docstring" />
123
<xsl:when test="method">
124
<h2 xmlns="http://www.w3.org/1999/xhtml">Methods:</h2>
125
<xsl:apply-templates select="method"/>
128
<p xmlns="http://www.w3.org/1999/xhtml">Interface has no methods.</p>
133
<xsl:when test="signal">
134
<h2 xmlns="http://www.w3.org/1999/xhtml">Signals:</h2>
135
<xsl:apply-templates select="signal"/>
138
<p xmlns="http://www.w3.org/1999/xhtml">Interface has no signals.</p>
143
<xsl:when test="tp:property">
144
<h2 xmlns="http://www.w3.org/1999/xhtml">Properties:</h2>
145
<dl xmlns="http://www.w3.org/1999/xhtml">
146
<xsl:apply-templates select="tp:property"/>
150
<p xmlns="http://www.w3.org/1999/xhtml">Interface has no properties.</p>
154
<xsl:call-template name="do-types"/>
158
<xsl:template match="tp:flags">
160
<a name="type-{@name}">
161
<xsl:value-of select="@name"/>
164
<xsl:apply-templates select="tp:docstring" />
165
<dl xmlns="http://www.w3.org/1999/xhtml">
166
<xsl:variable name="value-prefix">
168
<xsl:when test="@value-prefix">
169
<xsl:value-of select="@value-prefix"/>
172
<xsl:value-of select="@name"/>
176
<xsl:for-each select="tp:flag">
177
<dt xmlns="http://www.w3.org/1999/xhtml"><code><xsl:value-of select="concat($value-prefix, '_', @suffix)"/> = <xsl:value-of select="@value"/></code></dt>
179
<xsl:when test="tp:docstring">
180
<dd xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates select="tp:docstring" /></dd>
183
<dd xmlns="http://www.w3.org/1999/xhtml">(Undocumented)</dd>
190
<xsl:template match="tp:enum">
191
<h3 xmlns="http://www.w3.org/1999/xhtml">
192
<a name="type-{@name}">
193
<xsl:value-of select="@name"/>
196
<xsl:apply-templates select="tp:docstring" />
197
<dl xmlns="http://www.w3.org/1999/xhtml">
198
<xsl:variable name="value-prefix">
200
<xsl:when test="@value-prefix">
201
<xsl:value-of select="@value-prefix"/>
204
<xsl:value-of select="@name"/>
208
<xsl:for-each select="tp:enumvalue">
209
<dt xmlns="http://www.w3.org/1999/xhtml"><code><xsl:value-of select="concat($value-prefix, '_', @suffix)"/> = <xsl:value-of select="@value"/></code></dt>
211
<xsl:when test="tp:docstring">
212
<dd xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates select="tp:docstring" /></dd>
215
<dd xmlns="http://www.w3.org/1999/xhtml">(Undocumented)</dd>
222
<xsl:template match="tp:property">
223
<dt xmlns="http://www.w3.org/1999/xhtml">
224
<xsl:if test="@name">
225
<code><xsl:value-of select="@name"/></code> -
227
<code><xsl:value-of select="@type"/></code>
229
<dd xmlns="http://www.w3.org/1999/xhtml">
230
<xsl:apply-templates select="tp:docstring"/>
234
<xsl:template match="tp:mapping">
235
<div xmlns="http://www.w3.org/1999/xhtml" class="struct">
237
<a name="type-{@name}">
238
<xsl:value-of select="@name"/>
240
<xsl:for-each select="tp:member">
241
<xsl:value-of select="@type"/>
242
<xsl:text>: </xsl:text>
243
<xsl:value-of select="@name"/>
244
<xsl:if test="position() != last()"> → </xsl:if>
248
<div class="docstring">
249
<xsl:apply-templates select="tp:docstring"/>
254
<xsl:apply-templates select="tp:member" mode="members-in-docstring"/>
260
<xsl:template match="tp:docstring" mode="in-index"/>
262
<xsl:template match="tp:simple-type | tp:enum | tp:flags | tp:external-type"
264
- <xsl:value-of select="@type"/>
267
<xsl:template match="tp:simple-type">
268
<div xmlns="http://www.w3.org/1999/xhtml" class="simple-type">
270
<a name="type-{@name}">
271
<xsl:value-of select="@name"/>
272
</a> - <xsl:value-of select="@type"/>
274
<div class="docstring">
275
<xsl:apply-templates select="tp:docstring"/>
280
<xsl:template match="tp:external-type">
281
<div xmlns="http://www.w3.org/1999/xhtml" class="external-type">
283
<a name="type-{@name}">
284
<xsl:value-of select="@name"/>
285
</a> - <xsl:value-of select="@type"/>
287
<dd>Defined by: <xsl:value-of select="@from"/></dd>
291
<xsl:template match="tp:struct" mode="in-index">
292
- ( <xsl:for-each select="tp:member">
293
<xsl:value-of select="@type"/>
294
<xsl:if test="position() != last()">, </xsl:if>
298
<xsl:template match="tp:mapping" mode="in-index">
299
- a{ <xsl:for-each select="tp:member">
300
<xsl:value-of select="@type"/>
301
<xsl:if test="position() != last()"> → </xsl:if>
305
<xsl:template match="tp:struct">
306
<div xmlns="http://www.w3.org/1999/xhtml" class="struct">
308
<a name="type-{@name}">
309
<xsl:value-of select="@name"/>
311
<xsl:for-each select="tp:member">
312
<xsl:value-of select="@type"/>
313
<xsl:text>: </xsl:text>
314
<xsl:value-of select="@name"/>
315
<xsl:if test="position() != last()">, </xsl:if>
319
<div class="docstring">
320
<xsl:apply-templates select="tp:docstring"/>
323
<xsl:when test="string(@array-name) != ''">
324
<p>In bindings that need a separate name, arrays of
325
<xsl:value-of select="@name"/> should be called
326
<xsl:value-of select="@array-name"/>.</p>
329
<p>Arrays of <xsl:value-of select="@name"/> don't generally
336
<xsl:apply-templates select="tp:member" mode="members-in-docstring"/>
342
<xsl:template match="method">
343
<div xmlns="http://www.w3.org/1999/xhtml" class="method">
344
<h3 xmlns="http://www.w3.org/1999/xhtml">
345
<a name="{concat(../@name, concat('.', @name))}">
346
<xsl:value-of select="@name"/>
348
<xsl:for-each xmlns="" select="arg[@direction='in']">
349
<xsl:value-of select="@type"/>: <xsl:value-of select="@name"/>
350
<xsl:if test="position() != last()">, </xsl:if>
354
<xsl:when test="arg[@direction='out']">
355
<xsl:for-each xmlns="" select="arg[@direction='out']">
356
<xsl:value-of select="@type"/>
357
<xsl:if test="position() != last()">, </xsl:if>
360
<xsl:otherwise>nothing</xsl:otherwise>
363
<div xmlns="http://www.w3.org/1999/xhtml" class="docstring">
364
<xsl:apply-templates select="tp:docstring" />
367
<xsl:if test="arg[@direction='in']">
368
<div xmlns="http://www.w3.org/1999/xhtml">
370
<dl xmlns="http://www.w3.org/1999/xhtml">
371
<xsl:apply-templates select="arg[@direction='in']"
372
mode="parameters-in-docstring"/>
377
<xsl:if test="arg[@direction='out']">
378
<div xmlns="http://www.w3.org/1999/xhtml">
380
<dl xmlns="http://www.w3.org/1999/xhtml">
381
<xsl:apply-templates select="arg[@direction='out']"
382
mode="returns-in-docstring"/>
387
<xsl:if test="tp:possible-errors">
388
<div xmlns="http://www.w3.org/1999/xhtml">
389
<h4>Possible errors</h4>
390
<dl xmlns="http://www.w3.org/1999/xhtml">
391
<xsl:apply-templates select="tp:possible-errors/tp:error"/>
399
<xsl:template name="parenthesized-tp-type">
400
<xsl:if test="@tp:type">
401
<xsl:variable name="tp-type" select="@tp:type"/>
402
<xsl:variable name="single-type">
404
<xsl:when test="contains($tp-type, '[]')">
405
<xsl:value-of select="substring-before($tp-type, '[]')"/>
408
<xsl:value-of select="$tp-type"/>
413
<xsl:when test="//tp:simple-type[@name=$tp-type]" />
414
<xsl:when test="//tp:simple-type[concat(@name, '[]')=$tp-type]" />
415
<xsl:when test="//tp:struct[concat(@name, '[]')=$tp-type][string(@array-name) != '']" />
416
<xsl:when test="//tp:struct[@name=$tp-type]" />
417
<xsl:when test="//tp:enum[@name=$tp-type]" />
418
<xsl:when test="//tp:enum[concat(@name, '[]')=$tp-type]" />
419
<xsl:when test="//tp:flags[@name=$tp-type]" />
420
<xsl:when test="//tp:flags[concat(@name, '[]')=$tp-type]" />
421
<xsl:when test="//tp:mapping[@name=$tp-type]" />
422
<xsl:when test="//tp:external-type[concat(@name, '[]')=$tp-type]" />
423
<xsl:when test="//tp:external-type[@name=$tp-type]" />
425
<xsl:message terminate="yes">
426
<xsl:text>ERR: Unable to find type '</xsl:text>
427
<xsl:value-of select="$tp-type"/>
428
<xsl:text>' </xsl:text>
432
(<a href="#type-{$single-type}"><xsl:value-of select="$tp-type"/></a>)
436
<xsl:template match="tp:member" mode="members-in-docstring">
437
<dt xmlns="http://www.w3.org/1999/xhtml">
438
<code><xsl:value-of select="@name"/></code> -
439
<code><xsl:value-of select="@type"/></code>
440
<xsl:call-template name="parenthesized-tp-type"/>
442
<dd xmlns="http://www.w3.org/1999/xhtml">
444
<xsl:when test="tp:docstring">
445
<xsl:apply-templates select="tp:docstring" />
448
<em>(undocumented)</em>
454
<xsl:template match="arg" mode="parameters-in-docstring">
455
<dt xmlns="http://www.w3.org/1999/xhtml">
456
<code><xsl:value-of select="@name"/></code> -
457
<code><xsl:value-of select="@type"/></code>
458
<xsl:call-template name="parenthesized-tp-type"/>
460
<dd xmlns="http://www.w3.org/1999/xhtml">
461
<xsl:apply-templates select="tp:docstring" />
465
<xsl:template match="arg" mode="returns-in-docstring">
466
<dt xmlns="http://www.w3.org/1999/xhtml">
467
<xsl:if test="@name">
468
<code><xsl:value-of select="@name"/></code> -
470
<code><xsl:value-of select="@type"/></code>
471
<xsl:call-template name="parenthesized-tp-type"/>
473
<dd xmlns="http://www.w3.org/1999/xhtml">
474
<xsl:apply-templates select="tp:docstring"/>
478
<xsl:template match="tp:possible-errors/tp:error">
479
<dt xmlns="http://www.w3.org/1999/xhtml">
480
<code><xsl:value-of select="@name"/></code>
482
<dd xmlns="http://www.w3.org/1999/xhtml">
483
<xsl:variable name="name" select="@name"/>
485
<xsl:when test="tp:docstring">
486
<xsl:apply-templates select="tp:docstring"/>
488
<xsl:when test="//tp:errors/tp:error[concat(../@namespace, '.', translate(@name, ' ', ''))=$name]/tp:docstring">
489
<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>
498
<xsl:template match="signal">
499
<div xmlns="http://www.w3.org/1999/xhtml" class="signal">
500
<h3 xmlns="http://www.w3.org/1999/xhtml">
501
<a name="{concat(../@name, concat('.', @name))}">
502
<xsl:value-of select="@name"/>
504
<xsl:for-each xmlns="" select="arg">
505
<xsl:value-of select="@type"/>: <xsl:value-of select="@name"/>
506
<xsl:if test="position() != last()">, </xsl:if>
509
<div xmlns="http://www.w3.org/1999/xhtml" class="docstring">
510
<xsl:apply-templates select="tp:docstring"/>
514
<div xmlns="http://www.w3.org/1999/xhtml">
516
<dl xmlns="http://www.w3.org/1999/xhtml">
517
<xsl:apply-templates select="arg" mode="parameters-in-docstring"/>
524
<xsl:output method="xml" indent="no" encoding="ascii"
525
omit-xml-declaration="yes"
526
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
527
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
529
<xsl:template match="/tp:spec">
530
<html xmlns="http://www.w3.org/1999/xhtml">
533
<xsl:value-of select="tp:title"/>
534
<xsl:if test="tp:version">
535
<xsl:text> version </xsl:text>
536
<xsl:value-of select="tp:version"/>
539
<style type="text/css">
542
font-family: sans-serif;
559
a:link, a:visited, a:link:hover, a:visited:hover {
565
border-bottom: black solid 1px;
566
padding-bottom: 10px;
577
border-bottom: black solid 1px;
587
border-right:#abacba solid 1px;
588
border-left: #abacba solid 1px;
590
border: #abacba solid 1px;
599
text-decoration: none;
600
border-bottom: #e29625 dotted 1px;
610
padding-bottom: 10px;
611
border-bottom: #abacba solid 1px;
642
<xsl:value-of select="tp:title" />
644
<xsl:if test="tp:version">
645
<h2>Version <xsl:apply-templates select="tp:version"/></h2>
647
<xsl:apply-templates select="tp:copyright"/>
648
<xsl:apply-templates select="tp:license"/>
649
<xsl:apply-templates select="tp:docstring"/>
653
<xsl:for-each select="node/interface">
654
<li><code><a href="#{@name}"><xsl:value-of select="@name"/></a></code></li>
658
<xsl:apply-templates select="node"/>
659
<xsl:apply-templates select="tp:generic-types"/>
660
<xsl:apply-templates select="tp:errors"/>
663
<h2>Index of interfaces</h2>
665
<xsl:for-each select="node/interface">
666
<li><code><a href="#{@name}"><xsl:value-of select="@name"/></a></code></li>
669
<h2>Index of types</h2>
671
<xsl:for-each select="//tp:simple-type | //tp:enum | //tp:flags | //tp:mapping | //tp:struct | //tp:external-type">
672
<xsl:sort select="@name"/>
675
<a href="#type-{@name}">
676
<xsl:value-of select="@name"/>
679
<xsl:apply-templates mode="in-index" select="."/>
689
<!-- vim:set sw=2 sts=2 et: -->