Fix image scaling issues.
[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 <xsl:import href="http://db2latex.sourceforge.net/xsl/docbook.xsl"/>
4 <xsl:import href="strip-references.xsl"/>
5
6 <xsl:param name="latex.mapping.xml" select="document('latex.overrides.xml')"/>
7
8 <xsl:param name="generate.toc">
9         /appendix toc,title
10         article/appendix  nop
11         /article  toc,title
12         book      toc,title,figure,table,example,equation
13         /chapter  toc,title,lop
14         part      toc,title
15         /preface  toc,title
16         qandadiv  toc
17         qandaset  toc
18         procedure lop
19         reference toc,title
20         /sect1    toc
21         /sect2    toc
22         /sect3    toc
23         /sect4    toc
24         /sect5    toc
25         /section  toc
26         set       toc,title
27 </xsl:param>
28
29 <!-- Show real name of the link rather then user specified description -->
30 <xsl:template name="link">
31         <xsl:element name="link">
32                 <xsl:copy-of select="@*"/>
33         </xsl:element>
34 </xsl:template>
35
36 <!-- LaTeX doesn't accept verbatim stuff in titles -->
37 <xsl:template match="//title/filename|//title/command|//title/parameter|//title/constant">
38   <xsl:variable name="content">
39     <xsl:apply-templates/>
40   </xsl:variable>
41   <xsl:if test="$content != ''">
42     <xsl:value-of select="$content" />
43   </xsl:if>
44 </xsl:template>
45
46 <xsl:output method="text" encoding="ISO-8859-1" indent="yes"/>
47 <xsl:variable name="l10n.gentext.default.language" select="'en'"/>
48 <xsl:variable name="latex.document.font">default</xsl:variable>
49 <xsl:variable name="latex.example.caption.style"></xsl:variable>
50 <xsl:variable name="latex.hyperref.param.pdftex">hyperfigures,hyperindex,citecolor=black,urlcolor=black,filecolor=black,linkcolor=black,menucolor=red,pagecolor=black</xsl:variable>
51 <xsl:variable name="admon.graphics.path">xslt/figures</xsl:variable>
52 <xsl:variable name="latex.use.tabularx">1</xsl:variable>
53 <xsl:variable name="latex.fancyhdr.lh"></xsl:variable>
54 <xsl:variable name="latex.use.fancyhdr"></xsl:variable>
55 <xsl:variable name="latex.use.parskip">1</xsl:variable>
56 <xsl:variable name="latex.book.varsets" select="''"/>
57 <xsl:variable name="latex.hyphenation.tttricks">1</xsl:variable>
58 <xsl:variable name="latex.titlepage.file"></xsl:variable>
59 <xsl:template name="latex.thead.row.entry">
60 <xsl:text>{\bfseries </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text>
61 </xsl:template>
62 <xsl:variable name="latex.documentclass">sambadoc</xsl:variable>
63 <xsl:variable name="latex.babel.language">english</xsl:variable>
64 <xsl:variable name="ulink.footnotes" select="1"/>
65 <xsl:variable name="ulink.show" select="0"/>
66
67 <xsl:template match="smbconfblock/smbconfoption">
68         <xsl:text>      </xsl:text><xsl:value-of select="@name"/>
69         <xsl:if test="text() != ''">
70                 <xsl:text> = </xsl:text>
71                 <xsl:value-of select="text()"/>
72         </xsl:if>
73         <xsl:text>&#10;</xsl:text>
74 </xsl:template>
75
76 <xsl:template match="smbconfblock/smbconfcomment">
77         <xsl:text># </xsl:text>
78         <xsl:apply-templates/>
79         <xsl:text>&#10;</xsl:text>
80 </xsl:template>
81
82 <xsl:template match="smbconfblock/smbconfsection">
83         <xsl:value-of select="@name"/>
84         <xsl:text>&#10;</xsl:text>
85 </xsl:template>
86
87 <xsl:template match="smbconfoption">
88         <xsl:text>\smbconfoption{</xsl:text>
89         <xsl:call-template name="scape">
90                 <xsl:with-param name="string" select="@name"/>
91         </xsl:call-template>
92         <xsl:text>}</xsl:text>
93
94         <xsl:choose>
95                 <xsl:when test="text() != ''">
96                         <xsl:text> = </xsl:text>
97                         <xsl:call-template name="scape">
98                                 <xsl:with-param name="string" select="text()"/>
99                         </xsl:call-template>
100                 </xsl:when>
101         </xsl:choose>
102 </xsl:template>
103
104 <xsl:template match="smbconfblock">
105         <xsl:text>&#10;\begin{lstlisting}[language=smbconf,style=smbconfblock]&#10;</xsl:text>
106         <xsl:apply-templates/>
107         <xsl:text>\end{lstlisting}&#10;</xsl:text>
108 </xsl:template>
109
110 <xsl:template match="smbconfsection">
111         <xsl:text>\smbconfsection{</xsl:text>
112         <xsl:call-template name="scape">
113                 <xsl:with-param name="string" select="@name"/>
114         </xsl:call-template>
115         <xsl:text>}</xsl:text>
116 </xsl:template>
117
118 <xsl:template match="imagefile">
119         <xsl:text>\includegraphics[scale=</xsl:text>
120         <xsl:choose>
121                 <xsl:when test="@scale != ''"><xsl:value-of select="@scale div 100"/></xsl:when>
122
123                 <xsl:otherwise><xsl:text>.50</xsl:text></xsl:otherwise>
124         </xsl:choose>
125         <xsl:text>]{</xsl:text>
126         <xsl:value-of select="$latex.imagebasedir"/><xsl:text>images/</xsl:text>
127         <xsl:value-of select="text()"/>
128         <xsl:text>}&#10;</xsl:text>
129 </xsl:template>
130
131 </xsl:stylesheet>