Fix italics issues in Subject Index
[Samba.git] / docs / xslt / latex.xsl
blob3a54ba747616636ff76f3f7ce2a331383036a964
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="http://db2latex.sourceforge.net/xsl/docbook.xsl"/>
5 <xsl:import href="strip-references.xsl"/>
7 <xsl:param name="latex.mapping.xml" select="document('latex.overrides.xml')"/>
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>
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>
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>
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>
61 <xsl:output method="text" encoding="ISO-8859-1" 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.book.varsets" select="''"/>
72 <xsl:variable name="latex.hyphenation.tttricks">1</xsl:variable>
73 <xsl:variable name="latex.titlepage.file"></xsl:variable>
74 <xsl:template name="latex.thead.row.entry">
75 <xsl:text>{\bfseries </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text>
76 </xsl:template>
77 <xsl:variable name="latex.documentclass">sambadoc</xsl:variable>
78 <xsl:variable name="latex.babel.language">english</xsl:variable>
79 <xsl:variable name="ulink.footnotes" select="1"/>
80 <xsl:variable name="ulink.show" select="0"/>
82 <xsl:template match="smbconfblock/smbconfoption">
83 <xsl:text> </xsl:text><xsl:value-of select="@name"/>
84 <xsl:if test="text() != ''">
85 <xsl:text> = </xsl:text>
86 <xsl:value-of select="text()"/>
87 </xsl:if>
88 <xsl:text>&#10;</xsl:text>
89 </xsl:template>
91 <xsl:template match="smbconfblock/smbconfcomment">
92 <xsl:text># </xsl:text>
93 <xsl:apply-templates/>
94 <xsl:text>&#10;</xsl:text>
95 </xsl:template>
97 <xsl:template match="smbconfblock/smbconfsection">
98 <xsl:value-of select="@name"/>
99 <xsl:text>&#10;</xsl:text>
100 </xsl:template>
102 <xsl:template match="smbconfoption">
103 <xsl:text>\smbconfoption{</xsl:text>
104 <xsl:call-template name="scape">
105 <xsl:with-param name="string" select="@name"/>
106 </xsl:call-template>
107 <xsl:text>}</xsl:text>
109 <xsl:choose>
110 <xsl:when test="text() != ''">
111 <xsl:text> = </xsl:text>
112 <xsl:call-template name="scape">
113 <xsl:with-param name="string" select="text()"/>
114 </xsl:call-template>
115 </xsl:when>
116 </xsl:choose>
117 </xsl:template>
119 <xsl:template match="smbconfblock">
120 <xsl:text>&#10;\begin{lstlisting}[language=smbconf,style=smbconfblock]&#10;</xsl:text>
121 <xsl:apply-templates/>
122 <xsl:text>\end{lstlisting}&#10;</xsl:text>
123 </xsl:template>
125 <xsl:template match="smbconfsection">
126 <xsl:text>\smbconfsection{</xsl:text>
127 <xsl:call-template name="scape">
128 <xsl:with-param name="string" select="@name"/>
129 </xsl:call-template>
130 <xsl:text>}</xsl:text>
131 </xsl:template>
133 <xsl:template match="imagefile">
134 <xsl:text>\includegraphics[scale=</xsl:text>
135 <xsl:choose>
136 <xsl:when test="@scale != ''"><xsl:value-of select="@scale div 100"/></xsl:when>
138 <xsl:otherwise><xsl:text>.50</xsl:text></xsl:otherwise>
139 </xsl:choose>
140 <xsl:text>]{</xsl:text>
141 <xsl:value-of select="$latex.imagebasedir"/><xsl:text>images/</xsl:text>
142 <xsl:value-of select="text()"/>
143 <xsl:text>}&#10;</xsl:text>
144 </xsl:template>
146 <!-- smb.conf documentation -->
148 <xsl:template match="description"><xsl:apply-templates/></xsl:template>
150 <xsl:template match="value"><xsl:apply-templates/></xsl:template>
152 <xsl:template match="synonym"><xsl:apply-templates/></xsl:template>
154 <xsl:template match="related"><xsl:apply-templates/></xsl:template>
156 <xsl:template match="//samba:parameterlist">
157 <xsl:text>\begin{description}&#10;</xsl:text>
158 <xsl:apply-templates>
159 <xsl:sort select="samba:parameter/@name"/>
160 </xsl:apply-templates>
161 <xsl:text>\end{description}&#10;</xsl:text>
162 </xsl:template>
164 <xsl:template match="value/comment">
165 <xsl:text>&#10;# </xsl:text>
166 <xsl:apply-templates/>
167 </xsl:template>
169 <xsl:template match="/">
170 <xsl:apply-templates/>
171 </xsl:template>
173 <xsl:template match="refentry">
174 <xsl:text>\section{</xsl:text><xsl:value-of select="refmeta/refentrytitle"/><xsl:text>}&#10;</xsl:text>
175 <xsl:apply-templates/>
176 </xsl:template>
178 <xsl:template match="//samba:parameter">
179 <xsl:for-each select="synonym">
180 <xsl:text>\item[{</xsl:text><xsl:value-of select="."/><xsl:text>}]\null{}&#10;</xsl:text>
181 <xsl:text>\index{</xsl:text><xsl:value-of select="."/><xsl:text>}&#10;</xsl:text>
182 <xsl:text>This parameter is a synonym for \smbconfoption{</xsl:text><xsl:value-of select="../@name"/><xsl:text>}.</xsl:text>
183 </xsl:for-each>
185 <xsl:text>\item[{</xsl:text><xsl:value-of select="@name"/>
186 <xsl:text> (</xsl:text>
187 <xsl:value-of select="@context"/>
188 <xsl:text>)</xsl:text>
189 <xsl:text>}]\null{}&#10;&#10;</xsl:text>
190 <xsl:text>\index{</xsl:text><xsl:value-of select="@name"/><xsl:text>}&#10;</xsl:text>
192 <!-- Print default value-->
193 <xsl:text>&#10;</xsl:text>
194 <xsl:text>Default: </xsl:text>
195 <xsl:text>\emph{</xsl:text>
196 <xsl:choose>
197 <xsl:when test="value[@type='default'] != ''">
198 <xsl:value-of select="@name"/>
199 <xsl:text> = </xsl:text>
200 <xsl:apply-templates select="value"/>
201 </xsl:when>
202 <xsl:otherwise>
203 <xsl:text>No default</xsl:text>
204 </xsl:otherwise>
205 </xsl:choose>
206 <xsl:text>}</xsl:text>
207 <xsl:text>&#10;</xsl:text>
209 <!-- Generate list of examples -->
210 <xsl:text>&#10;</xsl:text>
211 <xsl:for-each select="value[@type='example']">
212 <xsl:text>&#10;</xsl:text>
213 <xsl:text>Example: </xsl:text>
214 <xsl:text>\emph{</xsl:text><xsl:value-of select="../@name"/>
215 <xsl:text> = </xsl:text>
216 <xsl:apply-templates select="."/>
217 <xsl:text>}</xsl:text>
218 <xsl:text>&#10;</xsl:text>
219 </xsl:for-each>
221 <!-- Description -->
222 <xsl:apply-templates select="description"/>
223 </xsl:template>
225 </xsl:stylesheet>