Split up main stylesheet (necessary for new examples code)
[Samba/bb.git] / docs / xslt / expand-sambadoc.xsl
blob87806a2aa2d7953ae88bb725c37e0712b174ffc8
1 <?xml version='1.0'?>
2 <!--
3 Samba-documentation specific stylesheets
4 Published under the GNU GPL
6 (C) Jelmer Vernooij 2002-2004
7 (C) Alexander Bokovoy 2002-2004
8 -->
9 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"
11 version="1.1">
13 <xsl:import href="../settings.xsl"/>
14 <xsl:import href="strip-references.xsl"/>
15 <xsl:import href="expand-smbconfdoc.xsl"/>
17 <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"/>
19 <!-- This is needed to copy content unchanged -->
20 <xsl:template match="@*|node()">
21 <xsl:copy>
22 <xsl:apply-templates select="@*|node()"/>
23 </xsl:copy>
24 </xsl:template>
26 <xsl:template match="smbconfexample/smbconfoption|smbconfblock/smbconfoption">
28 <xsl:element name="member">
29 <xsl:element name="indexterm">
30 <xsl:element name="primary">
31 <xsl:value-of select="@name"/>
32 </xsl:element>
33 </xsl:element>
34 <xsl:element name="parameter">
35 <xsl:text disable-output-escaping="yes">
36 &lt;?latex \hspace{1cm} ?&gt;
37 </xsl:text>
38 <xsl:value-of select="@name"/>
39 <xsl:choose>
40 <xsl:when test="text() != ''">
41 <xsl:text> = </xsl:text>
42 <xsl:value-of select="text()"/>
43 </xsl:when>
44 </xsl:choose>
45 </xsl:element>
46 </xsl:element>
47 </xsl:template>
49 <xsl:template match="smbconfexample/smbconfcomment|smbconfblock/smbconfcomment">
50 <xsl:text disable-output-escaping="yes">
51 &lt;?latex \hspace{1cm} ?&gt;
52 </xsl:text>
53 <xsl:element name="member">
54 <xsl:text># </xsl:text>
55 <xsl:apply-templates/>
56 </xsl:element>
57 </xsl:template>
59 <xsl:template match="smbconfexample/smbconfsection|smbconfblock/smbconfsection">
60 <xsl:element name="member">
61 <xsl:text> </xsl:text>
62 </xsl:element>
63 <xsl:element name="member">
64 <xsl:element name="parameter">
65 <xsl:value-of select="@name"/>
66 </xsl:element>
67 </xsl:element>
68 </xsl:template>
70 <xsl:template match="smbconfoption">
71 <!-- Include an index term -->
72 <xsl:element name="indexterm">
73 <xsl:element name="primary">
74 <xsl:value-of select="@name"/>
75 </xsl:element>
76 </xsl:element>
78 <xsl:variable name="linkcontent">
79 <xsl:element name="parameter">
80 <xsl:attribute name="moreinfo">
81 <xsl:text>none</xsl:text>
82 </xsl:attribute>
83 <xsl:value-of select="@name"/>
84 </xsl:element>
86 <xsl:choose>
87 <xsl:when test="text() != ''">
88 <xsl:text> = </xsl:text>
89 <xsl:value-of select="text()"/>
90 </xsl:when>
91 </xsl:choose>
92 </xsl:variable>
94 <xsl:choose>
95 <xsl:when test="$noreference = 1">
96 <xsl:value-of select="$linkcontent"/>
97 </xsl:when>
98 <xsl:otherwise>
99 <xsl:element name="link">
100 <xsl:attribute name="linkend">
101 <xsl:value-of select="translate(translate(string(@name),' ',''),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
102 </xsl:attribute>
103 <xsl:value-of select="$linkcontent"/>
104 </xsl:element>
105 </xsl:otherwise>
106 </xsl:choose>
107 </xsl:template>
109 <xsl:template match="smbconfexample">
110 <xsl:choose>
111 <xsl:when test="title = ''">
112 <xsl:message>
113 <xsl:text>Warning: smbconfexample does not have title!</xsl:text>
114 </xsl:message>
115 </xsl:when>
116 </xsl:choose>
117 <xsl:element name="example">
118 <xsl:choose>
119 <xsl:when test="@id != ''">
120 <xsl:attribute name="id">
121 <xsl:value-of select="@id"/>
122 </xsl:attribute>
123 </xsl:when>
124 </xsl:choose>
126 <xsl:element name="title">
127 <xsl:value-of select="title"/>
128 </xsl:element>
129 <xsl:element name="simplelist">
130 <xsl:apply-templates/>
131 </xsl:element>
132 </xsl:element>
133 </xsl:template>
135 <xsl:template match="smbconfexample/title">
136 </xsl:template>
138 <xsl:template match="smbconfblock">
139 <xsl:element name="simplelist">
140 <xsl:apply-templates/>
141 </xsl:element>
142 </xsl:template>
144 <xsl:template match="smbconfsection">
145 <xsl:element name="parameter">
146 <xsl:value-of select="@name"/>
147 </xsl:element>
148 </xsl:template>
150 <xsl:template match="smbconfcomment">
151 <xsl:text># </xsl:text>
152 <xsl:apply-templates/>
153 </xsl:template>
155 <xsl:template match="smbfile">
156 <xsl:apply-templates/>
157 </xsl:template>
159 <xsl:template match="image">
160 <xsl:element name="figure">
161 <xsl:attribute name="id">
162 <xsl:choose>
163 <xsl:when test="@id != ''">
164 <xsl:value-of select="@id"/>
165 </xsl:when>
166 <xsl:otherwise>
167 <xsl:value-of select="imagefile"/>
168 </xsl:otherwise>
169 </xsl:choose>
170 </xsl:attribute>
172 <xsl:element name="title">
173 <xsl:if test="imagedescription = ''">
174 <xsl:message><xsl:text>imagedescription of image with id </xsl:text><xsl:value-of select="@id"/><xsl:text> is empty.</xsl:text></xsl:message>
175 </xsl:if>
176 <xsl:value-of select="imagedescription"/>
177 </xsl:element>
178 <xsl:element name="mediaobject">
179 <xsl:element name="imageobject">
180 <xsl:attribute name="role"><xsl:text>latex</xsl:text></xsl:attribute>
181 <xsl:element name="imagedata">
182 <xsl:attribute name="fileref">
183 <xsl:value-of select="$latex.imagebasedir"/><xsl:text>images/</xsl:text><xsl:value-of select="imagefile"/></xsl:attribute>
184 <xsl:attribute name="scale">
185 <xsl:choose>
186 <xsl:when test="@scale != ''">
187 <xsl:value-of select="@scale"/>
188 </xsl:when>
190 <xsl:when test="imagefile/@scale != ''">
191 <xsl:value-of select="imagefile/@scale"/>
192 </xsl:when>
194 <xsl:otherwise>
195 <xsl:text>50</xsl:text>
196 </xsl:otherwise>
197 </xsl:choose>
198 </xsl:attribute>
199 <xsl:attribute name="scalefit"><xsl:text>1</xsl:text></xsl:attribute>
200 </xsl:element>
201 </xsl:element>
202 <xsl:element name="imageobject">
203 <xsl:attribute name="role"><xsl:text>html</xsl:text></xsl:attribute>
204 <xsl:element name="imagedata">
205 <xsl:attribute name="fileref">
206 <xsl:text>images/</xsl:text><xsl:value-of select="imagefile"/><xsl:text>.png</xsl:text></xsl:attribute>
207 <xsl:attribute name="scale">
208 <xsl:choose>
209 <xsl:when test="@scale != ''">
210 <xsl:value-of select="@scale"/>
211 </xsl:when>
213 <xsl:when test="imagefile/@scale != ''">
214 <xsl:value-of select="imagefile/@scale"/>
215 </xsl:when>
217 <xsl:otherwise>
218 <xsl:text>100</xsl:text>
219 </xsl:otherwise>
220 </xsl:choose>
221 </xsl:attribute>
222 <xsl:attribute name="scalefit"><xsl:text>1</xsl:text></xsl:attribute>
223 </xsl:element>
224 </xsl:element>
225 <xsl:element name="imageobject">
226 <xsl:element name="imagedata">
227 <xsl:attribute name="fileref">
228 <xsl:text>images/</xsl:text><xsl:value-of select="imagefile"/><xsl:text>.png</xsl:text></xsl:attribute>
229 <xsl:attribute name="scale">
230 <xsl:choose>
231 <xsl:when test="@scale != ''">
232 <xsl:value-of select="@scale"/>
233 </xsl:when>
235 <xsl:when test="imagefile/@scale != ''">
236 <xsl:value-of select="imagefile/@scale"/>
237 </xsl:when>
239 <xsl:otherwise>
240 <xsl:text>50</xsl:text>
241 </xsl:otherwise>
242 </xsl:choose>
243 </xsl:attribute>
244 <xsl:attribute name="scalefit"><xsl:text>1</xsl:text></xsl:attribute>
245 </xsl:element>
246 </xsl:element>
248 </xsl:element>
249 </xsl:element>
250 </xsl:template>
252 </xsl:stylesheet>