Last set of syntax fixes
[Samba/gebeck_regimport.git] / docs / docbook / xslt / expand-sambadoc.xsl
blob2749fdf3e99c7b269b24d946f68fc78c600a2c73
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:exsl="http://exslt.org/common"
4 xmlns:samba="http://samba.org/common"
5 version="1.1"
6 extension-element-prefixes="exsl">
8 <xsl:output method="xml"/>
10 <xsl:param name="xmlSambaNsUri" select="'http://samba.org/common'"/>
12 <xsl:template match="reference/refentry/refsect1">
13 <xsl:if test="title!='VERSION' and title!='AUTHOR'">
14 <xsl:element name="refsect1">
15 <xsl:if test="@id!=''">
16 <xsl:attribute name="id">
17 <xsl:value-of select="@id"/>
18 </xsl:attribute>
19 </xsl:if>
20 <xsl:apply-templates/>
21 </xsl:element>
22 </xsl:if>
23 </xsl:template>
25 <xsl:template match="reference/refentry">
26 <xsl:element name="section">
27 <xsl:attribute name="id">
28 <xsl:value-of select="@id"/>
29 </xsl:attribute>
30 <xsl:element name="title">
31 <xsl:value-of select="refmeta/refentrytitle"/>
32 <!-- <xsl:text> (</xsl:text>
33 <xsl:value-of select="refnamediv/refpurpose"/>
34 <xsl:text>)</xsl:text>-->
35 </xsl:element>
36 <xsl:apply-templates/>
37 </xsl:element>
38 </xsl:template>
40 <xsl:template match="reference/refentry/refmeta"/>
42 <xsl:template match="reference/refentry/refnamediv"/>
44 <xsl:template match="reference">
45 <xsl:element name="appendix">
46 <xsl:attribute name="id">
47 <xsl:value-of select="@id"/>
48 </xsl:attribute>
49 <xsl:apply-templates/>
50 </xsl:element>
51 </xsl:template>
53 <xsl:template match="/node()">
54 <xsl:text disable-output-escaping="yes">
55 &lt;!DOCTYPE </xsl:text><xsl:value-of select="name(.)"/><xsl:text disable-output-escaping="yes"> PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
56 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
58 &lt;!ENTITY % globalentities SYSTEM 'global.ent'> %globalentities;
60 </xsl:text>
61 <xsl:copy>
62 <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
63 <xsl:apply-templates/>
64 </xsl:copy>
65 </xsl:template>
68 <!-- This is needed to copy content unchanged -->
69 <xsl:template match="@*|node()">
71 <xsl:copy>
72 <xsl:apply-templates select="@*|node()"/>
73 </xsl:copy>
74 </xsl:template>
76 <xsl:template match="smbconfexample/smbconfoption|smbconfblock/smbconfoption">
77 <xsl:element name="member">
78 <xsl:element name="parameter">
79 <xsl:value-of select="name"/>
80 <xsl:choose>
81 <xsl:when test="value != ''">
82 <xsl:text> = </xsl:text>
83 <xsl:value-of select="value"/>
84 </xsl:when>
85 </xsl:choose>
86 </xsl:element>
87 </xsl:element>
88 </xsl:template>
90 <xsl:template match="smbconfexample/smbconfcomment|smbconfblock/smbconfcomment">
91 <xsl:element name="member">
92 <xsl:text># </xsl:text>
93 <xsl:apply-templates/>
94 </xsl:element>
95 </xsl:template>
97 <xsl:template match="smbconfexample/smbconfsection|smbconfblock/smbconfsection">
98 <xsl:element name="member">
99 <xsl:text> </xsl:text>
100 </xsl:element>
101 <xsl:element name="member">
102 <xsl:element name="parameter">
103 <xsl:apply-templates/>
104 </xsl:element>
105 </xsl:element>
106 </xsl:template>
108 <xsl:template match="smbconfoption">
109 <!-- Include an index term -->
110 <xsl:element name="indexterm">
111 <xsl:element name="primary">
112 <xsl:value-of select="name"/>
113 </xsl:element>
114 </xsl:element>
116 <!-- FIXME: Do this only when smb.conf is included
117 <xsl:element name="link">
118 <xsl:attribute name="linkend">
119 <xsl:value-of select="translate(translate(string(name),' ',''),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
120 </xsl:attribute>-->
122 <xsl:element name="parameter">
123 <xsl:attribute name="moreinfo">
124 <xsl:text>none</xsl:text>
125 </xsl:attribute>
126 <xsl:value-of select="name"/>
127 </xsl:element>
129 <xsl:choose>
130 <xsl:when test="value != ''">
131 <xsl:text> = </xsl:text>
132 <xsl:value-of select="value"/>
133 </xsl:when>
134 </xsl:choose>
135 <!--
136 </xsl:element>-->
137 </xsl:template>
139 <!-- FIXME: Needs extension sometime -->
140 <xsl:template match="ntgroup|ntuser">
141 <xsl:element name="emphasis">
142 <xsl:apply-templates/>
143 </xsl:element>
144 </xsl:template>
146 <xsl:template match="smbconfexample">
147 <xsl:choose>
148 <xsl:when test="title = ''">
149 <xsl:message>
150 <xsl:text>Warning: smbconfexample does not have title!</xsl:text>
151 </xsl:message>
152 </xsl:when>
153 </xsl:choose>
154 <xsl:element name="example">
155 <xsl:choose>
156 <xsl:when test="@id != ''">
157 <xsl:attribute name="id">
158 <xsl:value-of select="@id"/>
159 </xsl:attribute>
160 </xsl:when>
161 </xsl:choose>
163 <xsl:element name="title">
164 <xsl:value-of select="title"/>
165 </xsl:element>
166 <xsl:element name="simplelist">
167 <xsl:apply-templates/>
168 </xsl:element>
169 </xsl:element>
170 </xsl:template>
172 <xsl:template match="smbconfexample/title">
173 </xsl:template>
175 <xsl:template match="smbconfblock">
176 <xsl:element name="simplelist">
177 <xsl:apply-templates/>
178 </xsl:element>
179 </xsl:template>
181 <xsl:template match="smbconfsection">
182 <xsl:element name="parameter">
183 <xsl:apply-templates/>
184 </xsl:element>
185 </xsl:template>
187 <xsl:template match="smbconfcomment">
188 <xsl:text># </xsl:text>
189 <xsl:apply-templates/>
190 </xsl:template>
192 <xsl:template match="image">
193 <xsl:element name="figure">
194 <xsl:attribute name="id">
195 <xsl:choose>
196 <xsl:when test="@id != ''">
197 <xsl:value-of select="@id"/>
198 </xsl:when>
199 <xsl:otherwise>
200 <xsl:value-of select="imagefile"/>
201 </xsl:otherwise>
202 </xsl:choose>
203 </xsl:attribute>
205 <xsl:element name="title">
206 <xsl:value-of select="imagedescription"/>
207 </xsl:element>
208 <xsl:element name="mediaobject">
209 <xsl:element name="imageobject">
210 <xsl:attribute name="role"><xsl:text>latex</xsl:text></xsl:attribute>
211 <xsl:element name="imagedata">
212 <xsl:attribute name="fileref">
213 <xsl:text>projdoc/imagefiles/</xsl:text><xsl:value-of select="imagefile"/></xsl:attribute>
214 <xsl:attribute name="scale">
215 <xsl:choose>
216 <xsl:when test="@scale != ''">
217 <xsl:value-of select="@scale"/>
218 </xsl:when>
220 <xsl:otherwise>
221 <xsl:text>50</xsl:text>
222 </xsl:otherwise>
223 </xsl:choose>
224 </xsl:attribute>
225 <xsl:attribute name="scalefit"><xsl:text>1</xsl:text></xsl:attribute>
226 </xsl:element>
227 </xsl:element>
228 <xsl:element name="imageobject">
229 <xsl:element name="imagedata">
230 <xsl:attribute name="fileref">
231 <xsl:text>projdoc/imagefiles/</xsl:text><xsl:value-of select="imagefile"/><xsl:text>.png</xsl:text></xsl:attribute>
232 <xsl:attribute name="scale"><xsl:text>50</xsl:text></xsl:attribute>
233 <xsl:attribute name="scalefit"><xsl:text>1</xsl:text></xsl:attribute>
234 </xsl:element>
235 </xsl:element>
236 </xsl:element>
237 </xsl:element>
238 </xsl:template>
240 <xsl:template match="//samba:parameter">
241 <!-- reconstruct varlistentry - not all of them will go into separate files
242 and also we must repair the main varlistentry itself.
244 <xsl:variable name="name"><xsl:value-of select="translate(translate(string(@name),' ',''),
245 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
246 </xsl:variable>
248 <xsl:variable name="anchor">
249 <xsl:element name="anchor">
250 <xsl:attribute name="id">
251 <xsl:value-of select="$name"/>
252 </xsl:attribute>
253 </xsl:element>
254 </xsl:variable>
256 <xsl:variable name="context">
257 <xsl:text> (</xsl:text>
258 <xsl:value-of select="@context"/>
259 <xsl:text>)</xsl:text>
260 </xsl:variable>
262 <xsl:variable name="term">
263 <xsl:element name="term">
264 <xsl:copy-of select="$anchor"/>
265 <xsl:value-of select="@name"/>
266 <xsl:value-of select="$context"/>
267 </xsl:element>
268 </xsl:variable>
270 <xsl:variable name="content">
271 <xsl:apply-templates/>
272 </xsl:variable>
274 <xsl:element name="varlistentry">
275 <xsl:text>&#10;</xsl:text>
276 <xsl:element name="indexterm">
277 <xsl:attribute name="significance">
278 <xsl:text>preferred</xsl:text>
279 </xsl:attribute>
280 <xsl:element name="primary">
281 <xsl:value-of select="@name"/>
282 </xsl:element>
283 </xsl:element>
284 <xsl:copy-of select="$term"/>
285 <xsl:copy-of select="$content"/>
286 <xsl:text>
287 </xsl:text>
288 </xsl:element>
290 </xsl:template>
292 <xsl:template match="ulink">
293 <xsl:element name="ulink">
294 <xsl:attribute name="url">
295 <xsl:value-of select="@url"/>
296 </xsl:attribute>
298 <xsl:apply-templates/>
300 </xsl:element>
301 </xsl:template>
304 </xsl:stylesheet>