3 DocBook to yodl converter
5 Lacks support for a few docbook tags, but pretty much all
8 (C) Jelmer Vernooij 2004
10 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11 xmlns:exsl="http://exslt.org/common"
14 <xsl:output method="text" encoding="iso-8859-1" standalone="yes" indent="no"/>
15 <xsl:strip-space elements="*"/>
17 <xsl:template match="refentry">
18 <xsl:text>manpage(</xsl:text>
19 <xsl:value-of select="refmeta/refentrytitle"/>
20 <xsl:text>)()(</xsl:text>
21 <xsl:value-of select="refmeta/manvolnum"/>
22 <xsl:text>)(package)() </xsl:text>
24 <xsl:apply-templates/>
27 <xsl:template match="article">
28 <xsl:text>article(</xsl:text>
29 <xsl:value-of select="title"/>
30 <xsl:text>)(</xsl:text>
31 <xsl:text>FIXME</xsl:text>
32 <xsl:text>)(</xsl:text>
33 <xsl:value-of select="articleinfo/pubdate"/>
34 <xsl:text>)</xsl:text>
35 <xsl:apply-templates/>
38 <xsl:template match="report">
39 <xsl:text>report(</xsl:text>
40 <xsl:value-of select="title"/>
41 <xsl:text>)(</xsl:text>
42 <xsl:text>FIXME</xsl:text>
43 <xsl:text>)(</xsl:text>
44 <xsl:value-of select="articleinfo/pubdate"/>
45 <xsl:text>)</xsl:text>
46 <xsl:apply-templates/>
49 <xsl:template match="book">
50 <xsl:text>book(</xsl:text>
51 <xsl:value-of select="title"/>
52 <xsl:text>)(</xsl:text>
53 <xsl:text>FIXME</xsl:text>
54 <xsl:text>)(</xsl:text>
55 <xsl:value-of select="articleinfo/pubdate"/>
56 <xsl:text>)</xsl:text>
57 <xsl:apply-templates/>
60 <xsl:template match="chapter">
62 <xsl:when test="@id = ''">
63 <xsl:text>chapter(</xsl:text>
64 <xsl:value-of select="title"/>
65 <xsl:text>) </xsl:text>
68 <xsl:text>lchapter(</xsl:text>
69 <xsl:value-of select="@id"/>
70 <xsl:text>)(</xsl:text>
71 <xsl:value-of select="title"/>
72 <xsl:text>) </xsl:text>
75 <xsl:apply-templates/>
78 <xsl:template match="citerefentry">
79 <xsl:value-of select="refentrytitle"/>
80 <xsl:text>(</xsl:text>
81 <xsl:value-of select="manvolnum"/>
82 <xsl:text>)</xsl:text>
85 <xsl:template match="para">
86 <xsl:apply-templates/>
87 <xsl:text> </xsl:text>
90 <xsl:template match="formalpara">
91 <xsl:text>paragraph(</xsl:text>
92 <xsl:value-of select="title"/>
93 <xsl:text>) </xsl:text>
94 <xsl:apply-templates/>
97 <xsl:template match="part">
98 <xsl:text>part(</xsl:text>
99 <xsl:value-of select="title"/>
100 <xsl:text>) </xsl:text>
101 <xsl:apply-templates/>
104 <xsl:template match="preface">
105 <xsl:text>nchapter(</xsl:text>
106 <xsl:value-of select="title"/>
107 <xsl:text>) </xsl:text>
108 <xsl:apply-templates/>
111 <xsl:template match="quote">
112 <xsl:text>"</xsl:text>
113 <xsl:apply-templates/>
114 <xsl:text>"</xsl:text>
117 <xsl:template match="parameter|filename">
118 <xsl:text>code(</xsl:text>
119 <xsl:apply-templates/>
120 <xsl:text>)</xsl:text>
123 <xsl:template match="emphasis">
124 <xsl:text>em(</xsl:text>
125 <xsl:apply-templates/>
126 <xsl:text>)</xsl:text>
129 <xsl:template match="command">
130 <xsl:text>bf(</xsl:text>
131 <xsl:apply-templates/>
132 <xsl:text>)</xsl:text>
135 <xsl:template match="refnamediv">
136 <xsl:text>manpagename(</xsl:text>
137 <xsl:value-of select="refname"/>
138 <xsl:text>)(</xsl:text>
139 <xsl:value-of select="refpurpose"/>
140 <xsl:text>) </xsl:text>
143 <xsl:template match="refsynopsisdiv">
144 <xsl:text>manpagesynopsis()</xsl:text>
147 <xsl:template match="refsect1|refsect2">
149 <xsl:when test="title='DESCRIPTION'">
150 <xsl:text> manpagedescription() </xsl:text>
152 <xsl:when test="title='OPTIONS'">
153 <xsl:text> manpageoptions() </xsl:text>
155 <xsl:when test="title='FILES'">
156 <xsl:text> manpagefiles() </xsl:text>
158 <xsl:when test="title='SEE ALSO'">
159 <xsl:text> manpageseealso() </xsl:text>
161 <xsl:when test="title='DIAGNOSTICS'">
162 <xsl:text> manpagediagnostics() </xsl:text>
164 <xsl:when test="title='BUGS'">
165 <xsl:text> manpagebugs() </xsl:text>
167 <xsl:when test="title='AUTHOR'">
168 <xsl:text> manpageauthor() </xsl:text>
171 <xsl:text> manpagesection(</xsl:text>
172 <xsl:value-of select="title"/>
173 <xsl:text>) </xsl:text>
176 <xsl:apply-templates/>
179 <xsl:template match="orderedlist">
180 <xsl:text>startdit() </xsl:text>
181 <xsl:for-each select="listitem">
182 <xsl:text>dit() </xsl:text>
184 <xsl:apply-templates/>
186 <xsl:text> </xsl:text>
188 <xsl:text>enddit() </xsl:text>
191 <xsl:template match="itemizedlist">
192 <xsl:text>startit() </xsl:text>
193 <xsl:for-each select="listitem">
194 <xsl:text>it() </xsl:text>
196 <xsl:apply-templates/>
198 <xsl:text> </xsl:text>
200 <xsl:text>endit() </xsl:text>
203 <xsl:template match="variablelist">
204 <xsl:text>startdit() </xsl:text>
205 <xsl:for-each select="varlistentry">
206 <xsl:text>dit(</xsl:text>
207 <xsl:copy-of select="term">
208 <xsl:apply-templates/>
210 <xsl:text>) </xsl:text>
211 <xsl:apply-templates select="listitem/para"/>
212 <xsl:text> </xsl:text>
214 <xsl:text>enddit() </xsl:text>
217 <xsl:template match="anchor">
218 <xsl:text>label(</xsl:text>
219 <xsl:value-of select="@id"/>
220 <xsl:text>) </xsl:text>
223 <xsl:template match="footnote">
224 <xsl:text>footnote(</xsl:text>
225 <xsl:apply-templates/>
226 <xsl:text>)</xsl:text>
229 <xsl:template match="toc">
230 <xsl:text>gettocstring() </xsl:text>
233 <xsl:template match="ulink">
234 <xsl:text> </xsl:text>
235 <xsl:text>url(</xsl:text>
236 <xsl:value-of select="url"/>
237 <xsl:text>)(</xsl:text>
238 <xsl:apply-templates/>
239 <xsl:text>)</xsl:text>
242 <xsl:template match="link">
243 <xsl:text>lref(</xsl:text>
244 <xsl:apply-templates/>
245 <xsl:text>)(</xsl:text>
246 <xsl:value-of select="@linkend"/>
247 <xsl:text>)</xsl:text>
250 <xsl:template match="index">
251 <xsl:text>printindex() </xsl:text>
254 <xsl:template match="sect1">
256 <xsl:when test="@id = ''">
257 <xsl:text>sect(</xsl:text>
260 <xsl:text>lsect(</xsl:text>
261 <xsl:value-of select="@id"/>
262 <xsl:text>)(</xsl:text>
265 <xsl:value-of select="title"/>
266 <xsl:text>) </xsl:text>
267 <xsl:apply-templates/>
270 <xsl:template match="sect2">
272 <xsl:when test="@id = ''">
273 <xsl:text>subsect(</xsl:text>
276 <xsl:text>lsubsect(</xsl:text>
277 <xsl:value-of select="@id"/>
278 <xsl:text>)(</xsl:text>
281 <xsl:value-of select="title"/>
282 <xsl:text>) </xsl:text>
283 <xsl:apply-templates/>
286 <xsl:template match="sect3">
288 <xsl:when test="@id = ''">
289 <xsl:text>subsubsect(</xsl:text>
292 <xsl:text>lsubsubsect(</xsl:text>
293 <xsl:value-of select="@id"/>
294 <xsl:text>)(</xsl:text>
297 <xsl:value-of select="title"/>
298 <xsl:text>) </xsl:text>
299 <xsl:apply-templates/>
302 <xsl:template match="sect4">
304 <xsl:when test="@id = ''">
305 <xsl:text>subsubsubsect(</xsl:text>
308 <xsl:text>lsubsubsubsect(</xsl:text>
309 <xsl:value-of select="@id"/>
310 <xsl:text>)(</xsl:text>
313 <xsl:value-of select="title"/>
314 <xsl:text>) </xsl:text>
315 <xsl:apply-templates/>
318 <xsl:template match="*"/>