1 | <?xml version="1.0"?>
|
---|
2 |
|
---|
3 | <!--
|
---|
4 | docbook2latex.xslt:
|
---|
5 | translates a DocBook XML source into a LaTeX source file,
|
---|
6 | which can be processed with pdflatex to produce a
|
---|
7 | pretty PDF file.
|
---|
8 |
|
---|
9 | Note: In the LaTeX output, this XSLT encodes all quotes
|
---|
10 | with \QUOTE{} commands, which are not defined in this
|
---|
11 | file. This is because XSLT does not support regular
|
---|
12 | expressions natively and therefore it is rather difficult
|
---|
13 | to implement proper "pretty quotes" (different glyphs for
|
---|
14 | opening and closing quotes) in XSLT. The doc/manual/
|
---|
15 | makefile solves this by running sed over the LaTeX source
|
---|
16 | once more, replacing all \QUOTE{} commands with
|
---|
17 | \OQ{} and \CQ{} commands, which _are_ defined to the
|
---|
18 | pretty quotes for English in the LaTeX output generated
|
---|
19 | by this XSLT (see below).
|
---|
20 |
|
---|
21 | Copyright (C) 2006-2012 Oracle Corporation
|
---|
22 |
|
---|
23 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
24 | available from http://www.virtualbox.org. This file is free software;
|
---|
25 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
26 | General Public License (GPL) as published by the Free Software
|
---|
27 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
28 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
29 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
30 | -->
|
---|
31 |
|
---|
32 | <xsl:stylesheet
|
---|
33 | version="1.0"
|
---|
34 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
35 | xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
---|
36 | xmlns:str="http://xsltsl.org/string"
|
---|
37 | >
|
---|
38 |
|
---|
39 | <xsl:import href="string.xsl"/>
|
---|
40 |
|
---|
41 | <xsl:variable name="g_nlsChapter">
|
---|
42 | <xsl:choose>
|
---|
43 | <xsl:when test="$TARGETLANG='de_DE'">Kapitel</xsl:when>
|
---|
44 | <xsl:when test="$TARGETLANG='fr_FR'">chapitre</xsl:when>
|
---|
45 | <xsl:when test="$TARGETLANG='en_US'">chapter</xsl:when>
|
---|
46 | <xsl:otherwise>
|
---|
47 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
48 | </xsl:otherwise>
|
---|
49 | </xsl:choose>
|
---|
50 | </xsl:variable>
|
---|
51 |
|
---|
52 | <xsl:variable name="g_nlsPage">
|
---|
53 | <xsl:choose>
|
---|
54 | <xsl:when test="$TARGETLANG='de_DE'">auf Seite</xsl:when>
|
---|
55 | <xsl:when test="$TARGETLANG='fr_FR'">page</xsl:when>
|
---|
56 | <xsl:when test="$TARGETLANG='en_US'">page</xsl:when>
|
---|
57 | <xsl:otherwise>
|
---|
58 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
59 | </xsl:otherwise>
|
---|
60 | </xsl:choose>
|
---|
61 | </xsl:variable>
|
---|
62 |
|
---|
63 | <xsl:variable name="g_nlsNote">
|
---|
64 | <xsl:choose>
|
---|
65 | <xsl:when test="$TARGETLANG='de_DE'">Hinweis</xsl:when>
|
---|
66 | <xsl:when test="$TARGETLANG='fr_FR'">Note</xsl:when>
|
---|
67 | <xsl:when test="$TARGETLANG='en_US'">Note</xsl:when>
|
---|
68 | <xsl:otherwise>
|
---|
69 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
70 | </xsl:otherwise>
|
---|
71 | </xsl:choose>
|
---|
72 | </xsl:variable>
|
---|
73 |
|
---|
74 | <xsl:variable name="g_nlsWarning">
|
---|
75 | <xsl:choose>
|
---|
76 | <xsl:when test="$TARGETLANG='de_DE'">Warnung</xsl:when>
|
---|
77 | <xsl:when test="$TARGETLANG='fr_FR'">Avertissement</xsl:when>
|
---|
78 | <xsl:when test="$TARGETLANG='en_US'">Warning</xsl:when>
|
---|
79 | <xsl:otherwise>
|
---|
80 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
81 | </xsl:otherwise>
|
---|
82 | </xsl:choose>
|
---|
83 | </xsl:variable>
|
---|
84 |
|
---|
85 | <xsl:output method="text"/>
|
---|
86 |
|
---|
87 | <xsl:strip-space elements="*"/>
|
---|
88 | <xsl:preserve-space elements="para"/>
|
---|
89 |
|
---|
90 | <xsl:template match="/book">
|
---|
91 | <xsl:text>
|
---|
92 | \documentclass[oneside,a4paper,10pt,DIV10]{scrbook}
|
---|
93 | \usepackage{geometry}
|
---|
94 | \geometry{top=3cm,bottom=4cm}
|
---|
95 | \usepackage{ucs}
|
---|
96 | \usepackage[utf8x]{inputenc}
|
---|
97 | \usepackage[T1]{fontenc}
|
---|
98 | \usepackage{tabulary}
|
---|
99 | \usepackage[pdftex,
|
---|
100 | a4paper,
|
---|
101 | colorlinks=true,
|
---|
102 | linkcolor=blue,
|
---|
103 | urlcolor=darkgreen,
|
---|
104 | bookmarksnumbered,
|
---|
105 | bookmarksopen=true,
|
---|
106 | bookmarksopenlevel=0,
|
---|
107 | hyperfootnotes=false,
|
---|
108 | plainpages=false,
|
---|
109 | pdfpagelabels
|
---|
110 | ]{hyperref}
|
---|
111 |
|
---|
112 | \usepackage{nameref}
|
---|
113 | \usepackage{graphicx}
|
---|
114 | \usepackage{fancybox}
|
---|
115 | \usepackage{fancyvrb}
|
---|
116 | \usepackage{alltt}
|
---|
117 | \usepackage{color}
|
---|
118 | \usepackage{scrextend}
|
---|
119 | \definecolor{darkgreen}{rgb}{0,0.6,0}
|
---|
120 |
|
---|
121 | </xsl:text>
|
---|
122 | <xsl:if test="$TARGETLANG='de_DE'">\usepackage[ngerman]{babel} \PrerenderUnicode{ü}</xsl:if>
|
---|
123 | <!-- <xsl:if test="$TARGETLANG='fr_FR'">\usepackage[french]{babel} \FrenchItemizeSpacingfalse \renewcommand{\FrenchLabelItem}{\textbullet}</xsl:if>
|
---|
124 | this command is no longer understood by TexLive2008
|
---|
125 | -->
|
---|
126 | <xsl:text>
|
---|
127 |
|
---|
128 | % use Palatino as serif font:
|
---|
129 | % \usepackage{mathpazo}
|
---|
130 | \usepackage{charter}
|
---|
131 | % use Helvetica as sans-serif font:
|
---|
132 | \usepackage{helvet}
|
---|
133 |
|
---|
134 | % use Bera Mono (a variant of Bitstream Vera Mono) as typewriter font
|
---|
135 | % (requires texlive-fontsextra)
|
---|
136 | \usepackage[scaled]{beramono}
|
---|
137 | % previously: use Courier as typewriter font:
|
---|
138 | % \usepackage{courier}
|
---|
139 |
|
---|
140 | \definecolor{colNote}{rgb}{0,0,0}
|
---|
141 | \definecolor{colWarning}{rgb}{0,0,0}
|
---|
142 | \definecolor{colScreenFrame}{rgb}{0,0,0}
|
---|
143 | \definecolor{colScreenText}{rgb}{0,0,0}
|
---|
144 |
|
---|
145 | % number headings down to this level
|
---|
146 | \setcounter{secnumdepth}{3}
|
---|
147 | % more space for the section numbers
|
---|
148 | \makeatletter
|
---|
149 | \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.9em}}
|
---|
150 | \renewcommand*\l@subsection{\@dottedtocline{2}{4.4em}{3.8em}}
|
---|
151 | \renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{3.8em}}
|
---|
152 | \renewcommand*\@pnumwidth{1.7em}
|
---|
153 | \renewcommand*\@tocrmarg{5.0em}
|
---|
154 | \makeatother
|
---|
155 |
|
---|
156 | % more tolerance at 2nd wrap stage:
|
---|
157 | \tolerance = 1000
|
---|
158 | % allow 3rd wrap stage:
|
---|
159 | \emergencystretch = 10pt
|
---|
160 | % no Schusterjungen:
|
---|
161 | \clubpenalty = 10000
|
---|
162 | % no Hurenkinder:
|
---|
163 | \widowpenalty = 10000
|
---|
164 | \displaywidowpenalty = 10000
|
---|
165 | % max pdf compression:
|
---|
166 | \pdfcompresslevel9
|
---|
167 |
|
---|
168 | % opening and closing quotes: the OQ and CQ macros define this (and the makefile employs some sed magic also)
|
---|
169 | </xsl:text>
|
---|
170 | <xsl:choose>
|
---|
171 | <xsl:when test="$TARGETLANG='de_DE'">
|
---|
172 | <xsl:text>\newcommand\OQ{\texorpdfstring{\glqq}{"}} \newcommand\CQ{\texorpdfstring{\grqq}{"}} </xsl:text>
|
---|
173 | </xsl:when>
|
---|
174 | <xsl:when test="$TARGETLANG='fr_FR'">
|
---|
175 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
176 | </xsl:when>
|
---|
177 | <xsl:when test="$TARGETLANG='en_US'">
|
---|
178 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
179 | </xsl:when>
|
---|
180 | <xsl:otherwise>
|
---|
181 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
182 | </xsl:otherwise>
|
---|
183 | </xsl:choose>
|
---|
184 |
|
---|
185 | <xsl:apply-templates />
|
---|
186 |
|
---|
187 | <xsl:text>
|
---|
188 | \end{document}
|
---|
189 | </xsl:text>
|
---|
190 |
|
---|
191 | </xsl:template>
|
---|
192 |
|
---|
193 | <xsl:template match="bookinfo">
|
---|
194 | <xsl:apply-templates />
|
---|
195 | <xsl:text>
\newcommand\docbookbookinfocopyright{\copyright{} \docbookbookinfocopyrightyear{} \docbookbookinfocopyrightholder{}}

|
---|
196 | \author{ \docbooktitleedition \\ %
|
---|
197 | \\ %
|
---|
198 | </xsl:text>
|
---|
199 | <xsl:if test="//bookinfo/address">
|
---|
200 | <xsl:text>\docbookbookinfoaddress \\ %
|
---|
201 | \\ %
|
---|
202 | </xsl:text>
|
---|
203 | </xsl:if>
|
---|
204 | <xsl:text>\docbookbookinfocopyright \\ %
|
---|
205 | }
|
---|
206 |
|
---|
207 | \title{\docbooktitle \\
|
---|
208 | \docbooksubtitle}
|
---|
209 | % \subtitle{\docbooksubtitle}
|
---|
210 | \hypersetup{pdfauthor=\docbookcorpauthor}
|
---|
211 | \hypersetup{pdftitle=\docbooktitle{} \docbooksubtitle{}}
|
---|
212 |
|
---|
213 | \hyphenation{da-ta-ba-ses}
|
---|
214 | \hyphenation{deb-conf}
|
---|
215 | \hyphenation{VirtualBox}
|
---|
216 |
|
---|
217 | \begin{document}
|
---|
218 | % \maketitle
|
---|
219 | %\begin{titlepage}
|
---|
220 | \thispagestyle{empty}
|
---|
221 | \begin{minipage}{\textwidth}
|
---|
222 | \begin{center}
|
---|
223 | \includegraphics[width=4cm]{images/vboxlogo.png}
|
---|
224 | \end{center}%
|
---|
225 | \vspace{10mm}
|
---|
226 |
|
---|
227 | {\fontsize{40pt}{40pt}\selectfont\rmfamily\bfseries%
|
---|
228 | \begin{center}
|
---|
229 | \docbooktitle
|
---|
230 | \end{center}%
|
---|
231 | \vspace{10mm}
|
---|
232 | }
|
---|
233 |
|
---|
234 | {\fontsize{30pt}{30pt}\selectfont\rmfamily\bfseries%
|
---|
235 | \begin{center}
|
---|
236 | \docbooksubtitle
|
---|
237 | \end{center}%
|
---|
238 | \vspace{10mm}
|
---|
239 | }
|
---|
240 |
|
---|
241 | {\fontsize{16pt}{20pt}\selectfont\rmfamily%
|
---|
242 | \begin{center}
|
---|
243 | </xsl:text>
|
---|
244 | <xsl:if test="//bookinfo/othercredit">
|
---|
245 | <xsl:text>\docbookbookinfoothercreditcontrib{}: \docbookbookinfoothercreditfirstname{} \docbookbookinfoothercreditsurname
|
---|
246 |
|
---|
247 | \vspace{8mm}
|
---|
248 | </xsl:text>
|
---|
249 | </xsl:if>
|
---|
250 | <xsl:text>\docbooktitleedition
|
---|
251 |
|
---|
252 | \vspace{2mm}
|
---|
253 |
|
---|
254 | \docbookbookinfocopyright
|
---|
255 |
|
---|
256 | \vspace{2mm}
|
---|
257 |
|
---|
258 | \docbookbookinfoaddress
|
---|
259 | \end{center}%
|
---|
260 | }
|
---|
261 |
|
---|
262 | %\end{titlepage}
|
---|
263 | \end{minipage}
|
---|
264 |
|
---|
265 | \tableofcontents
|
---|
266 | </xsl:text>
|
---|
267 | </xsl:template>
|
---|
268 |
|
---|
269 | <xsl:template match="subtitle">
|
---|
270 | <xsl:choose>
|
---|
271 | <xsl:when test="name(..)='bookinfo'">
|
---|
272 | <xsl:text>\newcommand\docbooksubtitle{</xsl:text>
|
---|
273 | <xsl:apply-templates />
|
---|
274 | <xsl:text>}</xsl:text>
|
---|
275 | </xsl:when>
|
---|
276 | </xsl:choose>
|
---|
277 | </xsl:template>
|
---|
278 |
|
---|
279 | <xsl:template match="title">
|
---|
280 | <xsl:choose>
|
---|
281 | <xsl:when test="name(..)='bookinfo'">
|
---|
282 | <xsl:text>\newcommand\docbooktitle{</xsl:text>
|
---|
283 | <xsl:apply-templates />
|
---|
284 | <xsl:text>}</xsl:text>
|
---|
285 | </xsl:when>
|
---|
286 | <xsl:when test="name(..)='chapter'">
|
---|
287 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
288 | <xsl:text>
\chapter{</xsl:text>
|
---|
289 | <xsl:apply-templates />
|
---|
290 | <xsl:text>}</xsl:text>
|
---|
291 | </xsl:when>
|
---|
292 | <xsl:when test="name(..)='sect1'">
|
---|
293 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
294 | <xsl:text>
\section{</xsl:text>
|
---|
295 | <xsl:apply-templates />
|
---|
296 | <xsl:text>}</xsl:text>
|
---|
297 | </xsl:when>
|
---|
298 | <xsl:when test="name(..)='sect2'">
|
---|
299 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
300 | <xsl:text>
\subsection{</xsl:text>
|
---|
301 | <xsl:apply-templates />
|
---|
302 | <xsl:text>}</xsl:text>
|
---|
303 | </xsl:when>
|
---|
304 | <xsl:when test="name(..)='sect3'">
|
---|
305 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
306 | <xsl:text>
\subsubsection{</xsl:text>
|
---|
307 | <xsl:apply-templates />
|
---|
308 | <xsl:text>}</xsl:text>
|
---|
309 | </xsl:when>
|
---|
310 | <xsl:when test="name(..)='sect4'">
|
---|
311 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
312 | <xsl:text>
\paragraph{</xsl:text>
|
---|
313 | <xsl:apply-templates />
|
---|
314 | <xsl:text>}</xsl:text>
|
---|
315 | </xsl:when>
|
---|
316 | <xsl:when test="name(..)='sect5'">
|
---|
317 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
318 | <xsl:text>
\subparagraph{</xsl:text>
|
---|
319 | <xsl:apply-templates />
|
---|
320 | <xsl:text>}</xsl:text>
|
---|
321 | </xsl:when>
|
---|
322 | <xsl:when test="name(..)='refsect1'">
|
---|
323 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
324 | <xsl:text>
\paragraph{</xsl:text>
|
---|
325 | <xsl:apply-templates />
|
---|
326 | <xsl:text>}
\begin{addmargin}{1em}
</xsl:text> <!-- addmargin is ended by refsect1 template way further down. -->
|
---|
327 | </xsl:when>
|
---|
328 | <xsl:when test="name(..)='refsect2'">
|
---|
329 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
330 | <xsl:text>
\subparagraph{</xsl:text>
|
---|
331 | <xsl:apply-templates />
|
---|
332 | <xsl:text>}</xsl:text>
|
---|
333 | </xsl:when>
|
---|
334 | <xsl:when test="name(..)='appendix'">
|
---|
335 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
336 | <xsl:text>
\chapter{</xsl:text>
|
---|
337 | <xsl:apply-templates />
|
---|
338 | <xsl:text>}</xsl:text>
|
---|
339 | </xsl:when>
|
---|
340 | <xsl:when test="name(..)='glossdiv'">
|
---|
341 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
342 | <xsl:text>
\section*{</xsl:text>
|
---|
343 | <xsl:apply-templates />
|
---|
344 | <xsl:text>}</xsl:text>
|
---|
345 | </xsl:when>
|
---|
346 | </xsl:choose>
|
---|
347 | <xsl:variable name="refid" select="../@id" />
|
---|
348 | <xsl:if test="$refid">
|
---|
349 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
350 | </xsl:if>
|
---|
351 | <xsl:text>
</xsl:text>
|
---|
352 | </xsl:template>
|
---|
353 |
|
---|
354 | <xsl:template match="edition">
|
---|
355 | <xsl:choose>
|
---|
356 | <xsl:when test="name(..)='bookinfo'">
|
---|
357 | <xsl:text>\newcommand\docbooktitleedition{</xsl:text>
|
---|
358 | <xsl:apply-templates />
|
---|
359 | <xsl:text>}
</xsl:text>
|
---|
360 | </xsl:when>
|
---|
361 | </xsl:choose>
|
---|
362 | </xsl:template>
|
---|
363 |
|
---|
364 | <xsl:template match="corpauthor">
|
---|
365 | <xsl:choose>
|
---|
366 | <xsl:when test="name(..)='bookinfo'">
|
---|
367 | <xsl:text>\newcommand\docbookcorpauthor{</xsl:text>
|
---|
368 | <xsl:apply-templates />
|
---|
369 | <xsl:text>}
</xsl:text>
|
---|
370 | </xsl:when>
|
---|
371 | </xsl:choose>
|
---|
372 | </xsl:template>
|
---|
373 |
|
---|
374 | <xsl:template match="address">
|
---|
375 | <xsl:choose>
|
---|
376 | <xsl:when test="name(..)='bookinfo'">
|
---|
377 | <xsl:text>\newcommand\docbookbookinfoaddress{</xsl:text>
|
---|
378 | <xsl:apply-templates />
|
---|
379 | <xsl:text>}
</xsl:text>
|
---|
380 | </xsl:when>
|
---|
381 | </xsl:choose>
|
---|
382 | </xsl:template>
|
---|
383 |
|
---|
384 | <xsl:template match="year">
|
---|
385 | <xsl:choose>
|
---|
386 | <xsl:when test="name(..)='copyright'">
|
---|
387 | <xsl:text>\newcommand\docbookbookinfocopyrightyear{</xsl:text>
|
---|
388 | <xsl:apply-templates />
|
---|
389 | <xsl:text>}
</xsl:text>
|
---|
390 | </xsl:when>
|
---|
391 | </xsl:choose>
|
---|
392 | </xsl:template>
|
---|
393 |
|
---|
394 | <xsl:template match="holder">
|
---|
395 | <xsl:choose>
|
---|
396 | <xsl:when test="name(..)='copyright'">
|
---|
397 | <xsl:text>\newcommand\docbookbookinfocopyrightholder{</xsl:text>
|
---|
398 | <xsl:apply-templates />
|
---|
399 | <xsl:text>}
</xsl:text>
|
---|
400 | </xsl:when>
|
---|
401 | </xsl:choose>
|
---|
402 | </xsl:template>
|
---|
403 |
|
---|
404 | <xsl:template match="firstname">
|
---|
405 | <xsl:choose>
|
---|
406 | <xsl:when test="name(..)='othercredit'">
|
---|
407 | <xsl:text>\newcommand\docbookbookinfoothercreditfirstname{</xsl:text>
|
---|
408 | <xsl:apply-templates />
|
---|
409 | <xsl:text>}
</xsl:text>
|
---|
410 | </xsl:when>
|
---|
411 | </xsl:choose>
|
---|
412 | </xsl:template>
|
---|
413 |
|
---|
414 | <xsl:template match="surname">
|
---|
415 | <xsl:choose>
|
---|
416 | <xsl:when test="name(..)='othercredit'">
|
---|
417 | <xsl:text>\newcommand\docbookbookinfoothercreditsurname{</xsl:text>
|
---|
418 | <xsl:apply-templates />
|
---|
419 | <xsl:text>}
</xsl:text>
|
---|
420 | </xsl:when>
|
---|
421 | </xsl:choose>
|
---|
422 | </xsl:template>
|
---|
423 |
|
---|
424 | <xsl:template match="contrib">
|
---|
425 | <xsl:choose>
|
---|
426 | <xsl:when test="name(..)='othercredit'">
|
---|
427 | <xsl:text>\newcommand\docbookbookinfoothercreditcontrib{</xsl:text>
|
---|
428 | <xsl:apply-templates />
|
---|
429 | <xsl:text>}
</xsl:text>
|
---|
430 | </xsl:when>
|
---|
431 | </xsl:choose>
|
---|
432 | </xsl:template>
|
---|
433 |
|
---|
434 | <xsl:template match="glossary">
|
---|
435 | <xsl:text>

\backmatter
\chapter{Glossary}
</xsl:text>
|
---|
436 | <xsl:apply-templates />
|
---|
437 | </xsl:template>
|
---|
438 |
|
---|
439 | <xsl:template match="para">
|
---|
440 | <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or (name(../..)='varlistentry' and position()=1))">
|
---|
441 | <xsl:text>

</xsl:text>
|
---|
442 | </xsl:if>
|
---|
443 | <xsl:apply-templates />
|
---|
444 | </xsl:template>
|
---|
445 |
|
---|
446 | <xsl:template match="note">
|
---|
447 | <xsl:value-of select="concat('

\vspace{.2cm}

\begin{center}\fbox{\begin{minipage}[c]{0.9\textwidth}\color{colNote}\textbf{', $g_nlsNote, ':} ')" />
|
---|
448 | <xsl:apply-templates />
|
---|
449 | <xsl:text>\end{minipage}}\end{center}

\vspace{.2cm}

</xsl:text>
|
---|
450 | </xsl:template>
|
---|
451 |
|
---|
452 | <xsl:template match="warning">
|
---|
453 | <xsl:value-of select="concat('

\vspace{.2cm}

\begin{center}\fbox{\begin{minipage}[c]{0.9\textwidth}\color{colWarning}\textbf{', $g_nlsWarning, ':} ')" />
|
---|
454 | <xsl:apply-templates />
|
---|
455 | <xsl:text>\end{minipage}}\end{center}

\vspace{.2cm}

</xsl:text>
|
---|
456 | </xsl:template>
|
---|
457 |
|
---|
458 | <xsl:template match="screen">
|
---|
459 | <xsl:text>

\begin{Verbatim}[fontsize=\footnotesize]
</xsl:text>
|
---|
460 | <xsl:apply-templates />
|
---|
461 | <xsl:text>
\end{Verbatim}
</xsl:text>
|
---|
462 | </xsl:template>
|
---|
463 |
|
---|
464 | <xsl:template match="programlisting">
|
---|
465 | <xsl:text>

{\small\begin{alltt}
</xsl:text>
|
---|
466 | <xsl:apply-templates />
|
---|
467 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
468 | </xsl:template>
|
---|
469 |
|
---|
470 | <xsl:template match="footnote">
|
---|
471 | <xsl:text>\footnote{</xsl:text>
|
---|
472 | <xsl:apply-templates />
|
---|
473 | <xsl:text>}</xsl:text>
|
---|
474 | </xsl:template>
|
---|
475 |
|
---|
476 | <xsl:template match="tgroup">
|
---|
477 | <xsl:choose>
|
---|
478 | <xsl:when test="@style='verywide'">
|
---|
479 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{1.1\textwidth}[]{|L|L|L|}
\hline
</xsl:text>
|
---|
480 | </xsl:when>
|
---|
481 | <xsl:otherwise>
|
---|
482 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{.9\textwidth}[]{|L|L|L|}
\hline
</xsl:text>
|
---|
483 | </xsl:otherwise>
|
---|
484 | </xsl:choose>
|
---|
485 | <xsl:apply-templates />
|
---|
486 | <xsl:text>
\end{tabulary}
\end{center}}
</xsl:text>
|
---|
487 | </xsl:template>
|
---|
488 |
|
---|
489 | <xsl:template match="row">
|
---|
490 | <xsl:apply-templates />
|
---|
491 | <xsl:text>
\\ \hline
</xsl:text>
|
---|
492 | </xsl:template>
|
---|
493 |
|
---|
494 | <xsl:template match="entry">
|
---|
495 | <xsl:if test="not(position()=1)">
|
---|
496 | <xsl:text> & </xsl:text>
|
---|
497 | </xsl:if>
|
---|
498 | <xsl:apply-templates />
|
---|
499 | </xsl:template>
|
---|
500 |
|
---|
501 | <xsl:template match="itemizedlist">
|
---|
502 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
503 | <xsl:text>
\begin{itemize}
</xsl:text>
|
---|
504 | <xsl:apply-templates />
|
---|
505 | <xsl:text>
\end{itemize}
</xsl:text>
|
---|
506 | </xsl:template>
|
---|
507 |
|
---|
508 | <xsl:template match="orderedlist">
|
---|
509 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
510 | <xsl:text>
\begin{enumerate}
</xsl:text>
|
---|
511 | <xsl:apply-templates />
|
---|
512 | <xsl:text>
\end{enumerate}
</xsl:text>
|
---|
513 | </xsl:template>
|
---|
514 |
|
---|
515 | <xsl:template match="variablelist">
|
---|
516 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
517 | <xsl:text>
\begin{description}
</xsl:text>
|
---|
518 | <xsl:apply-templates />
|
---|
519 | <xsl:text>
\end{description}
</xsl:text>
|
---|
520 | </xsl:template>
|
---|
521 |
|
---|
522 | <xsl:template match="varlistentry">
|
---|
523 | <xsl:if test="not(./term) or not(./listitem) or count(*) != 2">
|
---|
524 | <xsl:message terminate="yes">Expected exactly one term and one listitem element in the varlistentry.</xsl:message>
|
---|
525 | </xsl:if>
|
---|
526 | <xsl:text>

\item[</xsl:text>
|
---|
527 | <xsl:apply-templates select="term"/>
|
---|
528 | <xsl:text>] \hfill \\
</xsl:text>
|
---|
529 | <xsl:apply-templates select="listitem/*"/>
|
---|
530 | </xsl:template>
|
---|
531 |
|
---|
532 | <xsl:template match="listitem">
|
---|
533 | <xsl:text>

\item </xsl:text>
|
---|
534 | <xsl:apply-templates />
|
---|
535 | <xsl:text>
</xsl:text>
|
---|
536 | </xsl:template>
|
---|
537 |
|
---|
538 | <xsl:template match="glossterm">
|
---|
539 | <xsl:variable name="refid" select="(@id)" />
|
---|
540 | <xsl:if test="$refid">
|
---|
541 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
542 | </xsl:if>
|
---|
543 | <xsl:text>

\item[</xsl:text>
|
---|
544 | <xsl:apply-templates />
|
---|
545 | <xsl:text>]</xsl:text>
|
---|
546 | </xsl:template>
|
---|
547 |
|
---|
548 | <xsl:template match="glosslist | glossdiv">
|
---|
549 | <xsl:text>

\begin{description}
</xsl:text>
|
---|
550 | <xsl:apply-templates />
|
---|
551 | <xsl:text>
\end{description}
</xsl:text>
|
---|
552 | </xsl:template>
|
---|
553 |
|
---|
554 | <xsl:template match="superscript">
|
---|
555 | <xsl:variable name="contents">
|
---|
556 | <xsl:apply-templates />
|
---|
557 | </xsl:variable>
|
---|
558 | <xsl:value-of select="concat('\texorpdfstring{\textsuperscript{', $contents, '}}{', $contents, '}')" />
|
---|
559 | </xsl:template>
|
---|
560 |
|
---|
561 | <xsl:template match="emphasis">
|
---|
562 | <xsl:choose>
|
---|
563 | <xsl:when test="@role='bold'">
|
---|
564 | <xsl:text>\textbf{</xsl:text>
|
---|
565 | </xsl:when>
|
---|
566 | <xsl:otherwise>
|
---|
567 | <xsl:text>\textit{</xsl:text>
|
---|
568 | </xsl:otherwise>
|
---|
569 | </xsl:choose>
|
---|
570 | <xsl:apply-templates />
|
---|
571 | <xsl:text>}</xsl:text>
|
---|
572 | </xsl:template>
|
---|
573 |
|
---|
574 | <xsl:template match="computeroutput | code">
|
---|
575 | <xsl:text>\texttt{</xsl:text>
|
---|
576 | <xsl:apply-templates />
|
---|
577 | <xsl:text>}</xsl:text>
|
---|
578 | </xsl:template>
|
---|
579 |
|
---|
580 | <xsl:template match="ulink">
|
---|
581 | <xsl:text>\url{</xsl:text>
|
---|
582 | <xsl:apply-templates />
|
---|
583 | <xsl:text>}</xsl:text>
|
---|
584 | </xsl:template>
|
---|
585 |
|
---|
586 | <xsl:template match="xref">
|
---|
587 | <xsl:choose>
|
---|
588 | <xsl:when test="@xreflabel">
|
---|
589 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @xreflabel, '}}')" />
|
---|
590 | </xsl:when>
|
---|
591 | <xsl:when test="@apiref='yes'">
|
---|
592 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{')" />
|
---|
593 | <xsl:apply-templates />
|
---|
594 | <xsl:value-of select="'}}'" />
|
---|
595 | </xsl:when>
|
---|
596 | <xsl:otherwise>
|
---|
597 | <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
|
---|
598 | </xsl:otherwise>
|
---|
599 | </xsl:choose>
|
---|
600 | </xsl:template>
|
---|
601 |
|
---|
602 | <!-- for some reason, DocBook insists of having image data nested this way always:
|
---|
603 | mediaobject -> imageobject -> imagedata
|
---|
604 | but only imagedata is interesting -->
|
---|
605 | <xsl:template match="imagedata">
|
---|
606 | <xsl:if test="@align='center'">
|
---|
607 | <xsl:text>\begin{center}</xsl:text>
|
---|
608 | </xsl:if>
|
---|
609 | <xsl:value-of select="concat('
\includegraphics[width=', @width, ']{', @fileref, '}
')" />
|
---|
610 | <xsl:apply-templates />
|
---|
611 | <xsl:if test="@align='center'">
|
---|
612 | <xsl:text>\end{center}</xsl:text>
|
---|
613 | </xsl:if>
|
---|
614 | </xsl:template>
|
---|
615 |
|
---|
616 | <!--
|
---|
617 | Turn the refsynopsisdiv part of a manpage into a named & indented paragraph.
|
---|
618 | -->
|
---|
619 | <xsl:template match="refsynopsisdiv">
|
---|
620 | <xsl:if test="name(*[1]) != 'cmdsynopsis'"><xsl:message terminate="yes">Expected refsynopsisdiv to start with cmdsynopsis</xsl:message></xsl:if>
|
---|
621 | <xsl:if test="title"><xsl:message terminate="yes">No title element supported in refsynopsisdiv</xsl:message></xsl:if>
|
---|
622 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
623 | <xsl:text>
\paragraph{Synopsis} \hfill \\
\begin{addmargin}{1em}
</xsl:text>
|
---|
624 | <xsl:apply-templates />
|
---|
625 | <xsl:text>\end{addmargin}
</xsl:text>
|
---|
626 | </xsl:template>
|
---|
627 |
|
---|
628 | <!--
|
---|
629 | The refsect1 is used for 'Description' and such. Do same as with refsynopsisdiv
|
---|
630 | and turn it into a named & indented paragraph.
|
---|
631 |
|
---|
632 | Note! If the section has a title, the title template way up above will begin
|
---|
633 | the addmargin stuff. We'll just end it here.
|
---|
634 | If there is no title, we ASSUME (HACK ALERT) that this is part of the
|
---|
635 | VBoxManage Command Overview section in the manual.
|
---|
636 | -->
|
---|
637 | <xsl:template match="refsect1">
|
---|
638 | <xsl:if test="(name(*[1]) != 'title' and name(*[1]) != 'cmdsynopsis') or not(title) = not(cmdsynopsis)">
|
---|
639 | <xsl:message terminate="yes">Expected title or cmdsynopsis element as the first child of refsect1.</xsl:message>
|
---|
640 | </xsl:if>
|
---|
641 | <xsl:if test="not(title)">
|
---|
642 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
643 | <xsl:text>
\begin{addmargin}{1em}
</xsl:text>
|
---|
644 | </xsl:if>
|
---|
645 | <xsl:apply-templates/>
|
---|
646 | <xsl:text>
\end{addmargin}
</xsl:text>
|
---|
647 | </xsl:template>
|
---|
648 |
|
---|
649 | <!--
|
---|
650 | The refsect2 element will be turned into a subparagraph if it has a title,
|
---|
651 | however, that didn't work out when it didn't have a title and started with
|
---|
652 | a cmdsynopsis instead (subcommand docs). So, we're doing some trickery
|
---|
653 | here (HACK ALERT) for the non-title case to feign a paragraph.
|
---|
654 | -->
|
---|
655 | <xsl:template match="refsect2">
|
---|
656 | <xsl:if test="(name(*[1]) != 'title' and name(*[1]) != 'cmdsynopsis') or not(title) = not(cmdsynopsis)">
|
---|
657 | <xsl:message terminate="yes">Expected title or cmdsynopsis element as the first child of refsect2.</xsl:message>
|
---|
658 | </xsl:if>
|
---|
659 | <xsl:if test="not(title)">
|
---|
660 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
661 | <xsl:text>\vspace{1.2em}
</xsl:text>
|
---|
662 | </xsl:if>
|
---|
663 | <xsl:apply-templates/>
|
---|
664 | <xsl:text>
</xsl:text>
|
---|
665 | </xsl:template>
|
---|
666 |
|
---|
667 |
|
---|
668 | <!--
|
---|
669 | Command Synopsis elements.
|
---|
670 | -->
|
---|
671 | <xsl:template match="sbr">
|
---|
672 | <xsl:text>\linebreak</xsl:text>
|
---|
673 | </xsl:template>
|
---|
674 | <xsl:template match="refentry|refnamediv|refentryinfo|refmeta|refsect3|refsect4|refsect5|synopfragment|synopfragmentref|cmdsynopsis/info">
|
---|
675 | <xsl:message terminate="yes"><xsl:value-of select="name()"/> is not supported</xsl:message>
|
---|
676 | </xsl:template>
|
---|
677 |
|
---|
678 | <xsl:template match="cmdsynopsis">
|
---|
679 | <xsl:text>
\noindent\texttt{</xsl:text>
|
---|
680 | <xsl:apply-templates />
|
---|
681 | <xsl:text>}\linebreak</xsl:text>
|
---|
682 | </xsl:template>
|
---|
683 |
|
---|
684 | <xsl:template match="replaceable">
|
---|
685 | <xsl:choose>
|
---|
686 | <xsl:when test="not(ancestor::cmdsynopsis)">
|
---|
687 | <xsl:text>\texttt{\textit{</xsl:text>
|
---|
688 | <xsl:apply-templates />
|
---|
689 | <xsl:text>}}</xsl:text>
|
---|
690 | </xsl:when>
|
---|
691 | <xsl:otherwise>
|
---|
692 | <xsl:text>\textit{</xsl:text>
|
---|
693 | <xsl:apply-templates />
|
---|
694 | <xsl:text>}</xsl:text>
|
---|
695 | </xsl:otherwise>
|
---|
696 | </xsl:choose>
|
---|
697 | </xsl:template>
|
---|
698 |
|
---|
699 | <xsl:template match="command|option">
|
---|
700 | <xsl:choose>
|
---|
701 | <xsl:when test="not(ancestor::cmdsynopsis)">
|
---|
702 | <xsl:text>\texttt{</xsl:text>
|
---|
703 | <xsl:apply-templates />
|
---|
704 | <xsl:text>}</xsl:text>
|
---|
705 | </xsl:when>
|
---|
706 | <xsl:otherwise>
|
---|
707 | <xsl:apply-templates />
|
---|
708 | </xsl:otherwise>
|
---|
709 | </xsl:choose>
|
---|
710 | </xsl:template>
|
---|
711 |
|
---|
712 | <xsl:template match="arg|group">
|
---|
713 | <!-- separator char if we're not the first child -->
|
---|
714 | <xsl:if test="position() > 1">
|
---|
715 | <xsl:choose>
|
---|
716 | <xsl:when test="ancestor-or-self::*/@sepchar"><xsl:value-of select="ancestor-or-self::*/@sepchar"/></xsl:when>
|
---|
717 | <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
|
---|
718 | </xsl:choose>
|
---|
719 | </xsl:if>
|
---|
720 | <!-- open wrapping -->
|
---|
721 | <xsl:choose>
|
---|
722 | <xsl:when test="@choice = 'opt' or @choice = ''"> <xsl:text>[</xsl:text></xsl:when>
|
---|
723 | <xsl:when test="@choice = 'req'"> <xsl:text>{</xsl:text></xsl:when>
|
---|
724 | <xsl:when test="@choice = 'plain'"/>
|
---|
725 | <xsl:otherwise><xsl:message terminate="yes">Invalid arg choice</xsl:message></xsl:otherwise>
|
---|
726 | </xsl:choose>
|
---|
727 | <!-- render the arg (TODO: may need to do more work here) -->
|
---|
728 | <xsl:apply-templates />
|
---|
729 | <!-- repeat wrapping -->
|
---|
730 | <xsl:choose>
|
---|
731 | <xsl:when test="@rep = 'norepeat' or @rep = ''"/>
|
---|
732 | <xsl:when test="@rep = 'repeat'"> <xsl:text>...</xsl:text></xsl:when>
|
---|
733 | <xsl:otherwise><xsl:message terminate="yes">Invalid rep choice</xsl:message></xsl:otherwise>
|
---|
734 | </xsl:choose>
|
---|
735 | <!-- close wrapping -->
|
---|
736 | <xsl:choose>
|
---|
737 | <xsl:when test="@choice = 'opt' or @choice = ''"> <xsl:text>]</xsl:text></xsl:when>
|
---|
738 | <xsl:when test="@choice = 'req'"> <xsl:text>}</xsl:text></xsl:when>
|
---|
739 | </xsl:choose>
|
---|
740 | </xsl:template>
|
---|
741 |
|
---|
742 |
|
---|
743 | <!--
|
---|
744 | Generic element text magic.
|
---|
745 | -->
|
---|
746 | <xsl:template match="//text()">
|
---|
747 | <xsl:variable name="subst1">
|
---|
748 | <xsl:call-template name="str:subst">
|
---|
749 | <xsl:with-param name="text" select="." />
|
---|
750 | <xsl:with-param name="replace" select="'\'" />
|
---|
751 | <xsl:with-param name="with" select="'\textbackslash{}'" />
|
---|
752 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
753 | </xsl:call-template>
|
---|
754 | </xsl:variable>
|
---|
755 | <xsl:choose>
|
---|
756 | <xsl:when test="(name(..)='screen') or (name(../..)='screen')">
|
---|
757 | <xsl:value-of select="." />
|
---|
758 | </xsl:when>
|
---|
759 | <xsl:when test="(name(..) = 'computeroutput') or (name(../..) = 'computeroutput')
|
---|
760 | or (name(..) = 'code') or (name(../..) = 'code')
|
---|
761 | or (name(..) = 'arg') or (name(../..) = 'arg')
|
---|
762 | or (name(..) = 'option') or (name(../..) = 'option')
|
---|
763 | or (name(..) = 'command') or (name(../..) = 'command')
|
---|
764 | or (name(..) = 'cmdsynopsis') or (name(../..) = 'cmdsynopsis')
|
---|
765 | or (name(..) = 'replaceable') or (name(../..) = 'replaceable')
|
---|
766 | ">
|
---|
767 | <xsl:variable name="subst2">
|
---|
768 | <xsl:call-template name="str:subst">
|
---|
769 | <xsl:with-param name="text" select="$subst1" />
|
---|
770 | <xsl:with-param name="replace" select="'--'" />
|
---|
771 | <xsl:with-param name="with" select="'-{}-'" />
|
---|
772 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
773 | </xsl:call-template>
|
---|
774 | </xsl:variable>
|
---|
775 | <xsl:variable name="subst3">
|
---|
776 | <xsl:call-template name="str:subst">
|
---|
777 | <xsl:with-param name="text" select="$subst2" />
|
---|
778 | <xsl:with-param name="replace" select="'_'" />
|
---|
779 | <xsl:with-param name="with" select="'\_'" />
|
---|
780 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
781 | </xsl:call-template>
|
---|
782 | </xsl:variable>
|
---|
783 | <xsl:variable name="subst4">
|
---|
784 | <xsl:call-template name="str:subst">
|
---|
785 | <xsl:with-param name="text" select="$subst3" />
|
---|
786 | <xsl:with-param name="replace" select="'$'" />
|
---|
787 | <xsl:with-param name="with" select="'\$'" />
|
---|
788 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
789 | </xsl:call-template>
|
---|
790 | </xsl:variable>
|
---|
791 | <xsl:variable name="subst5">
|
---|
792 | <xsl:call-template name="str:subst">
|
---|
793 | <xsl:with-param name="text" select="$subst4" />
|
---|
794 | <xsl:with-param name="replace" select="'%'" />
|
---|
795 | <xsl:with-param name="with" select="'\%'" />
|
---|
796 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
797 | </xsl:call-template>
|
---|
798 | </xsl:variable>
|
---|
799 | <xsl:variable name="subst6">
|
---|
800 | <xsl:call-template name="str:subst">
|
---|
801 | <xsl:with-param name="text" select="$subst5" />
|
---|
802 | <xsl:with-param name="replace" select="'#'" />
|
---|
803 | <xsl:with-param name="with" select="'\#'" />
|
---|
804 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
805 | </xsl:call-template>
|
---|
806 | </xsl:variable>
|
---|
807 | <xsl:variable name="subst7">
|
---|
808 | <xsl:call-template name="str:subst">
|
---|
809 | <xsl:with-param name="text" select="$subst6" />
|
---|
810 | <xsl:with-param name="replace" select="'~'" />
|
---|
811 | <xsl:with-param name="with" select="'\textasciitilde '" />
|
---|
812 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
813 | </xsl:call-template>
|
---|
814 | </xsl:variable>
|
---|
815 | <xsl:variable name="subst8">
|
---|
816 | <xsl:call-template name="str:subst">
|
---|
817 | <xsl:with-param name="text" select="$subst7" />
|
---|
818 | <xsl:with-param name="replace" select="'&'" />
|
---|
819 | <xsl:with-param name="with" select="'\&'" />
|
---|
820 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
821 | </xsl:call-template>
|
---|
822 | </xsl:variable>
|
---|
823 | <xsl:value-of select="$subst8" />
|
---|
824 | </xsl:when>
|
---|
825 | <xsl:when test="(name(..)='address') or (name(../..)='address')">
|
---|
826 | <xsl:variable name="subst2">
|
---|
827 | <xsl:call-template name="str:subst">
|
---|
828 | <xsl:with-param name="text" select="$subst1" />
|
---|
829 | <xsl:with-param name="replace" select="'
'" />
|
---|
830 | <xsl:with-param name="with" select="' \\'" />
|
---|
831 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
832 | </xsl:call-template>
|
---|
833 | </xsl:variable>
|
---|
834 | <xsl:value-of select="$subst2" />
|
---|
835 | </xsl:when>
|
---|
836 | <xsl:otherwise>
|
---|
837 | <xsl:variable name="subst2">
|
---|
838 | <xsl:call-template name="str:subst">
|
---|
839 | <xsl:with-param name="text" select="$subst1" />
|
---|
840 | <xsl:with-param name="replace" select="'_'" />
|
---|
841 | <xsl:with-param name="with" select="'\_'" />
|
---|
842 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
843 | </xsl:call-template>
|
---|
844 | </xsl:variable>
|
---|
845 | <xsl:variable name="subst3">
|
---|
846 | <xsl:call-template name="str:subst">
|
---|
847 | <xsl:with-param name="text" select="$subst2" />
|
---|
848 | <xsl:with-param name="replace" select="'$'" />
|
---|
849 | <xsl:with-param name="with" select="'\$'" />
|
---|
850 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
851 | </xsl:call-template>
|
---|
852 | </xsl:variable>
|
---|
853 | <xsl:variable name="subst4">
|
---|
854 | <xsl:call-template name="str:subst">
|
---|
855 | <xsl:with-param name="text" select="$subst3" />
|
---|
856 | <xsl:with-param name="replace" select="'%'" />
|
---|
857 | <xsl:with-param name="with" select="'\%'" />
|
---|
858 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
859 | </xsl:call-template>
|
---|
860 | </xsl:variable>
|
---|
861 | <xsl:variable name="subst5">
|
---|
862 | <xsl:call-template name="str:subst">
|
---|
863 | <xsl:with-param name="text" select="$subst4" />
|
---|
864 | <xsl:with-param name="replace" select="'#'" />
|
---|
865 | <xsl:with-param name="with" select="'\#'" />
|
---|
866 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
867 | </xsl:call-template>
|
---|
868 | </xsl:variable>
|
---|
869 | <xsl:variable name="subst6">
|
---|
870 | <xsl:call-template name="str:subst">
|
---|
871 | <xsl:with-param name="text" select="$subst5" />
|
---|
872 | <xsl:with-param name="replace" select="'µ'" />
|
---|
873 | <xsl:with-param name="with" select="'$\mu$'" />
|
---|
874 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
875 | </xsl:call-template>
|
---|
876 | </xsl:variable>
|
---|
877 | <xsl:variable name="subst7">
|
---|
878 | <xsl:call-template name="str:subst">
|
---|
879 | <xsl:with-param name="text" select="$subst6" />
|
---|
880 | <xsl:with-param name="replace" select="'®'" />
|
---|
881 | <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
|
---|
882 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
883 | </xsl:call-template>
|
---|
884 | </xsl:variable>
|
---|
885 | <xsl:variable name="quote">"</xsl:variable>
|
---|
886 | <!-- preparation for pretty quotes: replace all double quotes _outside_ screen
|
---|
887 | sections with "\QUOTE{}" strings, which the makefile will then replace
|
---|
888 | with pretty quotes by invoking sed a few times. Unfortunately there are
|
---|
889 | no regular expressions in XSLT so there's no other way. -->
|
---|
890 | <xsl:variable name="subst8">
|
---|
891 | <xsl:call-template name="str:subst">
|
---|
892 | <xsl:with-param name="text" select="$subst7" />
|
---|
893 | <xsl:with-param name="replace" select="$quote" />
|
---|
894 | <xsl:with-param name="with" select="'\QUOTE{}'" />
|
---|
895 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
896 | </xsl:call-template>
|
---|
897 | </xsl:variable>
|
---|
898 | <xsl:variable name="subst9">
|
---|
899 | <xsl:call-template name="str:subst">
|
---|
900 | <xsl:with-param name="text" select="$subst8" />
|
---|
901 | <xsl:with-param name="replace" select="'~'" />
|
---|
902 | <xsl:with-param name="with" select="'\textasciitilde '" />
|
---|
903 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
904 | </xsl:call-template>
|
---|
905 | </xsl:variable>
|
---|
906 | <xsl:variable name="subst10">
|
---|
907 | <xsl:call-template name="str:subst">
|
---|
908 | <xsl:with-param name="text" select="$subst9" />
|
---|
909 | <xsl:with-param name="replace" select="'&'" />
|
---|
910 | <xsl:with-param name="with" select="'\&'" />
|
---|
911 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
912 | </xsl:call-template>
|
---|
913 | </xsl:variable>
|
---|
914 | <xsl:value-of select="$subst10" />
|
---|
915 | </xsl:otherwise>
|
---|
916 | </xsl:choose>
|
---|
917 | </xsl:template>
|
---|
918 |
|
---|
919 | <!--
|
---|
920 | xsltprocNewlineOutputHack - emits a single new line.
|
---|
921 |
|
---|
922 | Hack Alert! This template helps xsltproc split up the output text elements
|
---|
923 | and avoid reallocating them into the MB range. Calls to this
|
---|
924 | template is made occationally while generating larger output
|
---|
925 | file. It's not necessary for small stuff like header.
|
---|
926 |
|
---|
927 | The trick we're playing on xsltproc has to do with CDATA
|
---|
928 | and/or the escape setting of the xsl:text element. It forces
|
---|
929 | xsltproc to allocate a new output element, thus preventing
|
---|
930 | things from growing out of proportions and slowing us down.
|
---|
931 |
|
---|
932 | This was successfully employed to reduce a 18+ seconds run to
|
---|
933 | around one second (possibly less due to kmk overhead).
|
---|
934 | -->
|
---|
935 | <xsl:template name="xsltprocNewlineOutputHack">
|
---|
936 | <xsl:text disable-output-escaping="yes"><![CDATA[
|
---|
937 | ]]></xsl:text>
|
---|
938 | </xsl:template>
|
---|
939 |
|
---|
940 | </xsl:stylesheet>
|
---|
941 |
|
---|