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:template match="html:*" mode="html">
32 <xsl:apply-templates mode="html"/>
36 <xsl:template match="*" mode="identity">
38 <xsl:apply-templates mode="identity"/>
42 <xsl:template match="tp:docstring">
43 <xsl:apply-templates select="text() | html:*" mode="html"/>
44 <xsl:apply-templates select="tp:rationale"/>
47 <xsl:template match="tp:rationale">
48 <div xmlns="http://www.w3.org/1999/xhtml" class="rationale">
49 <xsl:apply-templates select="node()" mode="html"/>
53 <xsl:template match="tp:errors">
54 <h1 xmlns="http://www.w3.org/1999/xhtml">Errors</h1>
55 <xsl:apply-templates/>
58 <xsl:template match="tp:generic-types">
59 <h1 xmlns="http://www.w3.org/1999/xhtml">Generic types</h1>
60 <xsl:call-template name="do-types"/>
63 <xsl:template name="do-types">
64 <xsl:if test="tp:simple-type">
65 <h2 xmlns="http://www.w3.org/1999/xhtml">Simple types</h2>
66 <xsl:apply-templates select="tp:simple-type"/>
69 <xsl:if test="tp:enum">
70 <h2 xmlns="http://www.w3.org/1999/xhtml">Enumerated types:</h2>
71 <xsl:apply-templates select="tp:enum"/>
74 <xsl:if test="tp:flags">
75 <h2 xmlns="http://www.w3.org/1999/xhtml">Sets of flags:</h2>
76 <xsl:apply-templates select="tp:flags"/>
79 <xsl:if test="tp:struct">
80 <h2 xmlns="http://www.w3.org/1999/xhtml">Structure types</h2>
81 <xsl:apply-templates select="tp:struct"/>
84 <xsl:if test="tp:mapping">
85 <h2 xmlns="http://www.w3.org/1999/xhtml">Mapping types</h2>
86 <xsl:apply-templates select="tp:mapping"/>
89 <xsl:if test="tp:external-type">
90 <h2 xmlns="http://www.w3.org/1999/xhtml">Types defined elsewhere</h2>
91 <dl><xsl:apply-templates select="tp:external-type"/></dl>
95 <xsl:template match="tp:error">
96 <h2 xmlns="http://www.w3.org/1999/xhtml"><a name="{concat(../@namespace, '.', translate(@name, ' ', ''))}"></a><xsl:value-of select="concat(../@namespace, '.', translate(@name, ' ', ''))"/></h2>
97 <xsl:apply-templates select="tp:docstring"/>
100 <xsl:template match="/tp:spec/tp:copyright">
101 <div xmlns="http://www.w3.org/1999/xhtml">
102 <xsl:apply-templates/>
105 <xsl:template match="/tp:spec/tp:license">
106 <div xmlns="http://www.w3.org/1999/xhtml" class="license">
107 <xsl:apply-templates mode="html"/>
111 <xsl:template match="tp:copyright"/>
112 <xsl:template match="tp:license"/>
114 <xsl:template match="interface">
115 <h1 xmlns="http://www.w3.org/1999/xhtml"><a name="{@name}"></a><xsl:value-of select="@name"/></h1>
117 <xsl:if test="@tp:causes-havoc">
118 <p xmlns="http://www.w3.org/1999/xhtml" class="causes-havoc">
119 This interface is <xsl:value-of select="@tp:causes-havoc"/>
120 and is likely to cause havoc to your API/ABI if bindings are generated.
121 Don't include it in libraries that care about compatibility.
125 <xsl:if test="tp:requires">
126 <p>Implementations of this interface must also implement:</p>
127 <ul xmlns="http://www.w3.org/1999/xhtml">
128 <xsl:for-each select="tp:requires">
129 <li><code><a href="#{@interface}"><xsl:value-of select="@interface"/></a></code></li>
134 <xsl:apply-templates select="tp:docstring" />
137 <xsl:when test="method">
138 <h2 xmlns="http://www.w3.org/1999/xhtml">Methods:</h2>
139 <xsl:apply-templates select="method"/>
142 <p xmlns="http://www.w3.org/1999/xhtml">Interface has no methods.</p>
147 <xsl:when test="signal">
148 <h2 xmlns="http://www.w3.org/1999/xhtml">Signals:</h2>
149 <xsl:apply-templates select="signal"/>
152 <p xmlns="http://www.w3.org/1999/xhtml">Interface has no signals.</p>
157 <xsl:when test="tp:property">
158 <h2 xmlns="http://www.w3.org/1999/xhtml">Telepathy Properties:</h2>
159 <p xmlns="http://www.w3.org/1999/xhtml">Accessed using the
160 <a href="#org.freedesktop.Telepathy.Properties">Telepathy
161 Properties</a> interface.</p>
162 <dl xmlns="http://www.w3.org/1999/xhtml">
163 <xsl:apply-templates select="tp:property"/>
167 <p xmlns="http://www.w3.org/1999/xhtml">Interface has no Telepathy
173 <xsl:when test="property">
174 <h2 xmlns="http://www.w3.org/1999/xhtml">D-Bus core Properties:</h2>
175 <p xmlns="http://www.w3.org/1999/xhtml">Accessed using the
176 org.freedesktop.DBus.Properties interface.</p>
177 <dl xmlns="http://www.w3.org/1999/xhtml">
178 <xsl:apply-templates select="property"/>
182 <p xmlns="http://www.w3.org/1999/xhtml">Interface has no D-Bus core
187 <xsl:call-template name="do-types"/>
191 <xsl:template match="tp:flags">
193 <a name="type-{@name}">
194 <xsl:value-of select="@name"/>
197 <xsl:apply-templates select="tp:docstring" />
198 <dl xmlns="http://www.w3.org/1999/xhtml">
199 <xsl:variable name="value-prefix">
201 <xsl:when test="@value-prefix">
202 <xsl:value-of select="@value-prefix"/>
205 <xsl:value-of select="@name"/>
209 <xsl:for-each select="tp:flag">
210 <dt xmlns="http://www.w3.org/1999/xhtml"><code><xsl:value-of select="concat($value-prefix, '_', @suffix)"/> = <xsl:value-of select="@value"/></code></dt>
212 <xsl:when test="tp:docstring">
213 <dd xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates select="tp:docstring" /></dd>
216 <dd xmlns="http://www.w3.org/1999/xhtml">(Undocumented)</dd>
223 <xsl:template match="tp:enum">
224 <h3 xmlns="http://www.w3.org/1999/xhtml">
225 <a name="type-{@name}">
226 <xsl:value-of select="@name"/>
229 <xsl:apply-templates select="tp:docstring" />
230 <dl xmlns="http://www.w3.org/1999/xhtml">
231 <xsl:variable name="value-prefix">
233 <xsl:when test="@value-prefix">
234 <xsl:value-of select="@value-prefix"/>
237 <xsl:value-of select="@name"/>
241 <xsl:for-each select="tp:enumvalue">
242 <dt xmlns="http://www.w3.org/1999/xhtml"><code><xsl:value-of select="concat($value-prefix, '_', @suffix)"/> = <xsl:value-of select="@value"/></code></dt>
244 <xsl:when test="tp:docstring">
245 <dd xmlns="http://www.w3.org/1999/xhtml"><xsl:apply-templates select="tp:docstring" /></dd>
248 <dd xmlns="http://www.w3.org/1999/xhtml">(Undocumented)</dd>
255 <xsl:template match="property">
256 <dt xmlns="http://www.w3.org/1999/xhtml">
257 <a name="{concat(../@name, '.', @name)}">
258 <code><xsl:value-of select="@name"/></code>
260 <xsl:text> - </xsl:text>
261 <code><xsl:value-of select="@type"/></code>
262 <xsl:call-template name="parenthesized-tp-type"/>
263 <xsl:text>, </xsl:text>
265 <xsl:when test="@access = 'read'">
266 <xsl:text>read-only</xsl:text>
268 <xsl:when test="@access = 'write'">
269 <xsl:text>write-only</xsl:text>
271 <xsl:when test="@access = 'readwrite'">
272 <xsl:text>read/write</xsl:text>
275 <xsl:text>access: </xsl:text>
276 <code><xsl:value-of select="@access"/></code>
280 <dd xmlns="http://www.w3.org/1999/xhtml">
281 <xsl:apply-templates select="tp:docstring"/>
285 <xsl:template match="tp:property">
286 <dt xmlns="http://www.w3.org/1999/xhtml">
287 <xsl:if test="@name">
288 <code><xsl:value-of select="@name"/></code> -
290 <code><xsl:value-of select="@type"/></code>
292 <dd xmlns="http://www.w3.org/1999/xhtml">
293 <xsl:apply-templates select="tp:docstring"/>
297 <xsl:template match="tp:mapping">
298 <div xmlns="http://www.w3.org/1999/xhtml" class="struct">
300 <a name="type-{@name}">
301 <xsl:value-of select="@name"/>
303 <xsl:for-each select="tp:member">
304 <xsl:value-of select="@type"/>
305 <xsl:text>: </xsl:text>
306 <xsl:value-of select="@name"/>
307 <xsl:if test="position() != last()"> → </xsl:if>
311 <div class="docstring">
312 <xsl:apply-templates select="tp:docstring"/>
317 <xsl:apply-templates select="tp:member" mode="members-in-docstring"/>
323 <xsl:template match="tp:docstring" mode="in-index"/>
325 <xsl:template match="tp:simple-type | tp:enum | tp:flags | tp:external-type"
327 - <xsl:value-of select="@type"/>
330 <xsl:template match="tp:simple-type">
331 <div xmlns="http://www.w3.org/1999/xhtml" class="simple-type">
333 <a name="type-{@name}">
334 <xsl:value-of select="@name"/>
335 </a> - <xsl:value-of select="@type"/>
337 <div class="docstring">
338 <xsl:apply-templates select="tp:docstring"/>
343 <xsl:template match="tp:external-type">
344 <div xmlns="http://www.w3.org/1999/xhtml" class="external-type">
346 <a name="type-{@name}">
347 <xsl:value-of select="@name"/>
348 </a> - <xsl:value-of select="@type"/>
350 <dd>Defined by: <xsl:value-of select="@from"/></dd>
354 <xsl:template match="tp:struct" mode="in-index">
355 - ( <xsl:for-each select="tp:member">
356 <xsl:value-of select="@type"/>
357 <xsl:if test="position() != last()">, </xsl:if>
361 <xsl:template match="tp:mapping" mode="in-index">
362 - a{ <xsl:for-each select="tp:member">
363 <xsl:value-of select="@type"/>
364 <xsl:if test="position() != last()"> → </xsl:if>
368 <xsl:template match="tp:struct">
369 <div xmlns="http://www.w3.org/1999/xhtml" class="struct">
371 <a name="type-{@name}">
372 <xsl:value-of select="@name"/>
374 <xsl:for-each select="tp:member">
375 <xsl:value-of select="@type"/>
376 <xsl:text>: </xsl:text>
377 <xsl:value-of select="@name"/>
378 <xsl:if test="position() != last()">, </xsl:if>
382 <div class="docstring">
383 <xsl:apply-templates select="tp:docstring"/>
386 <xsl:when test="string(@array-name) != ''">
387 <p>In bindings that need a separate name, arrays of
388 <xsl:value-of select="@name"/> should be called
389 <xsl:value-of select="@array-name"/>.</p>
392 <p>Arrays of <xsl:value-of select="@name"/> don't generally
399 <xsl:apply-templates select="tp:member" mode="members-in-docstring"/>
405 <xsl:template match="method">
406 <div xmlns="http://www.w3.org/1999/xhtml" class="method">
407 <h3 xmlns="http://www.w3.org/1999/xhtml">
408 <a name="{concat(../@name, concat('.', @name))}">
409 <xsl:value-of select="@name"/>
411 <xsl:for-each xmlns="" select="arg[@direction='in']">
412 <xsl:value-of select="@type"/>: <xsl:value-of select="@name"/>
413 <xsl:if test="position() != last()">, </xsl:if>
417 <xsl:when test="arg[@direction='out']">
418 <xsl:for-each xmlns="" select="arg[@direction='out']">
419 <xsl:value-of select="@type"/>
420 <xsl:if test="position() != last()">, </xsl:if>
423 <xsl:otherwise>nothing</xsl:otherwise>
426 <div xmlns="http://www.w3.org/1999/xhtml" class="docstring">
427 <xsl:apply-templates select="tp:docstring" />
430 <xsl:if test="arg[@direction='in']">
431 <div xmlns="http://www.w3.org/1999/xhtml">
433 <dl xmlns="http://www.w3.org/1999/xhtml">
434 <xsl:apply-templates select="arg[@direction='in']"
435 mode="parameters-in-docstring"/>
440 <xsl:if test="arg[@direction='out']">
441 <div xmlns="http://www.w3.org/1999/xhtml">
443 <dl xmlns="http://www.w3.org/1999/xhtml">
444 <xsl:apply-templates select="arg[@direction='out']"
445 mode="returns-in-docstring"/>
450 <xsl:if test="tp:possible-errors">
451 <div xmlns="http://www.w3.org/1999/xhtml">
452 <h4>Possible errors</h4>
453 <dl xmlns="http://www.w3.org/1999/xhtml">
454 <xsl:apply-templates select="tp:possible-errors/tp:error"/>
462 <xsl:template name="parenthesized-tp-type">
463 <xsl:if test="@tp:type">
464 <xsl:variable name="tp-type" select="@tp:type"/>
465 <xsl:variable name="single-type">
467 <xsl:when test="contains($tp-type, '[]')">
468 <xsl:value-of select="substring-before($tp-type, '[]')"/>
471 <xsl:value-of select="$tp-type"/>
476 <xsl:when test="//tp:simple-type[@name=$tp-type]" />
477 <xsl:when test="//tp:simple-type[concat(@name, '[]')=$tp-type]" />
478 <xsl:when test="//tp:struct[concat(@name, '[]')=$tp-type][string(@array-name) != '']" />
479 <xsl:when test="//tp:struct[@name=$tp-type]" />
480 <xsl:when test="//tp:enum[@name=$tp-type]" />
481 <xsl:when test="//tp:enum[concat(@name, '[]')=$tp-type]" />
482 <xsl:when test="//tp:flags[@name=$tp-type]" />
483 <xsl:when test="//tp:flags[concat(@name, '[]')=$tp-type]" />
484 <xsl:when test="//tp:mapping[@name=$tp-type]" />
485 <xsl:when test="//tp:external-type[concat(@name, '[]')=$tp-type]" />
486 <xsl:when test="//tp:external-type[@name=$tp-type]" />
488 <xsl:message terminate="yes">
489 <xsl:text>ERR: Unable to find type '</xsl:text>
490 <xsl:value-of select="$tp-type"/>
491 <xsl:text>' </xsl:text>
495 (<a href="#type-{$single-type}"><xsl:value-of select="$tp-type"/></a>)
499 <xsl:template match="tp:member" mode="members-in-docstring">
500 <dt xmlns="http://www.w3.org/1999/xhtml">
501 <code><xsl:value-of select="@name"/></code> -
502 <code><xsl:value-of select="@type"/></code>
503 <xsl:call-template name="parenthesized-tp-type"/>
505 <dd xmlns="http://www.w3.org/1999/xhtml">
507 <xsl:when test="tp:docstring">
508 <xsl:apply-templates select="tp:docstring" />
511 <em>(undocumented)</em>
517 <xsl:template match="arg" mode="parameters-in-docstring">
518 <dt xmlns="http://www.w3.org/1999/xhtml">
519 <code><xsl:value-of select="@name"/></code> -
520 <code><xsl:value-of select="@type"/></code>
521 <xsl:call-template name="parenthesized-tp-type"/>
523 <dd xmlns="http://www.w3.org/1999/xhtml">
524 <xsl:apply-templates select="tp:docstring" />
528 <xsl:template match="arg" mode="returns-in-docstring">
529 <dt xmlns="http://www.w3.org/1999/xhtml">
530 <xsl:if test="@name">
531 <code><xsl:value-of select="@name"/></code> -
533 <code><xsl:value-of select="@type"/></code>
534 <xsl:call-template name="parenthesized-tp-type"/>
536 <dd xmlns="http://www.w3.org/1999/xhtml">
537 <xsl:apply-templates select="tp:docstring"/>
541 <xsl:template match="tp:possible-errors/tp:error">
542 <dt xmlns="http://www.w3.org/1999/xhtml">
543 <code><xsl:value-of select="@name"/></code>
545 <dd xmlns="http://www.w3.org/1999/xhtml">
546 <xsl:variable name="name" select="@name"/>
548 <xsl:when test="tp:docstring">
549 <xsl:apply-templates select="tp:docstring"/>
551 <xsl:when test="//tp:errors/tp:error[concat(../@namespace, '.', translate(@name, ' ', ''))=$name]/tp:docstring">
552 <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>
561 <xsl:template match="signal">
562 <div xmlns="http://www.w3.org/1999/xhtml" class="signal">
563 <h3 xmlns="http://www.w3.org/1999/xhtml">
564 <a name="{concat(../@name, concat('.', @name))}">
565 <xsl:value-of select="@name"/>
567 <xsl:for-each xmlns="" select="arg">
568 <xsl:value-of select="@type"/>: <xsl:value-of select="@name"/>
569 <xsl:if test="position() != last()">, </xsl:if>
572 <div xmlns="http://www.w3.org/1999/xhtml" class="docstring">
573 <xsl:apply-templates select="tp:docstring"/>
577 <div xmlns="http://www.w3.org/1999/xhtml">
579 <dl xmlns="http://www.w3.org/1999/xhtml">
580 <xsl:apply-templates select="arg" mode="parameters-in-docstring"/>
587 <xsl:output method="xml" indent="no" encoding="ascii"
588 omit-xml-declaration="yes"
589 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
590 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
592 <xsl:template match="/tp:spec">
593 <html xmlns="http://www.w3.org/1999/xhtml">
596 <xsl:value-of select="tp:title"/>
597 <xsl:if test="tp:version">
598 <xsl:text> version </xsl:text>
599 <xsl:value-of select="tp:version"/>
602 <style type="text/css">
605 font-family: sans-serif;
622 a:link, a:visited, a:link:hover, a:visited:hover {
628 border-bottom: black solid 1px;
629 padding-bottom: 10px;
640 border-bottom: black solid 1px;
650 border-right:#abacba solid 1px;
651 border-left: #abacba solid 1px;
653 border: #abacba solid 1px;
662 text-decoration: none;
663 border-bottom: #e29625 dotted 1px;
673 padding-bottom: 10px;
674 border-bottom: #abacba solid 1px;
692 .method, .signal, .property {
698 border-left: 0.25em solid #808080;
706 <xsl:value-of select="tp:title" />
708 <xsl:if test="tp:version">
709 <h2>Version <xsl:apply-templates select="tp:version"/></h2>
711 <xsl:apply-templates select="tp:copyright"/>
712 <xsl:apply-templates select="tp:license"/>
713 <xsl:apply-templates select="tp:docstring"/>
717 <xsl:for-each select="//node/interface">
718 <li><code><a href="#{@name}"><xsl:value-of select="@name"/></a></code></li>
722 <xsl:apply-templates select="//node"/>
723 <xsl:apply-templates select="tp:generic-types"/>
724 <xsl:apply-templates select="tp:errors"/>
727 <h2>Index of interfaces</h2>
729 <xsl:for-each select="//node/interface">
730 <li><code><a href="#{@name}"><xsl:value-of select="@name"/></a></code></li>
733 <h2>Index of types</h2>
735 <xsl:for-each select="//tp:simple-type | //tp:enum | //tp:flags | //tp:mapping | //tp:struct | //tp:external-type">
736 <xsl:sort select="@name"/>
739 <a href="#type-{@name}">
740 <xsl:value-of select="@name"/>
743 <xsl:apply-templates mode="in-index" select="."/>
753 <!-- vim:set sw=2 sts=2 et: -->