Debian Codegraph @

doc/publican/xsl/doxygen-to-publican.xsl

raw
1 <?xml version="1.0" ?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3 <xsl:output method="xml" encoding="UTF-8" indent="yes" />
4 <xsl:param name="which" />
5
6 <xsl:template match="/">
7 <xsl:apply-templates select="/doxygen/compounddef[@kind!='file' and @kind!='dir']" />
8
9 <section id="{$which}-Functions">
10 <title>Functions</title>
11 <para />
12 <xsl:apply-templates select="/doxygen/compounddef[@kind='file']/sectiondef" />
13 </section>
14
15 </xsl:template>
16
17 <xsl:template match="parameteritem">
18 <varlistentry>
19 <term>
20 <xsl:apply-templates select="parameternamelist/parametername"/>
21 </term>
22 <listitem>
23 <simpara><xsl:apply-templates select="parameterdescription"/></simpara>
24 </listitem>
25 </varlistentry>
26 </xsl:template>
27
28 <xsl:template match="parameterlist">
29 <xsl:if test="parameteritem">
30 <variablelist>
31 <xsl:apply-templates select="parameteritem" />
32 </variablelist>
33 </xsl:if>
34 </xsl:template>
35
36 <xsl:template match="ref">
37 <link linkend="{$which}-{@refid}"><xsl:value-of select="." /></link>
38 </xsl:template>
39
40 <xsl:template match="simplesect[@kind='return']">
41 <variablelist>
42 <varlistentry>
43 <term>Returns:</term>
44 <listitem>
45 <simpara><xsl:apply-templates /></simpara>
46 </listitem>
47 </varlistentry>
48 </variablelist>
49 </xsl:template>
50
51 <xsl:template match="simplesect[@kind='see']">
52 See also: <xsl:apply-templates />
53 </xsl:template>
54
55 <xsl:template match="simplesect[@kind='since']">
56 Since: <xsl:apply-templates />
57 </xsl:template>
58
59 <xsl:template match="simplesect[@kind='note']">
60 <emphasis>Note: <xsl:apply-templates /></emphasis>
61 </xsl:template>
62
63 <xsl:template match="sp">
64 <xsl:text> </xsl:text>
65 </xsl:template>
66
67 <xsl:template match="programlisting">
68 <programlisting><xsl:apply-templates /></programlisting>
69 </xsl:template>
70
71 <xsl:template match="itemizedlist">
72 <itemizedlist><xsl:apply-templates select="listitem" /></itemizedlist>
73 </xsl:template>
74
75 <xsl:template match="listitem">
76 <listitem><simpara><xsl:apply-templates /></simpara></listitem>
77 </xsl:template>
78
79 <!-- stops cross-references in the section titles -->
80 <xsl:template match="briefdescription">
81 <xsl:value-of select="." />
82 </xsl:template>
83
84 <!-- this opens a para for each detaileddescription/para. I could not find a
85 way to extract the right text for the description from the
86 source otherwise. Downside: we can't use para for return value, "see
87 also", etc. because they're already inside a para. So they're lists.
88
89 It also means we don't control the order of when something is added to
90 the output, it matches the input file
91 -->
92 <xsl:template match="detaileddescription/para">
93 <para><xsl:apply-templates /></para>
94 </xsl:template>
95
96 <xsl:template match="detaileddescription">
97 <xsl:apply-templates select="para" />
98 </xsl:template>
99
100 <xsl:template match="sectiondef">
101 <xsl:variable name="docitems"
102 select="memberdef[
103 (@kind = 'function' and
104 (@static = 'no' or
105 substring(location/@bodyfile,
106 string-length(location/@bodyfile) - 1,
107 1000) = '.h'
108 )
109 and @prot = 'public'
110 )
111 or
112 (@kind != 'function' and normalize-space(briefdescription) != '')
113 ]" />
114 <xsl:if test="$docitems">
115 <variablelist>
116 <!-- Apply memberdef template -->
117 <xsl:apply-templates select="$docitems" />
118 </variablelist>
119 </xsl:if>
120 </xsl:template>
121
122 <!-- methods -->
123 <xsl:template match="memberdef" >
124 <varlistentry id="{$which}-{@id}">
125 <term>
126 <xsl:value-of select="name"/>
127 <xsl:if test="normalize-space(briefdescription) != ''">
128 - <xsl:apply-templates select="briefdescription" />
129 </xsl:if>
130 </term>
131 <listitem>
132 <synopsis>
133 <xsl:apply-templates select="definition"/><xsl:apply-templates select="argsstring"/>
134 </synopsis>
135 <xsl:apply-templates select="detaileddescription" />
136 </listitem>
137 </varlistentry>
138 </xsl:template>
139
140 <!-- classes -->
141 <xsl:template match="compounddef" >
142 <section id="{$which}-{@id}">
143 <title>
144 <xsl:value-of select="compoundname" />
145 <xsl:if test="normalize-space(briefdescription) != ''">
146 - <xsl:apply-templates select="briefdescription" />
147 </xsl:if>
148 </title>
149 <xsl:choose>
150 <xsl:when test="normalize-space(detaileddescription) != ''">
151 <xsl:apply-templates select="detaileddescription" />
152 </xsl:when>
153 <xsl:otherwise>
154 <para />
155 </xsl:otherwise>
156 </xsl:choose>
157 <xsl:apply-templates select="sectiondef" />
158 </section>
159 </xsl:template>
160 </xsl:stylesheet>