Next update of VFS modules development guide
[kai/samba.git] / docs / xslt / yodl.xsl
1 <?xml version='1.0'?>
2 <!-- 
3         DocBook to yodl converter
4         
5         Lacks support for a few docbook tags, but pretty much all 
6         yodl macros are used
7
8         (C) Jelmer Vernooij                                     2004
9 -->
10 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11         xmlns:exsl="http://exslt.org/common"
12         version="1.1">
13
14         <xsl:output method="text" encoding="iso-8859-1" standalone="yes" indent="no"/>
15         <xsl:strip-space elements="*"/>
16
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)()&#10;</xsl:text>
23
24                 <xsl:apply-templates/>
25         </xsl:template>
26
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/>
36         </xsl:template>
37
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/>
47         </xsl:template>
48
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/>
58         </xsl:template>
59
60         <xsl:template match="chapter">
61                 <xsl:choose>
62                         <xsl:when test="@id = ''">
63                                 <xsl:text>chapter(</xsl:text>
64                                 <xsl:value-of select="title"/>
65                                 <xsl:text>)&#10;</xsl:text>
66                         </xsl:when>
67                         <xsl:otherwise>
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>)&#10;</xsl:text>
73                         </xsl:otherwise>
74                 </xsl:choose>
75                 <xsl:apply-templates/>
76         </xsl:template>
77
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>
83         </xsl:template>
84
85         <xsl:template match="para">
86                 <xsl:apply-templates/>
87                 <xsl:text>&#10;&#10;</xsl:text>
88         </xsl:template>
89
90         <xsl:template match="formalpara">
91                 <xsl:text>paragraph(</xsl:text>
92                 <xsl:value-of select="title"/>
93                 <xsl:text>)&#10;</xsl:text>
94                 <xsl:apply-templates/>
95         </xsl:template>
96
97         <xsl:template match="part">
98                 <xsl:text>part(</xsl:text>
99                 <xsl:value-of select="title"/>
100                 <xsl:text>)&#10;</xsl:text>
101                 <xsl:apply-templates/>
102         </xsl:template>
103         
104         <xsl:template match="preface">
105                 <xsl:text>nchapter(</xsl:text>
106                 <xsl:value-of select="title"/>
107                 <xsl:text>)&#10;</xsl:text>
108                 <xsl:apply-templates/>
109         </xsl:template>
110
111         <xsl:template match="quote">
112                 <xsl:text>"</xsl:text>
113                 <xsl:apply-templates/>
114                 <xsl:text>"</xsl:text>
115         </xsl:template>
116
117         <xsl:template match="parameter|filename">
118                 <xsl:text>code(</xsl:text>
119                 <xsl:apply-templates/>
120                 <xsl:text>)</xsl:text>
121         </xsl:template>
122
123         <xsl:template match="emphasis">
124                 <xsl:text>em(</xsl:text>
125                 <xsl:apply-templates/>
126                 <xsl:text>)</xsl:text>
127         </xsl:template>
128
129         <xsl:template match="command">
130                 <xsl:text>bf(</xsl:text>
131                 <xsl:apply-templates/>
132                 <xsl:text>)</xsl:text>
133         </xsl:template>
134
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>)&#10;</xsl:text>
141         </xsl:template>
142
143         <xsl:template match="refsynopsisdiv">
144                 <xsl:text>manpagesynopsis()</xsl:text>
145         </xsl:template>
146
147         <xsl:template match="refsect1|refsect2">
148                 <xsl:choose>
149                         <xsl:when test="title='DESCRIPTION'">
150                                 <xsl:text>&#10;manpagedescription()&#10;&#10;</xsl:text>
151                         </xsl:when>
152                         <xsl:when test="title='OPTIONS'">
153                                 <xsl:text>&#10;manpageoptions()&#10;&#10;</xsl:text>
154                         </xsl:when>
155                         <xsl:when test="title='FILES'">
156                                 <xsl:text>&#10;manpagefiles()&#10;&#10;</xsl:text>
157                         </xsl:when>
158                         <xsl:when test="title='SEE ALSO'">
159                                 <xsl:text>&#10;manpageseealso()&#10;&#10;</xsl:text>
160                         </xsl:when>
161                         <xsl:when test="title='DIAGNOSTICS'">
162                                 <xsl:text>&#10;manpagediagnostics()&#10;&#10;</xsl:text>
163                         </xsl:when>
164                         <xsl:when test="title='BUGS'">
165                                 <xsl:text>&#10;manpagebugs()&#10;&#10;</xsl:text>
166                         </xsl:when>
167                         <xsl:when test="title='AUTHOR'">
168                                 <xsl:text>&#10;manpageauthor()&#10;&#10;</xsl:text>
169                         </xsl:when>
170                         <xsl:otherwise>
171                                 <xsl:text>&#10;manpagesection(</xsl:text>
172                                 <xsl:value-of select="title"/>
173                                 <xsl:text>)&#10;&#10;</xsl:text>
174                         </xsl:otherwise>
175                 </xsl:choose>
176                 <xsl:apply-templates/>
177         </xsl:template>
178
179         <xsl:template match="orderedlist">
180                 <xsl:text>startdit()&#10;</xsl:text>
181                 <xsl:for-each select="listitem">
182                         <xsl:text>dit() </xsl:text>
183                         <xsl:copy>
184                                 <xsl:apply-templates/>
185                         </xsl:copy>
186                         <xsl:text>&#10;</xsl:text>
187                 </xsl:for-each>
188                 <xsl:text>enddit()&#10;</xsl:text>
189         </xsl:template>
190
191         <xsl:template match="itemizedlist">
192                 <xsl:text>startit()&#10;</xsl:text>
193                 <xsl:for-each select="listitem">
194                         <xsl:text>it() </xsl:text>
195                         <xsl:copy>
196                                 <xsl:apply-templates/>
197                         </xsl:copy>
198                         <xsl:text>&#10;</xsl:text>
199                 </xsl:for-each>
200                 <xsl:text>endit()&#10;</xsl:text>
201         </xsl:template>
202
203         <xsl:template match="variablelist">
204                 <xsl:text>startdit()&#10;</xsl:text>
205                 <xsl:for-each select="varlistentry">
206                         <xsl:text>dit(</xsl:text>
207                         <xsl:copy-of select="term">
208                                 <xsl:apply-templates/>
209                         </xsl:copy-of>
210                         <xsl:text>) </xsl:text>
211                         <xsl:apply-templates select="listitem/para"/>
212                         <xsl:text>&#10;</xsl:text>
213                 </xsl:for-each>
214                 <xsl:text>enddit()&#10;</xsl:text>
215         </xsl:template>
216
217         <xsl:template match="anchor">
218                 <xsl:text>label(</xsl:text>
219                 <xsl:value-of select="@id"/>
220                 <xsl:text>)&#10;</xsl:text>
221         </xsl:template>
222
223         <xsl:template match="footnote">
224                 <xsl:text>footnote(</xsl:text>
225                 <xsl:apply-templates/>
226                 <xsl:text>)</xsl:text>
227         </xsl:template>
228
229         <xsl:template match="toc">
230                 <xsl:text>gettocstring()&#10;</xsl:text>
231         </xsl:template>
232
233         <xsl:template match="ulink">
234                 <xsl:text>&#10;</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>
240         </xsl:template>
241
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>
248         </xsl:template>
249
250         <xsl:template match="index">
251                 <xsl:text>printindex()&#10;</xsl:text>
252         </xsl:template>
253
254         <xsl:template match="sect1">
255                 <xsl:choose>
256                         <xsl:when test="@id = ''">
257                                 <xsl:text>sect(</xsl:text>
258                         </xsl:when>
259                         <xsl:otherwise>
260                                 <xsl:text>lsect(</xsl:text>
261                                 <xsl:value-of select="@id"/>
262                                 <xsl:text>)(</xsl:text>
263                         </xsl:otherwise>
264                 </xsl:choose>
265                 <xsl:value-of select="title"/>
266                 <xsl:text>)&#10;</xsl:text>
267                 <xsl:apply-templates/>
268         </xsl:template>
269
270         <xsl:template match="sect2">
271                 <xsl:choose>
272                         <xsl:when test="@id = ''">
273                                 <xsl:text>subsect(</xsl:text>
274                         </xsl:when>
275                         <xsl:otherwise>
276                                 <xsl:text>lsubsect(</xsl:text>
277                                 <xsl:value-of select="@id"/>
278                                 <xsl:text>)(</xsl:text>
279                         </xsl:otherwise>
280                 </xsl:choose>
281                 <xsl:value-of select="title"/>
282                 <xsl:text>)&#10;</xsl:text>
283                 <xsl:apply-templates/>
284         </xsl:template>
285
286         <xsl:template match="sect3">
287                 <xsl:choose>
288                         <xsl:when test="@id = ''">
289                                 <xsl:text>subsubsect(</xsl:text>
290                         </xsl:when>
291                         <xsl:otherwise>
292                                 <xsl:text>lsubsubsect(</xsl:text>
293                                 <xsl:value-of select="@id"/>
294                                 <xsl:text>)(</xsl:text>
295                         </xsl:otherwise>
296                 </xsl:choose>
297                 <xsl:value-of select="title"/>
298                 <xsl:text>)&#10;</xsl:text>
299                 <xsl:apply-templates/>
300         </xsl:template>
301
302         <xsl:template match="sect4">
303                 <xsl:choose>
304                         <xsl:when test="@id = ''">
305                                 <xsl:text>subsubsubsect(</xsl:text>
306                         </xsl:when>
307                         <xsl:otherwise>
308                                 <xsl:text>lsubsubsubsect(</xsl:text>
309                                 <xsl:value-of select="@id"/>
310                                 <xsl:text>)(</xsl:text>
311                         </xsl:otherwise>
312                 </xsl:choose>
313                 <xsl:value-of select="title"/>
314                 <xsl:text>)&#10;</xsl:text>
315                 <xsl:apply-templates/>
316         </xsl:template>
317
318         <xsl:template match="*"/>
319
320 </xsl:stylesheet>