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