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{hyperref}
|
---|
115 | \usepackage{fancybox}
|
---|
116 | \usepackage{fancyvrb}
|
---|
117 | \usepackage{alltt}
|
---|
118 | \usepackage{color}
|
---|
119 | \usepackage{scrextend}
|
---|
120 | \definecolor{darkgreen}{rgb}{0,0.6,0}
|
---|
121 |
|
---|
122 | </xsl:text>
|
---|
123 | <xsl:if test="$TARGETLANG='de_DE'">\usepackage[ngerman]{babel} \PrerenderUnicode{ü}</xsl:if>
|
---|
124 | <!-- <xsl:if test="$TARGETLANG='fr_FR'">\usepackage[french]{babel} \FrenchItemizeSpacingfalse \renewcommand{\FrenchLabelItem}{\textbullet}</xsl:if>
|
---|
125 | this command is no longer understood by TexLive2008
|
---|
126 | -->
|
---|
127 | <xsl:text>
|
---|
128 |
|
---|
129 | % use Palatino as serif font:
|
---|
130 | % \usepackage{mathpazo}
|
---|
131 | \usepackage{charter}
|
---|
132 | % use Helvetica as sans-serif font:
|
---|
133 | \usepackage{helvet}
|
---|
134 |
|
---|
135 | % use Bera Mono (a variant of Bitstream Vera Mono) as typewriter font
|
---|
136 | % (requires texlive-fontsextra)
|
---|
137 | \usepackage[scaled]{beramono}
|
---|
138 | % previously: use Courier as typewriter font:
|
---|
139 | % \usepackage{courier}
|
---|
140 |
|
---|
141 | \definecolor{colNote}{rgb}{0,0,0}
|
---|
142 | \definecolor{colWarning}{rgb}{0,0,0}
|
---|
143 | \definecolor{colScreenFrame}{rgb}{0,0,0}
|
---|
144 | \definecolor{colScreenText}{rgb}{0,0,0}
|
---|
145 |
|
---|
146 | % number headings down to this level
|
---|
147 | \setcounter{secnumdepth}{3}
|
---|
148 | % more space for the section numbers
|
---|
149 | \makeatletter
|
---|
150 | \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.9em}}
|
---|
151 | \renewcommand*\l@subsection{\@dottedtocline{2}{4.4em}{3.8em}}
|
---|
152 | \renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{3.8em}}
|
---|
153 | \renewcommand*\@pnumwidth{1.7em}
|
---|
154 | \renewcommand*\@tocrmarg{5.0em}
|
---|
155 | \makeatother
|
---|
156 |
|
---|
157 | % more tolerance at 2nd wrap stage:
|
---|
158 | \tolerance = 1000
|
---|
159 | % allow 3rd wrap stage:
|
---|
160 | \emergencystretch = 10pt
|
---|
161 | % no Schusterjungen:
|
---|
162 | \clubpenalty = 10000
|
---|
163 | % no Hurenkinder:
|
---|
164 | \widowpenalty = 10000
|
---|
165 | \displaywidowpenalty = 10000
|
---|
166 | % max pdf compression:
|
---|
167 | \pdfcompresslevel9
|
---|
168 |
|
---|
169 | % opening and closing quotes: the OQ and CQ macros define this (and the makefile employs some sed magic also)
|
---|
170 | </xsl:text>
|
---|
171 | <xsl:choose>
|
---|
172 | <xsl:when test="$TARGETLANG='de_DE'">
|
---|
173 | <xsl:text>\newcommand\OQ{\texorpdfstring{\glqq}{"}} \newcommand\CQ{\texorpdfstring{\grqq}{"}} </xsl:text>
|
---|
174 | </xsl:when>
|
---|
175 | <xsl:when test="$TARGETLANG='fr_FR'">
|
---|
176 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
177 | </xsl:when>
|
---|
178 | <xsl:when test="$TARGETLANG='en_US'">
|
---|
179 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
180 | </xsl:when>
|
---|
181 | <xsl:otherwise>
|
---|
182 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
183 | </xsl:otherwise>
|
---|
184 | </xsl:choose>
|
---|
185 |
|
---|
186 | <xsl:apply-templates />
|
---|
187 |
|
---|
188 | <xsl:text>
|
---|
189 | \end{document}
|
---|
190 | </xsl:text>
|
---|
191 |
|
---|
192 | </xsl:template>
|
---|
193 |
|
---|
194 | <xsl:template match="bookinfo">
|
---|
195 | <xsl:apply-templates />
|
---|
196 | <xsl:text>
\newcommand\docbookbookinfocopyright{\copyright{} \docbookbookinfocopyrightyear{} \docbookbookinfocopyrightholder{}}

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

\backmatter
\chapter{Glossary}
</xsl:text>
|
---|
459 | <xsl:apply-templates />
|
---|
460 | </xsl:template>
|
---|
461 |
|
---|
462 | <xsl:template match="para">
|
---|
463 | <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or (name(../..)='varlistentry' and position()=1))">
|
---|
464 | <xsl:text>

</xsl:text>
|
---|
465 | </xsl:if>
|
---|
466 | <xsl:apply-templates />
|
---|
467 | </xsl:template>
|
---|
468 |
|
---|
469 | <xsl:template match="note">
|
---|
470 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
473 | </xsl:template>
|
---|
474 |
|
---|
475 | <xsl:template match="warning">
|
---|
476 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
479 | </xsl:template>
|
---|
480 |
|
---|
481 | <xsl:template match="screen">
|
---|
482 | <xsl:text>

\begin{Verbatim}[fontsize=\footnotesize]
</xsl:text>
|
---|
483 | <xsl:apply-templates />
|
---|
484 | <xsl:text>
\end{Verbatim}
</xsl:text>
|
---|
485 | </xsl:template>
|
---|
486 |
|
---|
487 | <xsl:template match="programlisting">
|
---|
488 | <xsl:text>

{\small\begin{alltt}
</xsl:text>
|
---|
489 | <xsl:apply-templates />
|
---|
490 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
491 | </xsl:template>
|
---|
492 |
|
---|
493 | <xsl:template match="footnote">
|
---|
494 | <xsl:text>\footnote{</xsl:text>
|
---|
495 | <xsl:apply-templates />
|
---|
496 | <xsl:text>}</xsl:text>
|
---|
497 | </xsl:template>
|
---|
498 |
|
---|
499 | <xsl:template match="tgroup">
|
---|
500 | <xsl:choose>
|
---|
501 | <xsl:when test="@style='verywide'">
|
---|
502 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{1.1\textwidth}[]{|L|L|L|}
\hline
</xsl:text>
|
---|
503 | </xsl:when>
|
---|
504 | <xsl:otherwise>
|
---|
505 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{.9\textwidth}[]{|L|L|L|}
\hline
</xsl:text>
|
---|
506 | </xsl:otherwise>
|
---|
507 | </xsl:choose>
|
---|
508 | <xsl:apply-templates />
|
---|
509 | <xsl:text>
\end{tabulary}
\end{center}}
</xsl:text>
|
---|
510 | </xsl:template>
|
---|
511 |
|
---|
512 | <xsl:template match="row">
|
---|
513 | <xsl:apply-templates />
|
---|
514 | <xsl:text>
\\ \hline
</xsl:text>
|
---|
515 | </xsl:template>
|
---|
516 |
|
---|
517 | <xsl:template match="entry">
|
---|
518 | <xsl:if test="not(position()=1)">
|
---|
519 | <xsl:text> & </xsl:text>
|
---|
520 | </xsl:if>
|
---|
521 | <xsl:apply-templates />
|
---|
522 | </xsl:template>
|
---|
523 |
|
---|
524 | <xsl:template match="itemizedlist">
|
---|
525 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
526 | <xsl:text>
\begin{itemize}
</xsl:text>
|
---|
527 | <xsl:apply-templates />
|
---|
528 | <xsl:text>
\end{itemize}
</xsl:text>
|
---|
529 | </xsl:template>
|
---|
530 |
|
---|
531 | <xsl:template match="orderedlist">
|
---|
532 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
533 | <xsl:text>
\begin{enumerate}
</xsl:text>
|
---|
534 | <xsl:apply-templates />
|
---|
535 | <xsl:text>
\end{enumerate}
</xsl:text>
|
---|
536 | </xsl:template>
|
---|
537 |
|
---|
538 | <xsl:template match="variablelist">
|
---|
539 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
540 | <xsl:text>
\begin{description}
</xsl:text>
|
---|
541 | <xsl:apply-templates />
|
---|
542 | <xsl:text>
\end{description}
</xsl:text>
|
---|
543 | </xsl:template>
|
---|
544 |
|
---|
545 | <xsl:template match="varlistentry">
|
---|
546 | <xsl:if test="not(./term) or not(./listitem) or count(*) != 2">
|
---|
547 | <xsl:message terminate="yes">Expected exactly one term and one listitem element in the varlistentry.</xsl:message>
|
---|
548 | </xsl:if>
|
---|
549 | <xsl:text>

\item[</xsl:text>
|
---|
550 | <xsl:apply-templates select="term"/>
|
---|
551 | <xsl:text>] \hfill \\
</xsl:text>
|
---|
552 | <xsl:apply-templates select="listitem/*"/>
|
---|
553 | </xsl:template>
|
---|
554 |
|
---|
555 | <xsl:template match="listitem">
|
---|
556 | <xsl:text>

\item </xsl:text>
|
---|
557 | <xsl:apply-templates />
|
---|
558 | <xsl:text>
</xsl:text>
|
---|
559 | </xsl:template>
|
---|
560 |
|
---|
561 | <xsl:template match="glossterm">
|
---|
562 | <xsl:variable name="refid" select="(@id)" />
|
---|
563 | <xsl:if test="$refid">
|
---|
564 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
565 | </xsl:if>
|
---|
566 | <xsl:text>

\item[</xsl:text>
|
---|
567 | <xsl:apply-templates />
|
---|
568 | <xsl:text>]</xsl:text>
|
---|
569 | </xsl:template>
|
---|
570 |
|
---|
571 | <xsl:template match="glosslist | glossdiv">
|
---|
572 | <xsl:text>

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