3 Samba-documentation specific stylesheets
4 Published under the GNU GPL
6 (C) Jelmer Vernooij 2002-2004
7 (C) Alexander Bokovoy 2002-2004
9 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
10 xmlns:
samba=
"http://samba.org/common"
13 <xsl:import href=
"../settings.xsl"/>
15 <xsl:output method=
"xml" encoding=
"UTF-8" doctype-public=
"-//OASIS//DTD DocBook XML V4.2//EN" indent=
"yes" doctype-system=
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"/>
17 <xsl:param name=
"xmlSambaNsUri" select=
"'http://samba.org/common'"/>
19 <xsl:template match=
"reference/refentry/refsect1">
20 <xsl:if test=
"title!='VERSION' and title!='AUTHOR'">
21 <xsl:element name=
"refsect1">
22 <xsl:if test=
"@id!=''">
23 <xsl:attribute name=
"id">
24 <xsl:value-of select=
"@id"/>
27 <xsl:apply-templates/>
32 <xsl:template match=
"translator">
33 <xsl:element name=
"othercredit">
34 <xsl:element name=
"author">
35 <xsl:apply-templates/>
36 <xsl:element name=
"contrib">
37 <xsl:text>Translation to
</xsl:text><xsl:value-of select=
"@lang"/>
43 <xsl:template match=
"reference/refentry">
44 <xsl:element name=
"section">
45 <xsl:attribute name=
"id">
46 <xsl:value-of select=
"@id"/>
48 <xsl:element name=
"title">
49 <xsl:value-of select=
"refmeta/refentrytitle"/>
50 <!-- <xsl:text> (</xsl:text>
51 <xsl:value-of select="refnamediv/refpurpose"/>
52 <xsl:text>)</xsl:text>-->
54 <xsl:apply-templates/>
58 <xsl:template match=
"reference/refentry/refmeta"/>
60 <xsl:template match=
"reference/refentry/refnamediv"/>
62 <xsl:template match=
"reference">
63 <xsl:element name=
"appendix">
64 <xsl:attribute name=
"id">
65 <xsl:value-of select=
"@id"/>
67 <xsl:apply-templates/>
72 <!-- This is needed to copy content unchanged -->
73 <xsl:template match=
"@*|node()">
75 <xsl:apply-templates select=
"@*|node()"/>
79 <xsl:template match=
"smbconfexample/smbconfoption|smbconfblock/smbconfoption">
81 <xsl:element name=
"member">
82 <xsl:element name=
"indexterm">
83 <xsl:element name=
"primary">
84 <xsl:value-of select=
"@name"/>
87 <xsl:element name=
"parameter">
88 <xsl:text disable-output-escaping=
"yes">
89 <?latex \hspace{
1cm} ?
>
91 <xsl:value-of select=
"@name"/>
93 <xsl:when test=
"text() != ''">
94 <xsl:text> =
</xsl:text>
95 <xsl:value-of select=
"text()"/>
102 <xsl:template match=
"smbconfexample/smbconfcomment|smbconfblock/smbconfcomment">
103 <xsl:text disable-output-escaping=
"yes">
104 <?latex \hspace{
1cm} ?
>
106 <xsl:element name=
"member">
107 <xsl:text>#
</xsl:text>
108 <xsl:apply-templates/>
112 <xsl:template match=
"smbconfexample/smbconfsection|smbconfblock/smbconfsection">
113 <xsl:element name=
"member">
114 <xsl:text> </xsl:text>
116 <xsl:element name=
"member">
117 <xsl:element name=
"parameter">
118 <xsl:apply-templates/>
123 <xsl:template match=
"smbconfoption">
124 <!-- Include an index term -->
125 <xsl:element name=
"indexterm">
126 <xsl:element name=
"primary">
127 <xsl:value-of select=
"@name"/>
131 <xsl:variable name=
"linkcontent">
132 <xsl:element name=
"parameter">
133 <xsl:attribute name=
"moreinfo">
134 <xsl:text>none
</xsl:text>
136 <xsl:value-of select=
"@name"/>
140 <xsl:when test=
"text() != ''">
141 <xsl:text> =
</xsl:text>
142 <xsl:value-of select=
"text()"/>
148 <xsl:when test=
"$noreference = 1">
149 <xsl:value-of select=
"$linkcontent"/>
152 <xsl:element name=
"link">
153 <xsl:attribute name=
"linkend">
154 <xsl:value-of select=
"translate(translate(string(@name),' ',''),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
156 <xsl:value-of select=
"$linkcontent"/>
162 <!-- FIXME: Needs extension sometime -->
163 <xsl:template match=
"ntgroup|ntuser">
164 <xsl:element name=
"emphasis">
165 <xsl:apply-templates/>
169 <xsl:template match=
"smbconfexample">
171 <xsl:when test=
"title = ''">
173 <xsl:text>Warning: smbconfexample does not have title!
</xsl:text>
177 <xsl:element name=
"example">
179 <xsl:when test=
"@id != ''">
180 <xsl:attribute name=
"id">
181 <xsl:value-of select=
"@id"/>
186 <xsl:element name=
"title">
187 <xsl:value-of select=
"title"/>
189 <xsl:element name=
"simplelist">
190 <xsl:apply-templates/>
195 <xsl:template match=
"smbconfexample/title">
198 <xsl:template match=
"smbconfblock">
199 <xsl:element name=
"simplelist">
200 <xsl:apply-templates/>
204 <xsl:template match=
"smbconfsection">
205 <xsl:element name=
"parameter">
206 <xsl:apply-templates/>
210 <xsl:template match=
"smbconfcomment">
211 <xsl:text>#
</xsl:text>
212 <xsl:apply-templates/>
215 <xsl:template match=
"smbfile">
216 <xsl:apply-templates/>
219 <xsl:template match=
"image">
220 <xsl:element name=
"figure">
221 <xsl:attribute name=
"id">
223 <xsl:when test=
"@id != ''">
224 <xsl:value-of select=
"@id"/>
227 <xsl:value-of select=
"imagefile"/>
232 <xsl:element name=
"title">
233 <xsl:if test=
"imagedescription = ''">
234 <xsl:message><xsl:text>imagedescription of image with id
</xsl:text><xsl:value-of select=
"@id"/><xsl:text> is empty.
</xsl:text></xsl:message>
236 <xsl:value-of select=
"imagedescription"/>
238 <xsl:element name=
"mediaobject">
239 <xsl:element name=
"imageobject">
240 <xsl:attribute name=
"role"><xsl:text>latex
</xsl:text></xsl:attribute>
241 <xsl:element name=
"imagedata">
242 <xsl:attribute name=
"fileref">
243 <xsl:value-of select=
"$latex.imagebasedir"/><xsl:text>images/
</xsl:text><xsl:value-of select=
"imagefile"/></xsl:attribute>
244 <xsl:attribute name=
"scale">
246 <xsl:when test=
"@scale != ''">
247 <xsl:value-of select=
"@scale"/>
250 <xsl:when test=
"imagefile/@scale != ''">
251 <xsl:value-of select=
"imagefile/@scale"/>
255 <xsl:text>50</xsl:text>
259 <xsl:attribute name=
"scalefit"><xsl:text>1</xsl:text></xsl:attribute>
262 <xsl:element name=
"imageobject">
263 <xsl:attribute name=
"role"><xsl:text>html
</xsl:text></xsl:attribute>
264 <xsl:element name=
"imagedata">
265 <xsl:attribute name=
"fileref">
266 <xsl:text>images/
</xsl:text><xsl:value-of select=
"imagefile"/><xsl:text>.png
</xsl:text></xsl:attribute>
267 <xsl:attribute name=
"scale">
269 <xsl:when test=
"@scale != ''">
270 <xsl:value-of select=
"@scale"/>
273 <xsl:when test=
"imagefile/@scale != ''">
274 <xsl:value-of select=
"imagefile/@scale"/>
278 <xsl:text>100</xsl:text>
282 <xsl:attribute name=
"scalefit"><xsl:text>1</xsl:text></xsl:attribute>
285 <xsl:element name=
"imageobject">
286 <xsl:element name=
"imagedata">
287 <xsl:attribute name=
"fileref">
288 <xsl:text>images/
</xsl:text><xsl:value-of select=
"imagefile"/><xsl:text>.png
</xsl:text></xsl:attribute>
289 <xsl:attribute name=
"scale">
291 <xsl:when test=
"@scale != ''">
292 <xsl:value-of select=
"@scale"/>
295 <xsl:when test=
"imagefile/@scale != ''">
296 <xsl:value-of select=
"imagefile/@scale"/>
300 <xsl:text>50</xsl:text>
304 <xsl:attribute name=
"scalefit"><xsl:text>1</xsl:text></xsl:attribute>
312 <xsl:template match=
"description"><xsl:apply-templates/></xsl:template>
314 <xsl:template match=
"value"><xsl:apply-templates/></xsl:template>
316 <xsl:template match=
"synonym"><xsl:apply-templates/></xsl:template>
318 <xsl:template match=
"related"><xsl:apply-templates/></xsl:template>
320 <xsl:template match=
"//samba:parameterlist">
321 <xsl:apply-templates>
322 <xsl:sort select=
"varlistentry/term/anchor"/>
323 </xsl:apply-templates>
326 <xsl:template match=
"value/comment">
327 <xsl:text> #
</xsl:text>
328 <xsl:apply-templates/>
331 <xsl:template match=
"//samba:parameter">
332 <!-- reconstruct varlistentry - not all of them will go into separate files
333 and also we must repair the main varlistentry itself.
335 <xsl:variable name=
"cname"><xsl:value-of select=
"translate(translate(string(@name),' ',''),
336 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
339 <xsl:variable name=
"name"><xsl:value-of select=
"@name"/></xsl:variable>
341 <xsl:variable name=
"anchor">
342 <xsl:element name=
"anchor">
343 <xsl:attribute name=
"id">
344 <xsl:value-of select=
"$cname"/>
349 <xsl:variable name=
"context">
350 <xsl:text> (
</xsl:text>
351 <xsl:value-of select=
"@context"/>
352 <xsl:text>)
</xsl:text>
355 <xsl:variable name=
"term">
356 <xsl:element name=
"term">
357 <xsl:copy-of select=
"$anchor"/>
358 <xsl:value-of select=
"@name"/>
359 <xsl:value-of select=
"$context"/>
364 <!-- Generate list of examples -->
365 <xsl:variable name=
"examples">
366 <xsl:for-each select=
"value">
367 <xsl:if test=
"@type = 'example'">
368 <xsl:element name=
"para">
369 <xsl:text>Example:
</xsl:text>
370 <xsl:element name=
"emphasis">
371 <xsl:element name=
"parameter">
372 <xsl:copy-of select=
"$name"/>
374 <xsl:text> =
</xsl:text>
375 <xsl:apply-templates select=
"."/>
376 <xsl:text> </xsl:text>
378 <xsl:text> </xsl:text>
384 <xsl:variable name=
"tdefault">
385 <xsl:for-each select=
"value">
386 <xsl:if test=
"@type = 'default'">
387 <xsl:element name=
"para">
388 <xsl:text>Default:
</xsl:text>
389 <xsl:element name=
"emphasis">
390 <xsl:element name=
"parameter">
391 <xsl:copy-of select=
"$name"/>
393 <xsl:text> =
</xsl:text>
394 <xsl:apply-templates select=
"."/>
395 <xsl:text> </xsl:text>
397 <xsl:text> </xsl:text>
403 <xsl:variable name=
"default">
405 <xsl:when test=
"$tdefault = ''">
406 <xsl:element name=
"para">
407 <xsl:element name=
"emphasis">
408 <xsl:text>No default
</xsl:text>
413 <xsl:copy-of select=
"$tdefault"/>
418 <xsl:variable name=
"content">
419 <xsl:apply-templates select=
"description"/>
422 <xsl:for-each select=
"synonym">
423 <xsl:element name=
"varlistentry">
424 <xsl:text> </xsl:text>
425 <xsl:element name=
"indexterm">
426 <xsl:attribute name=
"significance">
427 <xsl:text>preferred
</xsl:text>
429 <xsl:element name=
"primary">
430 <xsl:value-of select=
"."/>
432 <xsl:element name=
"see">
433 <xsl:value-of select=
"$name"/>
437 <xsl:element name=
"term">
438 <xsl:element name=
"anchor">
439 <xsl:attribute name=
"id">
440 <xsl:value-of select=
"translate(translate(string(.),' ',''), 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
443 <xsl:value-of select=
"."/>
446 <xsl:element name=
"listitem">
447 <xsl:element name=
"para"><xsl:text>This parameter is a synonym for
</xsl:text><xsl:copy-of select=
"$name"/><xsl:text>.
</xsl:text></xsl:element>
452 <xsl:element name=
"varlistentry">
453 <xsl:text> </xsl:text>
454 <xsl:element name=
"indexterm">
455 <xsl:attribute name=
"significance">
456 <xsl:text>preferred
</xsl:text>
458 <xsl:element name=
"primary">
459 <xsl:value-of select=
"@name"/>
462 <xsl:copy-of select=
"$term"/>
463 <xsl:element name=
"listitem">
464 <xsl:copy-of select=
"$content"/> <xsl:text> </xsl:text>
465 <xsl:copy-of select=
"$default"/> <xsl:text> </xsl:text>
466 <xsl:copy-of select=
"$examples"/> <xsl:text> </xsl:text>
471 <xsl:template match=
"ulink">
472 <xsl:element name=
"ulink">
473 <xsl:attribute name=
"url">
474 <xsl:value-of select=
"@url"/>
477 <xsl:apply-templates/>
478 <xsl:if test=
"contains(@url,'http://') or contains(@url,'ftp://')">
479 <xsl:if test=
"$duplicate_ulinks='brackets'">
480 <xsl:text> (
</xsl:text>
481 <xsl:value-of select=
"@url"/>
482 <xsl:text>)
</xsl:text>
484 <xsl:if test=
"$duplicate_ulinks='footnote'">
485 <xsl:element name=
"footnote">
486 <xsl:element name=
"para">
487 <xsl:value-of select=
"@url"/>
495 <!-- Just ignore these -->
496 <xsl:template match=
"smbfile">
497 <xsl:apply-templates/>
500 <xsl:template match=
"quote">
501 <xsl:element name=
"quote">
502 <xsl:element name=
"emphasis">
503 <xsl:apply-templates/>