Remove admon graphics - provided by dblatex now.
[kai/samba.git] / docs-xml / xslt / latex.xsl
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'
3         xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
4
5 <!-- Remove bits from the manual pages that are not relevant for the book -->
6 <xsl:import href="strip-references.xsl"/>
7
8 <xsl:param name="latex.mapping.xml" select="document('latex.overrides.xml')"/>
9
10 <xsl:param name="generate.toc">
11         /appendix toc,title
12         article/appendix  nop
13         /article  toc,title
14         book      toc,title,figure,table,example,equation
15         /chapter  toc,title,lop
16         part      toc,title
17         /preface  toc,title
18         qandadiv  toc
19         qandaset  toc
20         procedure lop
21         reference toc,title
22         /sect1    toc
23         /sect2    toc
24         /sect3    toc
25         /sect4    toc
26         /sect5    toc
27         /section  toc
28         set       toc,title
29 </xsl:param>
30
31 <!-- Show real name of the link rather then user specified description 
32 <xsl:template match="link">
33         <xsl:variable name="target" select="key('id',@linkend)[1]"/>
34         <xsl:variable name="refelem" select="local-name($target)"/>
35         <xsl:if test="$refelem=''">
36                 <xsl:message><xsl:text>XRef to nonexistent id: </xsl:text><xsl:value-of select="@linkend"/></xsl:message>
37                 <xsl:text>XrefId[?</xsl:text>
38                 <xsl:apply-templates/>
39                 <xsl:text>?]</xsl:text>
40         </xsl:if>
41
42         <xsl:call-template name="generate.hyperlink">
43                 <xsl:with-param name="target" select="$target"/>
44                 <xsl:with-param name="text">
45                         <xsl:call-template name="generate.xref.text">
46                                 <xsl:with-param name="target" select="$target"/>
47                         </xsl:call-template>
48                 </xsl:with-param>
49         </xsl:call-template>
50 </xsl:template>
51 -->
52
53 <xsl:output method="text" encoding="UTF-8" indent="yes"/>
54 <xsl:variable name="l10n.gentext.default.language" select="'en'"/>
55 <xsl:variable name="latex.example.caption.style"></xsl:variable>
56 <xsl:variable name="latex.hyperref.param.pdftex">hyperfigures,hyperindex,citecolor=black,urlcolor=black,filecolor=black,linkcolor=black,menucolor=red,pagecolor=black</xsl:variable>
57 <xsl:variable name="latex.use.tabularx">1</xsl:variable>
58 <xsl:variable name="latex.use.parskip">1</xsl:variable>
59 <xsl:variable name="latex.hyphenation.tttricks">1</xsl:variable>
60 <xsl:template name="latex.thead.row.entry">
61 <xsl:text>{\bfseries </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text>
62 </xsl:template>
63 <xsl:variable name="latex.class.book">sambadoc</xsl:variable>
64 <xsl:variable name="latex.babel.language">english</xsl:variable>
65 <xsl:variable name="ulink.footnotes" select="1"/>
66 <xsl:variable name="ulink.show" select="0"/>
67
68 <xsl:template match="smbconfblock/smbconfoption">
69         <xsl:text>      </xsl:text><xsl:value-of select="@name"/>
70         <xsl:if test="text() != ''">
71                 <xsl:text> = </xsl:text>
72                 <xsl:value-of select="text()"/>
73         </xsl:if>
74         <xsl:text>&#10;</xsl:text>
75 </xsl:template>
76
77 <xsl:template match="smbconfblock/smbconfcomment">
78         <xsl:text># </xsl:text>
79         <xsl:apply-templates/>
80         <xsl:text>&#10;</xsl:text>
81 </xsl:template>
82
83 <xsl:template match="smbconfblock/smbconfsection">
84         <xsl:value-of select="@name"/>
85         <xsl:text>&#10;</xsl:text>
86 </xsl:template>
87
88 <xsl:template match="smbconfoption">
89         <xsl:text>\smbconfoption{</xsl:text>
90         <xsl:call-template name="scape">
91                 <xsl:with-param name="string" select="@name"/>
92         </xsl:call-template>
93         <xsl:text>}</xsl:text>
94
95         <xsl:choose>
96                 <xsl:when test="text() != ''">
97                         <xsl:text> = </xsl:text>
98                         <xsl:call-template name="scape">
99                                 <xsl:with-param name="string" select="text()"/>
100                         </xsl:call-template>
101                 </xsl:when>
102         </xsl:choose>
103 </xsl:template>
104
105 <xsl:template match="smbconfblock">
106         <xsl:text>&#10;\begin{lstlisting}[language=smbconf,style=smbconfblock]&#10;</xsl:text>
107         <xsl:apply-templates/>
108         <xsl:text>\end{lstlisting}&#10;</xsl:text>
109 </xsl:template>
110
111 <xsl:template match="smbconfsection">
112         <xsl:text>\smbconfsection{</xsl:text>
113         <xsl:call-template name="scape">
114                 <xsl:with-param name="string" select="@name"/>
115         </xsl:call-template>
116         <xsl:text>}</xsl:text>
117 </xsl:template>
118
119 <xsl:template match="imagefile">
120         <xsl:text>\includegraphics[scale=</xsl:text>
121         <xsl:choose>
122                 <xsl:when test="@scale != ''"><xsl:value-of select="@scale div 100"/></xsl:when>
123
124                 <xsl:otherwise><xsl:text>.50</xsl:text></xsl:otherwise>
125         </xsl:choose>
126         <xsl:text>]{</xsl:text>
127         <xsl:value-of select="text()"/>
128         <xsl:text>}&#10;</xsl:text>
129 </xsl:template>
130
131 <!-- smb.conf documentation -->
132
133 <xsl:template match="description"><xsl:apply-templates/></xsl:template>
134
135 <xsl:template match="value"><xsl:apply-templates/></xsl:template>
136
137 <xsl:template match="synonym"><xsl:apply-templates/></xsl:template>
138
139 <xsl:template match="related"><xsl:apply-templates/></xsl:template>
140
141 <xsl:template match="//samba:parameterlist">
142         <xsl:text>\begin{description}&#10;</xsl:text>
143         <xsl:apply-templates>
144                 <xsl:sort select="samba:parameter/@name"/>
145         </xsl:apply-templates>
146         <xsl:text>\end{description}&#10;</xsl:text>
147 </xsl:template>
148
149 <xsl:template match="value/comment">
150         <xsl:text>&#10;# </xsl:text>
151         <xsl:apply-templates/>
152 </xsl:template>
153
154 <xsl:template match="/">
155         <xsl:apply-templates/>
156 </xsl:template>
157
158 <xsl:template match="refentry">
159         <xsl:text>\section{</xsl:text><xsl:value-of select="refmeta/refentrytitle"/><xsl:text>}&#10;</xsl:text>
160         <xsl:apply-templates/>
161 </xsl:template>
162
163 <xsl:template match="//samba:parameter">
164         <xsl:for-each select="synonym">
165                 <xsl:text>\item[{</xsl:text><xsl:value-of select="."/><xsl:text>}]\null{}&#10;</xsl:text>
166         <xsl:text>\index{</xsl:text><xsl:value-of select="."/><xsl:text>}&#10;</xsl:text>
167         <xsl:text>This parameter is a synonym for \smbconfoption{</xsl:text><xsl:value-of select="../@name"/><xsl:text>}.</xsl:text>
168         </xsl:for-each>
169
170         <xsl:text>\item[{</xsl:text><xsl:value-of select="@name"/>
171         <xsl:text> (</xsl:text>
172         <xsl:value-of select="@context"/>
173         <xsl:text>)</xsl:text>
174         <xsl:text>}]\null{}&#10;&#10;</xsl:text>
175         <xsl:text>\index{</xsl:text><xsl:value-of select="@name"/><xsl:text>}&#10;</xsl:text>
176
177         <!-- Print default value-->
178         <xsl:text>&#10;</xsl:text>
179         <xsl:text>Default: </xsl:text>
180         <xsl:text>\emph{</xsl:text>
181         <xsl:choose>
182                 <xsl:when test="value[@type='default'] != ''">
183                         <xsl:value-of select="@name"/>
184                         <xsl:text> = </xsl:text>
185                         <xsl:apply-templates select="value"/>
186                 </xsl:when>
187                 <xsl:otherwise>
188                         <xsl:text>No default</xsl:text>
189                 </xsl:otherwise>
190         </xsl:choose>
191         <xsl:text>}</xsl:text>
192         <xsl:text>&#10;</xsl:text>
193
194         <!-- Generate list of examples -->
195         <xsl:text>&#10;</xsl:text>
196         <xsl:for-each select="value[@type='example']">
197                 <xsl:text>&#10;</xsl:text>
198                 <xsl:text>Example: </xsl:text>
199                 <xsl:text>\emph{</xsl:text><xsl:value-of select="../@name"/>
200                 <xsl:text> = </xsl:text>
201                 <xsl:apply-templates select="."/>
202                 <xsl:text>}</xsl:text>
203                 <xsl:text>&#10;</xsl:text>
204         </xsl:for-each>
205
206         <!-- Description -->
207         <xsl:apply-templates select="description"/>
208 </xsl:template>
209
210 </xsl:stylesheet>