New elements: newline, newpage
[xmldoc.git] / latex.xsl
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0"
3                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4                 xmlns="http://www.w3.org/TR/xhtml1/strict">
5
6 <xsl:strip-space elements="doc chapter section"/>
7 <xsl:output method="text" indent="yes" encoding="iso-8859-1"/>
8
9 <xsl:template match="article">
10 \documentclass[a4paper]{article}
11 \usepackage{graphics}
12 \usepackage{latexsym}
13 \usepackage{marvosym}
14 \begin{document}
15    <xsl:apply-templates/>
16 \end{document}
17 </xsl:template>
18
19 <xsl:template match="book">
20 \documentclass[a4paper]{book}
21 \usepackage{graphics}
22 \usepackage{latexsym}
23 \usepackage{marvosym}
24 \begin{document}
25    <xsl:apply-templates/>
26 \end{document}
27 </xsl:template>
28
29 <xsl:template match="report">
30 \documentclass[a4paper]{report}
31 \usepackage{graphics}
32 \usepackage{latexsym}
33 \usepackage{marvosym}
34 \begin{document}
35    <xsl:apply-templates/>
36 \end{document}
37 </xsl:template>
38
39 <xsl:template match="titlepage">
40    \begin{titlepage}
41    <xsl:apply-templates/>
42    \end{titlepage}
43 </xsl:template>
44
45 <xsl:template match="title">
46    \begin{center}
47    \sffamily\bfseries\LARGE{<xsl:apply-templates/>}
48    \end{center}
49 </xsl:template>
50
51 <xsl:template match="subtitle">
52    \begin{center}
53    \sffamily\bfseries\Large{<xsl:apply-templates/>}
54    \end{center}
55 </xsl:template>
56
57 <xsl:template match="author">
58    \begin{center}
59    \sffamily{<xsl:apply-templates/>}
60    \end{center}
61 </xsl:template>
62
63 <xsl:template match="date">
64    \begin{center}
65    \sffamily{<xsl:apply-templates/>}
66    \end{center}
67 </xsl:template>
68
69 <xsl:template match="docinfo">
70    \begin{tabular}{|l|l|}
71    \hline
72    \multicolumn{2}{|c|}{\textbf{Document Information}} \\
73    \hline
74    <xsl:apply-templates/>
75    \end{tabular}
76 </xsl:template>
77
78 <xsl:template match="infoitem">
79      <xsl:value-of select="@label"/> &amp;
80      <xsl:apply-templates/> \\
81      \hline
82 </xsl:template>
83
84 <xsl:template match="abstract">
85    
86    \vspace{0.5cm}
87    \begin{bfseries}Abstract:\end{bfseries}
88
89    \begin{quote}
90    <xsl:apply-templates/>
91    \end{quote}
92 </xsl:template>
93
94 <xsl:template match="toc">
95 \tableofcontents
96 \newpage
97 </xsl:template>
98
99 <xsl:template match="chapter/heading">
100    \chapter{<xsl:apply-templates/>}
101 </xsl:template>
102
103 <xsl:template match="section/heading">
104    \section{<xsl:apply-templates/>}
105 </xsl:template>
106
107 <xsl:template match="subsection/heading">
108    \subsection{<xsl:apply-templates/>}
109 </xsl:template>
110
111 <xsl:template match="subsubsection/heading">
112    \subsubsection{<xsl:apply-templates/>}
113 </xsl:template>
114
115 <xsl:template match="paragraph/heading">
116    \paragraph{<xsl:apply-templates/>}
117 </xsl:template>
118
119 <xsl:template match="subparagraph/heading">
120    \subparagraph{<xsl:apply-templates/>}
121 </xsl:template>
122
123 <xsl:template match="para">
124    
125      <xsl:apply-templates/>
126 </xsl:template>
127
128 <xsl:template match="quote">
129 \begin{quote} 
130      <xsl:apply-templates/>
131 \end{quote}
132 </xsl:template>
133
134 <xsl:template match="verbatim">
135 \begin{verbatim} 
136      <xsl:apply-templates/>
137 \end{verbatim}
138 </xsl:template>
139
140 <xsl:template match="itemize">
141 \begin{itemize}
142    <xsl:apply-templates/>
143 \end{itemize}
144 </xsl:template>
145
146 <xsl:template match="enumerate">
147 \begin{enumerate}
148    <xsl:apply-templates/>
149 \end{enumerate}
150 </xsl:template>
151
152 <xsl:template match="item">
153 \item <xsl:apply-templates/>
154 </xsl:template>
155
156 <xsl:template match="footnote">\footnote{<xsl:apply-templates/>}</xsl:template>
157
158 <xsl:template match="emph">\begin{itshape}<xsl:apply-templates/>\end{itshape}</xsl:template>
159
160 <xsl:template match="strong">\begin{bfseries}<xsl:apply-templates/>\end{bfseries}</xsl:template>
161
162 <xsl:template match="code">\begin{ttfamily}<xsl:apply-templates/>\end{ttfamily}</xsl:template>
163
164 <xsl:template match="remark">\begin{slshape}<xsl:apply-templates/>\end{slshape}</xsl:template>
165
166 <xsl:template match="sub">$_{<xsl:apply-templates/>}$</xsl:template>
167 <xsl:template match="sup">$^{<xsl:apply-templates/>}$</xsl:template>
168
169 <xsl:template match="newline">\\</xsl:template>
170 <xsl:template match="newpage">\newpage</xsl:template>
171
172 <xsl:template match="table">
173 \begin{tabular}{<xsl:value-of select="@cpos"/>c}
174 <xsl:apply-templates/>
175 \end{tabular}
176 </xsl:template>
177
178 <xsl:template match="thead">
179 <xsl:apply-templates/>\\
180 </xsl:template>
181
182 <xsl:template match="thead/col">
183 \begin{bfseries}<xsl:apply-templates/>\end{bfseries}&amp;
184 </xsl:template>
185
186 <xsl:template match="row">
187 <xsl:apply-templates/>\\
188 </xsl:template>
189
190 <xsl:template match="row/col">
191 <xsl:apply-templates/>&amp;
192 </xsl:template>
193
194 <xsl:template match="picture">
195 \scalebox{<xsl:value-of select="@scale"/>}{\includegraphics{<xsl:value-of select="@eps"/>}}
196 </xsl:template>
197
198 <xsl:template match="label">\label{<xsl:value-of select="@name"/>}</xsl:template>
199
200 <xsl:template match="ref"><xsl:apply-templates/>\ref{<xsl:value-of select="@to"/>}</xsl:template>
201 <xsl:template match="page"><xsl:apply-templates/>\pageref{<xsl:value-of select="@to"/>}</xsl:template>
202 <xsl:template match="reference">
203 <xsl:apply-templates/>[<xsl:value-of select="@href"/>]
204 </xsl:template>
205
206 <xsl:template match="include">
207    <xsl:apply-templates select="document(@href)"/>
208 </xsl:template>
209
210 <xsl:template match="LaTeX">
211  <xsl:value-of select="@command"/>
212 </xsl:template>
213 </xsl:stylesheet>
214