Blame doc/problems-service/tools/spec-to-introspect.xsl

Packit 8ea169
Packit 8ea169
Packit 8ea169
        xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
Packit 8ea169
        exclude-result-prefixes="tp">
Packit 8ea169
Packit 8ea169
Packit 8ea169
    Telepathy D-Bus Introspection to EggDBus Introspection format translator.
Packit 8ea169
Packit 8ea169
    Copyright 2009  Michael Leupold <lemma@confuego.org>
Packit 8ea169
Packit 8ea169
    This library is free software; you can redistribute it and/or
Packit 8ea169
    modify it under the terms of the GNU Lesser General Public
Packit 8ea169
    License as published by the Free Software Foundation; either
Packit 8ea169
    version 2.1 of the License, or (at your option) any later version.
Packit 8ea169
Packit 8ea169
    This library is distributed in the hope that it will be useful,
Packit 8ea169
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8ea169
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 8ea169
    Lesser General Public License for more details.
Packit 8ea169
Packit 8ea169
    You should have received a copy of the GNU Lesser General Public
Packit 8ea169
    License along with this library; if not, write to the Free Software
Packit 8ea169
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Packit 8ea169
-->
Packit 8ea169
Packit 8ea169
Packit 8ea169
    TODO:
Packit 8ea169
     - Enable conversion of dictionary element types (eg. "{ss}") and
Packit 8ea169
       struct types (eg. "(sayay)")
Packit 8ea169
     - unhandled: tp:simple-type, tp:enum, tp:flags, tp:external-type
Packit 8ea169
     - tp:docstring may contain XHTML which this template doesn't handle
Packit 8ea169
-->
Packit 8ea169
Packit 8ea169
    <xsl:include href="resolve-type.xsl"/>
Packit 8ea169
Packit 8ea169
    
Packit 8ea169
    <xsl:template match="tp:spec">
Packit 8ea169
        <node>
Packit 8ea169
            <xsl:apply-templates select="tp:errors"/>
Packit 8ea169
            <xsl:apply-templates select="tp:struct"/>
Packit 8ea169
            
Packit 8ea169
            <xsl:apply-templates select="node/interface"/>
Packit 8ea169
        </node>
Packit 8ea169
    </xsl:template>
Packit 8ea169
Packit 8ea169
    
Packit 8ea169
    <xsl:template match="interface|annotation|method|signal">
Packit 8ea169
        <xsl:copy>
Packit 8ea169
            <xsl:for-each select="@*">
Packit 8ea169
                <xsl:if test="not(starts-with(name(), 'tp:'))">
Packit 8ea169
                    <xsl:copy/>
Packit 8ea169
                </xsl:if>
Packit 8ea169
            </xsl:for-each>
Packit 8ea169
            <xsl:apply-templates/>
Packit 8ea169
        </xsl:copy>
Packit 8ea169
    </xsl:template>
Packit 8ea169
Packit 8ea169
    
Packit 8ea169
         They get special handling because they may contain a tp:type
Packit 8ea169
         attribute -->
Packit 8ea169
    <xsl:template match="arg|property">
Packit 8ea169
        <xsl:copy>
Packit 8ea169
            <xsl:for-each select="@*">
Packit 8ea169
                <xsl:if test="not(starts-with(name(), 'tp:'))">
Packit 8ea169
                    <xsl:copy/>
Packit 8ea169
                </xsl:if>
Packit 8ea169
            </xsl:for-each>
Packit 8ea169
            <xsl:for-each select="@tp:type">
Packit 8ea169
                <xsl:variable name="type">
Packit 8ea169
                    <xsl:call-template name="TpType">
Packit 8ea169
                        <xsl:with-param name="type" select="."/>
Packit 8ea169
                    </xsl:call-template>
Packit 8ea169
                </xsl:variable>
Packit 8ea169
                <annotation name="org.gtk.EggDBus.Type">
Packit 8ea169
                    <xsl:attribute name="value">
Packit 8ea169
                        <xsl:value-of select="translate(translate($type, ' ', ''), '
', '')"/>
Packit 8ea169
                    </xsl:attribute>
Packit 8ea169
                </annotation>
Packit 8ea169
            </xsl:for-each>
Packit 8ea169
            <xsl:apply-templates/>
Packit 8ea169
        </xsl:copy>
Packit 8ea169
    </xsl:template>
Packit 8ea169
Packit 8ea169
    
Packit 8ea169
    <xsl:template match="tp:docstring">
Packit 8ea169
        <annotation name="org.gtk.EggDBus.DocString">
Packit 8ea169
            <xsl:attribute name="value">
Packit 8ea169
                <xsl:value-of select="normalize-space(text())"/>
Packit 8ea169
            </xsl:attribute>
Packit 8ea169
        </annotation>
Packit 8ea169
    </xsl:template>
Packit 8ea169
Packit 8ea169
    
Packit 8ea169
    <xsl:template match="tp:errors">
Packit 8ea169
        <annotation value="Error" name="org.gtk.EggDBus.DeclareErrorDomain">
Packit 8ea169
            <xsl:apply-templates select="tp:docstring"/>
Packit 8ea169
            <xsl:apply-templates select="tp:error"/>
Packit 8ea169
        </annotation>
Packit 8ea169
    </xsl:template>
Packit 8ea169
Packit 8ea169
    
Packit 8ea169
    <xsl:template match="tp:error">
Packit 8ea169
        <annotation name="org.gtk.EggDBus.ErrorDomain.Member">
Packit 8ea169
            <xsl:attribute name="value">
Packit 8ea169
                <xsl:value-of select="concat(../@namespace, '.', @name)"/>
Packit 8ea169
            </xsl:attribute>
Packit 8ea169
            <xsl:apply-templates select="tp:docstring"/>
Packit 8ea169
        </annotation>
Packit 8ea169
    </xsl:template>
Packit 8ea169
Packit 8ea169
    
Packit 8ea169
    <xsl:template match="tp:struct">
Packit 8ea169
        <annotation name="org.gtk.EggDBus.DeclareStruct">
Packit 8ea169
            <xsl:attribute name="value">
Packit 8ea169
                <xsl:value-of select="@name"/>
Packit 8ea169
            </xsl:attribute>
Packit 8ea169
            <xsl:apply-templates select="tp:docstring"/>
Packit 8ea169
            <xsl:apply-templates select="tp:member"/>
Packit 8ea169
        </annotation>
Packit 8ea169
    </xsl:template>
Packit 8ea169
Packit 8ea169
    
Packit 8ea169
    <xsl:template match="tp:member">
Packit 8ea169
        <xsl:variable name="type">
Packit 8ea169
            <xsl:call-template name="ResolveType">
Packit 8ea169
                <xsl:with-param name="node" select="."/>
Packit 8ea169
            </xsl:call-template>
Packit 8ea169
        </xsl:variable>
Packit 8ea169
        <annotation name="org.gtk.EggDBus.Struct.Member">
Packit 8ea169
            <xsl:attribute name="value">
Packit 8ea169
                <xsl:value-of select="concat(normalize-space($type), ':', @name)"/>
Packit 8ea169
            </xsl:attribute>
Packit 8ea169
            <xsl:apply-templates select="tp:docstring"/>
Packit 8ea169
        </annotation>
Packit 8ea169
    </xsl:template>
Packit 8ea169
Packit 8ea169
    <xsl:template match="text()"/>
Packit 8ea169
Packit 8ea169
    
Packit 8ea169
                omit-xml-declaration="no"
Packit 8ea169
                doctype-system="http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"
Packit 8ea169
                doctype-public="-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"/>
Packit 8ea169
Packit 8ea169
</xsl:stylesheet>