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 | <!--
|
---|
22 | Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
23 |
|
---|
24 | This file is part of VirtualBox base platform packages, as
|
---|
25 | available from https://www.virtualbox.org.
|
---|
26 |
|
---|
27 | This program is free software; you can redistribute it and/or
|
---|
28 | modify it under the terms of the GNU General Public License
|
---|
29 | as published by the Free Software Foundation, in version 3 of the
|
---|
30 | License.
|
---|
31 |
|
---|
32 | This program is distributed in the hope that it will be useful, but
|
---|
33 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
35 | General Public License for more details.
|
---|
36 |
|
---|
37 | You should have received a copy of the GNU General Public License
|
---|
38 | along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
39 |
|
---|
40 | SPDX-License-Identifier: GPL-3.0-only
|
---|
41 | -->
|
---|
42 |
|
---|
43 | <xsl:stylesheet
|
---|
44 | version="1.0"
|
---|
45 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
46 | xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
---|
47 | xmlns:str="http://xsltsl.org/string"
|
---|
48 | >
|
---|
49 |
|
---|
50 | <xsl:import href="string.xsl"/>
|
---|
51 | <xsl:import href="common-formatcfg.xsl"/>
|
---|
52 |
|
---|
53 | <xsl:variable name="g_nlsChapter">
|
---|
54 | <xsl:choose>
|
---|
55 | <xsl:when test="$TARGETLANG='de_DE'">Kapitel</xsl:when>
|
---|
56 | <xsl:when test="$TARGETLANG='fr_FR'">chapitre</xsl:when>
|
---|
57 | <xsl:when test="$TARGETLANG='en_US'">chapter</xsl:when>
|
---|
58 | <xsl:otherwise>
|
---|
59 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
60 | </xsl:otherwise>
|
---|
61 | </xsl:choose>
|
---|
62 | </xsl:variable>
|
---|
63 |
|
---|
64 | <xsl:variable name="g_nlsPage">
|
---|
65 | <xsl:choose>
|
---|
66 | <xsl:when test="$TARGETLANG='de_DE'">auf Seite</xsl:when>
|
---|
67 | <xsl:when test="$TARGETLANG='fr_FR'">page</xsl:when>
|
---|
68 | <xsl:when test="$TARGETLANG='en_US'">page</xsl:when>
|
---|
69 | <xsl:otherwise>
|
---|
70 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
71 | </xsl:otherwise>
|
---|
72 | </xsl:choose>
|
---|
73 | </xsl:variable>
|
---|
74 |
|
---|
75 | <xsl:variable name="g_nlsNote">
|
---|
76 | <xsl:choose>
|
---|
77 | <xsl:when test="$TARGETLANG='de_DE'">Hinweis</xsl:when>
|
---|
78 | <xsl:when test="$TARGETLANG='fr_FR'">Note</xsl:when>
|
---|
79 | <xsl:when test="$TARGETLANG='en_US'">Note</xsl:when>
|
---|
80 | <xsl:otherwise>
|
---|
81 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
82 | </xsl:otherwise>
|
---|
83 | </xsl:choose>
|
---|
84 | </xsl:variable>
|
---|
85 |
|
---|
86 | <xsl:variable name="g_nlsWarning">
|
---|
87 | <xsl:choose>
|
---|
88 | <xsl:when test="$TARGETLANG='de_DE'">Warnung</xsl:when>
|
---|
89 | <xsl:when test="$TARGETLANG='fr_FR'">Avertissement</xsl:when>
|
---|
90 | <xsl:when test="$TARGETLANG='en_US'">Warning</xsl:when>
|
---|
91 | <xsl:otherwise>
|
---|
92 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
93 | </xsl:otherwise>
|
---|
94 | </xsl:choose>
|
---|
95 | </xsl:variable>
|
---|
96 |
|
---|
97 | <!-- command synopsis -->
|
---|
98 | <xsl:variable name="arg.rep.repeat.str.tex">\ldots{}</xsl:variable>
|
---|
99 | <xsl:variable name="arg.or.sep.compact.tex">|</xsl:variable>
|
---|
100 | <xsl:variable name="arg.or.sep.tex"> |~</xsl:variable>
|
---|
101 |
|
---|
102 | <xsl:output method="text"/>
|
---|
103 |
|
---|
104 | <xsl:strip-space elements="*"/>
|
---|
105 | <xsl:preserve-space elements="para"/>
|
---|
106 |
|
---|
107 | <xsl:template match="/book">
|
---|
108 | <xsl:text>
|
---|
109 | \documentclass[oneside,a4paper,10pt,DIV10]{scrbook}
|
---|
110 | \usepackage{geometry}
|
---|
111 | \geometry{top=3cm,bottom=4cm}
|
---|
112 | \usepackage[T1]{fontenc}
|
---|
113 | \usepackage{tabulary}
|
---|
114 | \usepackage[pdftex,
|
---|
115 | a4paper,
|
---|
116 | colorlinks=true,
|
---|
117 | linkcolor=blue,
|
---|
118 | urlcolor=darkgreen,
|
---|
119 | bookmarksnumbered,
|
---|
120 | bookmarksopen=true,
|
---|
121 | bookmarksopenlevel=0,
|
---|
122 | hyperfootnotes=false,
|
---|
123 | plainpages=false,
|
---|
124 | pdfpagelabels
|
---|
125 | ]{hyperref}
|
---|
126 |
|
---|
127 | \usepackage{nameref}
|
---|
128 | \usepackage{graphicx}
|
---|
129 | \usepackage{hyperref}
|
---|
130 | \usepackage{fancybox}
|
---|
131 | \usepackage{alltt}
|
---|
132 | \usepackage{color}
|
---|
133 | \usepackage{scrextend}
|
---|
134 | \definecolor{darkgreen}{rgb}{0,0.6,0}
|
---|
135 | \tymin=21pt
|
---|
136 |
|
---|
137 | </xsl:text>
|
---|
138 | <xsl:if test="$TARGETLANG='de_DE'">\usepackage[ngerman]{babel} \PrerenderUnicode{ü}</xsl:if>
|
---|
139 | <!-- <xsl:if test="$TARGETLANG='fr_FR'">\usepackage[french]{babel} \FrenchItemizeSpacingfalse \renewcommand{\FrenchLabelItem}{\textbullet}</xsl:if>
|
---|
140 | this command is no longer understood by TexLive2008
|
---|
141 | -->
|
---|
142 | <xsl:text>
|
---|
143 |
|
---|
144 | % use Palatino as serif font:
|
---|
145 | % \usepackage{mathpazo}
|
---|
146 | \usepackage{charter}
|
---|
147 | % use Helvetica as sans-serif font:
|
---|
148 | \usepackage{helvet}
|
---|
149 |
|
---|
150 | % use Bera Mono (a variant of Bitstream Vera Mono) as typewriter font
|
---|
151 | % (requires texlive-fontsextra)
|
---|
152 | \usepackage[scaled]{beramono}
|
---|
153 | % previously: use Courier as typewriter font:
|
---|
154 | % \usepackage{courier}
|
---|
155 |
|
---|
156 | \definecolor{colNote}{rgb}{0,0,0}
|
---|
157 | \definecolor{colWarning}{rgb}{0,0,0}
|
---|
158 | \definecolor{colScreenFrame}{rgb}{0,0,0}
|
---|
159 | \definecolor{colScreenText}{rgb}{0,0,0}
|
---|
160 |
|
---|
161 | % number headings down to this level
|
---|
162 | \setcounter{secnumdepth}{3}
|
---|
163 | % more space for the section numbers
|
---|
164 | \makeatletter
|
---|
165 | \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.9em}}
|
---|
166 | \renewcommand*\l@subsection{\@dottedtocline{2}{4.4em}{3.8em}}
|
---|
167 | \renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{3.8em}}
|
---|
168 | \renewcommand*\@pnumwidth{1.7em}
|
---|
169 | \renewcommand*\@tocrmarg{5.0em}
|
---|
170 | \makeatother
|
---|
171 |
|
---|
172 | % more tolerance at 2nd wrap stage:
|
---|
173 | \tolerance = 1000
|
---|
174 | % allow 3rd wrap stage:
|
---|
175 | \emergencystretch = 10pt
|
---|
176 | % no Schusterjungen:
|
---|
177 | \clubpenalty = 10000
|
---|
178 | % no Hurenkinder:
|
---|
179 | \widowpenalty = 10000
|
---|
180 | \displaywidowpenalty = 10000
|
---|
181 | % max pdf compression:
|
---|
182 | \pdfcompresslevel9
|
---|
183 |
|
---|
184 | % opening and closing quotes: the OQ and CQ macros define this (and the makefile employs some sed magic also)
|
---|
185 | </xsl:text>
|
---|
186 | <xsl:choose>
|
---|
187 | <xsl:when test="$TARGETLANG='de_DE'">
|
---|
188 | <xsl:text>\newcommand\OQ{\texorpdfstring{\glqq}{"}} \newcommand\CQ{\texorpdfstring{\grqq}{"}} </xsl:text>
|
---|
189 | </xsl:when>
|
---|
190 | <xsl:when test="$TARGETLANG='fr_FR'">
|
---|
191 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
192 | </xsl:when>
|
---|
193 | <xsl:when test="$TARGETLANG='en_US'">
|
---|
194 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
195 | </xsl:when>
|
---|
196 | <xsl:otherwise>
|
---|
197 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
198 | </xsl:otherwise>
|
---|
199 | </xsl:choose>
|
---|
200 |
|
---|
201 | <xsl:apply-templates />
|
---|
202 |
|
---|
203 | <xsl:text>
|
---|
204 | \end{sloppypar}
|
---|
205 | \end{document}
|
---|
206 | </xsl:text>
|
---|
207 |
|
---|
208 | </xsl:template>
|
---|
209 |
|
---|
210 | <xsl:template match="bookinfo">
|
---|
211 | <xsl:apply-templates />
|
---|
212 | <xsl:text>
\newcommand\docbookbookinfocopyright{Copyright \copyright{} \docbookbookinfocopyrightyear{} \docbookbookinfocopyrightholder{}}

|
---|
213 | \author{ \docbooktitleedition \\ %
|
---|
214 | \\ %
|
---|
215 | </xsl:text>
|
---|
216 | <xsl:if test="//bookinfo/address">
|
---|
217 | <xsl:text>\docbookbookinfoaddress \\ %
|
---|
218 | \\ %
|
---|
219 | </xsl:text>
|
---|
220 | </xsl:if>
|
---|
221 | <xsl:text>\docbookbookinfocopyright \\ %
|
---|
222 | }
|
---|
223 |
|
---|
224 | \title{\docbooktitle \\
|
---|
225 | \docbooksubtitle}
|
---|
226 | % \subtitle{\docbooksubtitle}
|
---|
227 | \hypersetup{pdfauthor=\docbookcorpauthor}
|
---|
228 | \hypersetup{pdftitle=\docbooktitle{} \docbooksubtitle{}}
|
---|
229 |
|
---|
230 | \hyphenation{da-ta-ba-ses}
|
---|
231 | \hyphenation{deb-conf}
|
---|
232 | \hyphenation{VirtualBox}
|
---|
233 |
|
---|
234 | \begin{document}
|
---|
235 | \frontmatter
|
---|
236 | % bird/2018-05-14: Use sloppypar so we don't push path names and other long words
|
---|
237 | % thru the right margin. TODO: Find better solution? microtype?
|
---|
238 | \begin{sloppypar}
|
---|
239 | % \maketitle
|
---|
240 | %\begin{titlepage}
|
---|
241 | \thispagestyle{empty}
|
---|
242 | \begin{minipage}{\textwidth}
|
---|
243 | \begin{center}
|
---|
244 | \includegraphics[width=4cm]{images/vboxlogo.png}
|
---|
245 | \end{center}%
|
---|
246 | \vspace{10mm}
|
---|
247 |
|
---|
248 | {\fontsize{40pt}{40pt}\selectfont\rmfamily\bfseries%
|
---|
249 | \begin{center}
|
---|
250 | \docbooktitle
|
---|
251 | \end{center}%
|
---|
252 | \vspace{10mm}
|
---|
253 | }
|
---|
254 |
|
---|
255 | {\fontsize{30pt}{30pt}\selectfont\rmfamily\bfseries%
|
---|
256 | \begin{center}
|
---|
257 | \docbooksubtitle
|
---|
258 | \end{center}%
|
---|
259 | \vspace{10mm}
|
---|
260 | }
|
---|
261 |
|
---|
262 | {\fontsize{16pt}{20pt}\selectfont\rmfamily%
|
---|
263 | \begin{center}
|
---|
264 | </xsl:text>
|
---|
265 | <xsl:if test="//bookinfo/othercredit">
|
---|
266 | <xsl:text>\docbookbookinfoothercreditcontrib{}: \docbookbookinfoothercreditfirstname{} \docbookbookinfoothercreditsurname
|
---|
267 |
|
---|
268 | \vspace{8mm}
|
---|
269 | </xsl:text>
|
---|
270 | </xsl:if>
|
---|
271 | <xsl:text>\docbooktitleedition
|
---|
272 |
|
---|
273 | \vspace{2mm}
|
---|
274 |
|
---|
275 | \docbookbookinfocopyright
|
---|
276 |
|
---|
277 | \vspace{2mm}
|
---|
278 |
|
---|
279 | \docbookbookinfoaddress
|
---|
280 | \end{center}%
|
---|
281 | }
|
---|
282 |
|
---|
283 | %\end{titlepage}
|
---|
284 | \end{minipage}
|
---|
285 |
|
---|
286 | \tableofcontents
|
---|
287 | </xsl:text>
|
---|
288 | </xsl:template>
|
---|
289 |
|
---|
290 | <xsl:template match="subtitle">
|
---|
291 | <xsl:choose>
|
---|
292 | <xsl:when test="name(..)='bookinfo'">
|
---|
293 | <xsl:text>\newcommand\docbooksubtitle{</xsl:text>
|
---|
294 | <xsl:apply-templates />
|
---|
295 | <xsl:text>}</xsl:text>
|
---|
296 | </xsl:when>
|
---|
297 | </xsl:choose>
|
---|
298 | </xsl:template>
|
---|
299 |
|
---|
300 | <!-- Determins the section depth, returning a number 1,2,3,4,5,6,7,... -->
|
---|
301 | <xsl:template name="get-section-level">
|
---|
302 | <xsl:param name="a_Node" select=".."/>
|
---|
303 | <xsl:for-each select="$a_Node"> <!-- makes it current -->
|
---|
304 | <xsl:choose>
|
---|
305 | <xsl:when test="self::sect1"><xsl:text>1</xsl:text></xsl:when>
|
---|
306 | <xsl:when test="self::sect2"><xsl:text>2</xsl:text></xsl:when>
|
---|
307 | <xsl:when test="self::sect3"><xsl:text>3</xsl:text></xsl:when>
|
---|
308 | <xsl:when test="self::sect4"><xsl:text>4</xsl:text></xsl:when>
|
---|
309 | <xsl:when test="self::sect5"><xsl:text>5</xsl:text></xsl:when>
|
---|
310 | <xsl:when test="self::section">
|
---|
311 | <xsl:value-of select="count(ancestor::section) + 1"/>
|
---|
312 | </xsl:when>
|
---|
313 | <xsl:when test="self::simplesect">
|
---|
314 | <xsl:variable name="tmp">
|
---|
315 | <xsl:call-template name="get-section-level">
|
---|
316 | <xsl:with-param name="a_Node" select="parent::*"/>
|
---|
317 | </xsl:call-template>
|
---|
318 | </xsl:variable>
|
---|
319 | <xsl:value-of select="$tmp + 1"/>
|
---|
320 | </xsl:when>
|
---|
321 | <xsl:when test="self::preface"><xsl:text>0</xsl:text></xsl:when>
|
---|
322 | <xsl:when test="self::chapter"><xsl:text>0</xsl:text></xsl:when>
|
---|
323 | <xsl:when test="self::appendix"><xsl:text>0</xsl:text></xsl:when>
|
---|
324 | <xsl:when test="self::article"><xsl:text>0</xsl:text></xsl:when>
|
---|
325 | <xsl:otherwise>
|
---|
326 | <xsl:message terminate="yes">get-section-level was called on non-section element: <xsl:value-of select="."/> </xsl:message>
|
---|
327 | </xsl:otherwise>
|
---|
328 | </xsl:choose>
|
---|
329 | </xsl:for-each>
|
---|
330 | </xsl:template>
|
---|
331 |
|
---|
332 | <!--
|
---|
333 | Inserts \hypertarget{@id} that can be referenced via the /A "nameddest=@id"
|
---|
334 | command line or #nameddest=@id URL parameter.
|
---|
335 |
|
---|
336 | TODO: The placement of the target could be improved on. The raisebox
|
---|
337 | stuff is a crude hack to make it a little more acceptable. -->
|
---|
338 | <xsl:template name="title-wrapper">
|
---|
339 | <xsl:param name="texcmd" select="concat('\',name(..))"/>
|
---|
340 | <xsl:param name="refid" select="../@id"/>
|
---|
341 | <xsl:param name="role" select="../@role"/>
|
---|
342 |
|
---|
343 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
344 | <xsl:if test="$texcmd='\chapter' and (name(../preceding-sibling::*[1])='preface' or name(../preceding-sibling::*[1])='bookinfo')">
|
---|
345 | <xsl:text>\mainmatter
</xsl:text>
|
---|
346 | </xsl:if>
|
---|
347 | <xsl:choose>
|
---|
348 | <xsl:when test="$refid">
|
---|
349 | <xsl:text>
</xsl:text>
|
---|
350 | <xsl:value-of select="$texcmd"/>
|
---|
351 | <xsl:if test="not(contains($texcmd, '*'))">
|
---|
352 | <xsl:text>[</xsl:text> <!-- for toc -->
|
---|
353 | <xsl:apply-templates />
|
---|
354 | <xsl:text>]</xsl:text>
|
---|
355 | </xsl:if>
|
---|
356 | <xsl:text>{</xsl:text> <!-- for doc -->
|
---|
357 | <xsl:text>\raisebox{\ht\strutbox}{\hypertarget{</xsl:text>
|
---|
358 | <xsl:value-of select="$refid"/>
|
---|
359 | <xsl:text>}{}}</xsl:text>
|
---|
360 | <xsl:apply-templates />
|
---|
361 | <xsl:text>}</xsl:text>
|
---|
362 | </xsl:when>
|
---|
363 | <xsl:otherwise>
|
---|
364 | <xsl:text>
</xsl:text><xsl:value-of select="$texcmd"/><xsl:text>{</xsl:text>
|
---|
365 | <xsl:apply-templates />
|
---|
366 | <xsl:text>}</xsl:text>
|
---|
367 | </xsl:otherwise>
|
---|
368 | </xsl:choose>
|
---|
369 | </xsl:template>
|
---|
370 |
|
---|
371 | <xsl:template match="title">
|
---|
372 | <xsl:variable name="refid" select="../@id" />
|
---|
373 | <xsl:choose>
|
---|
374 | <xsl:when test="name(..)='bookinfo'">
|
---|
375 | <xsl:text>\newcommand\docbooktitle{</xsl:text>
|
---|
376 | <xsl:apply-templates />
|
---|
377 | <xsl:text>}</xsl:text>
|
---|
378 | </xsl:when>
|
---|
379 | <xsl:when test="name(..)='chapter'">
|
---|
380 | <xsl:call-template name="title-wrapper"/>
|
---|
381 | </xsl:when>
|
---|
382 | <xsl:when test="name(..)='preface'">
|
---|
383 | <xsl:call-template name="title-wrapper">
|
---|
384 | <xsl:with-param name="texcmd">\chapter</xsl:with-param>
|
---|
385 | </xsl:call-template>
|
---|
386 | </xsl:when>
|
---|
387 | <xsl:when test="name(..)='sect1'">
|
---|
388 | <xsl:call-template name="title-wrapper">
|
---|
389 | <xsl:with-param name="texcmd">\section</xsl:with-param>
|
---|
390 | </xsl:call-template>
|
---|
391 | </xsl:when>
|
---|
392 | <xsl:when test="name(..)='sect2'">
|
---|
393 | <xsl:call-template name="title-wrapper">
|
---|
394 | <xsl:with-param name="texcmd">\subsection</xsl:with-param>
|
---|
395 | </xsl:call-template>
|
---|
396 | </xsl:when>
|
---|
397 | <xsl:when test="name(..)='sect3'">
|
---|
398 | <xsl:call-template name="title-wrapper">
|
---|
399 | <xsl:with-param name="texcmd">\subsubsection</xsl:with-param>
|
---|
400 | </xsl:call-template>
|
---|
401 | </xsl:when>
|
---|
402 | <xsl:when test="name(..)='sect4'">
|
---|
403 | <xsl:call-template name="title-wrapper">
|
---|
404 | <xsl:with-param name="texcmd">\paragraph</xsl:with-param>
|
---|
405 | </xsl:call-template>
|
---|
406 | </xsl:when>
|
---|
407 | <xsl:when test="name(..)='sect5'">
|
---|
408 | <xsl:call-template name="title-wrapper">
|
---|
409 | <xsl:with-param name="texcmd">\subparagraph</xsl:with-param>
|
---|
410 | </xsl:call-template>
|
---|
411 | </xsl:when>
|
---|
412 | <xsl:when test="name(..)='appendix'">
|
---|
413 | <xsl:call-template name="title-wrapper">
|
---|
414 | <xsl:with-param name="texcmd">\chapter</xsl:with-param>
|
---|
415 | </xsl:call-template>
|
---|
416 | </xsl:when>
|
---|
417 | <xsl:when test="name(..)='glossdiv'">
|
---|
418 | <xsl:call-template name="title-wrapper">
|
---|
419 | <xsl:with-param name="texcmd">\section*</xsl:with-param>
|
---|
420 | </xsl:call-template>
|
---|
421 | </xsl:when>
|
---|
422 |
|
---|
423 | <xsl:when test="parent::simplesect">
|
---|
424 | <xsl:if test="../@role">
|
---|
425 | <xsl:message terminate="yes">Role not allowed with simplesect: <xsl:value-of select="../@role"/></xsl:message>
|
---|
426 | </xsl:if>
|
---|
427 | <xsl:variable name="level">
|
---|
428 | <xsl:call-template name="get-section-level">
|
---|
429 | <xsl:with-param name="a_Node" select=".."/>
|
---|
430 | </xsl:call-template>
|
---|
431 | </xsl:variable>
|
---|
432 | <xsl:choose>
|
---|
433 | <xsl:when test="$level = 1">
|
---|
434 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\section*</xsl:with-param></xsl:call-template>
|
---|
435 | </xsl:when>
|
---|
436 | <xsl:when test="$level = 2">
|
---|
437 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\subsection*</xsl:with-param></xsl:call-template>
|
---|
438 | </xsl:when>
|
---|
439 | <xsl:when test="$level = 3">
|
---|
440 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\subsubsection*</xsl:with-param></xsl:call-template>
|
---|
441 | </xsl:when>
|
---|
442 | <xsl:when test="$level = 4">
|
---|
443 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\paragraph*</xsl:with-param></xsl:call-template>
|
---|
444 | </xsl:when>
|
---|
445 | <xsl:when test="$level = 5">
|
---|
446 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\subparagraph*</xsl:with-param></xsl:call-template>
|
---|
447 | </xsl:when>
|
---|
448 | <xsl:otherwise>
|
---|
449 | <xsl:message terminate="yes">Unsupported simplesect/title depth: <xsl:value-of select="$level"/></xsl:message>
|
---|
450 | </xsl:otherwise>
|
---|
451 | </xsl:choose>
|
---|
452 | </xsl:when>
|
---|
453 |
|
---|
454 | </xsl:choose>
|
---|
455 | <xsl:if test="$refid">
|
---|
456 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
457 | </xsl:if>
|
---|
458 | <xsl:text>
</xsl:text>
|
---|
459 | </xsl:template>
|
---|
460 |
|
---|
461 | <xsl:template match="edition">
|
---|
462 | <xsl:choose>
|
---|
463 | <xsl:when test="name(..)='bookinfo'">
|
---|
464 | <xsl:text>\newcommand\docbooktitleedition{</xsl:text>
|
---|
465 | <xsl:apply-templates />
|
---|
466 | <xsl:text>}
</xsl:text>
|
---|
467 | </xsl:when>
|
---|
468 | </xsl:choose>
|
---|
469 | </xsl:template>
|
---|
470 |
|
---|
471 | <xsl:template match="corpauthor">
|
---|
472 | <xsl:choose>
|
---|
473 | <xsl:when test="name(..)='bookinfo'">
|
---|
474 | <xsl:text>\newcommand\docbookcorpauthor{</xsl:text>
|
---|
475 | <xsl:apply-templates />
|
---|
476 | <xsl:text>}
</xsl:text>
|
---|
477 | </xsl:when>
|
---|
478 | </xsl:choose>
|
---|
479 | </xsl:template>
|
---|
480 |
|
---|
481 | <xsl:template match="address">
|
---|
482 | <xsl:choose>
|
---|
483 | <xsl:when test="name(..)='bookinfo'">
|
---|
484 | <xsl:text>\newcommand\docbookbookinfoaddress{</xsl:text>
|
---|
485 | <xsl:apply-templates />
|
---|
486 | <xsl:text>}
</xsl:text>
|
---|
487 | </xsl:when>
|
---|
488 | </xsl:choose>
|
---|
489 | </xsl:template>
|
---|
490 |
|
---|
491 | <xsl:template match="year">
|
---|
492 | <xsl:choose>
|
---|
493 | <xsl:when test="name(..)='copyright'">
|
---|
494 | <xsl:text>\newcommand\docbookbookinfocopyrightyear{</xsl:text>
|
---|
495 | <xsl:apply-templates />
|
---|
496 | <xsl:text>}
</xsl:text>
|
---|
497 | </xsl:when>
|
---|
498 | </xsl:choose>
|
---|
499 | </xsl:template>
|
---|
500 |
|
---|
501 | <xsl:template match="holder">
|
---|
502 | <xsl:choose>
|
---|
503 | <xsl:when test="name(..)='copyright'">
|
---|
504 | <xsl:text>\newcommand\docbookbookinfocopyrightholder{</xsl:text>
|
---|
505 | <xsl:apply-templates />
|
---|
506 | <xsl:text>}
</xsl:text>
|
---|
507 | </xsl:when>
|
---|
508 | </xsl:choose>
|
---|
509 | </xsl:template>
|
---|
510 |
|
---|
511 | <xsl:template match="firstname">
|
---|
512 | <xsl:choose>
|
---|
513 | <xsl:when test="name(..)='othercredit'">
|
---|
514 | <xsl:text>\newcommand\docbookbookinfoothercreditfirstname{</xsl:text>
|
---|
515 | <xsl:apply-templates />
|
---|
516 | <xsl:text>}
</xsl:text>
|
---|
517 | </xsl:when>
|
---|
518 | </xsl:choose>
|
---|
519 | </xsl:template>
|
---|
520 |
|
---|
521 | <xsl:template match="surname">
|
---|
522 | <xsl:choose>
|
---|
523 | <xsl:when test="name(..)='othercredit'">
|
---|
524 | <xsl:text>\newcommand\docbookbookinfoothercreditsurname{</xsl:text>
|
---|
525 | <xsl:apply-templates />
|
---|
526 | <xsl:text>}
</xsl:text>
|
---|
527 | </xsl:when>
|
---|
528 | </xsl:choose>
|
---|
529 | </xsl:template>
|
---|
530 |
|
---|
531 | <xsl:template match="contrib">
|
---|
532 | <xsl:choose>
|
---|
533 | <xsl:when test="name(..)='othercredit'">
|
---|
534 | <xsl:text>\newcommand\docbookbookinfoothercreditcontrib{</xsl:text>
|
---|
535 | <xsl:apply-templates />
|
---|
536 | <xsl:text>}
</xsl:text>
|
---|
537 | </xsl:when>
|
---|
538 | </xsl:choose>
|
---|
539 | </xsl:template>
|
---|
540 |
|
---|
541 | <xsl:template match="glossary">
|
---|
542 | <xsl:text>

\backmatter
\chapter{Glossary}
</xsl:text>
|
---|
543 | <xsl:apply-templates />
|
---|
544 | </xsl:template>
|
---|
545 |
|
---|
546 | <xsl:template match="para">
|
---|
547 | <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or name(..)='entry' or (name(../..)='varlistentry' and position()=1))">
|
---|
548 | <xsl:text>

</xsl:text>
|
---|
549 | </xsl:if>
|
---|
550 | <xsl:apply-templates />
|
---|
551 | </xsl:template>
|
---|
552 |
|
---|
553 | <xsl:template match="note">
|
---|
554 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
557 | </xsl:template>
|
---|
558 |
|
---|
559 | <xsl:template match="warning">
|
---|
560 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
563 | </xsl:template>
|
---|
564 |
|
---|
565 | <xsl:template match="screen">
|
---|
566 | <xsl:text>

{\footnotesize\begin{alltt}
</xsl:text>
|
---|
567 | <xsl:apply-templates />
|
---|
568 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
569 | </xsl:template>
|
---|
570 |
|
---|
571 | <xsl:template match="programlisting">
|
---|
572 | <xsl:text>

{\small\begin{alltt}
</xsl:text>
|
---|
573 | <xsl:apply-templates />
|
---|
574 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
575 | </xsl:template>
|
---|
576 |
|
---|
577 | <xsl:template match="footnote">
|
---|
578 | <xsl:text>\footnote{</xsl:text>
|
---|
579 | <xsl:apply-templates />
|
---|
580 | <xsl:text>}</xsl:text>
|
---|
581 | </xsl:template>
|
---|
582 |
|
---|
583 | <xsl:template match="tgroup">
|
---|
584 | <xsl:choose>
|
---|
585 | <xsl:when test="@style='verywide'">
|
---|
586 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{1.1\textwidth}[]</xsl:text>
|
---|
587 | </xsl:when>
|
---|
588 | <xsl:otherwise>
|
---|
589 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{.9\textwidth}[]</xsl:text>
|
---|
590 | </xsl:otherwise>
|
---|
591 | </xsl:choose>
|
---|
592 | <xsl:text>{</xsl:text>
|
---|
593 | <xsl:choose>
|
---|
594 | <xsl:when test="@cols='1'">
|
---|
595 | <xsl:text>|L|</xsl:text>
|
---|
596 | </xsl:when>
|
---|
597 | <xsl:when test="@cols='2'">
|
---|
598 | <xsl:text>|L|L|</xsl:text>
|
---|
599 | </xsl:when>
|
---|
600 | <xsl:when test="@cols='3'">
|
---|
601 | <xsl:text>|L|L|L|</xsl:text>
|
---|
602 | </xsl:when>
|
---|
603 | <xsl:when test="@cols='4'">
|
---|
604 | <xsl:text>|L|L|L|L|</xsl:text>
|
---|
605 | </xsl:when>
|
---|
606 | <xsl:when test="@cols='5'">
|
---|
607 | <xsl:text>|L|L|L|L|L|</xsl:text>
|
---|
608 | </xsl:when>
|
---|
609 | <xsl:when test="@cols='6'">
|
---|
610 | <xsl:text>|L|L|L|L|L|L|</xsl:text>
|
---|
611 | </xsl:when>
|
---|
612 | <xsl:otherwise>
|
---|
613 | <xsl:message terminate="yes">Unsupported number of columns (<xsl:value-of select="@cols"/>), fix document or converter</xsl:message>
|
---|
614 | </xsl:otherwise>
|
---|
615 | </xsl:choose>
|
---|
616 | <xsl:text>}
\hline
</xsl:text>
|
---|
617 | <xsl:apply-templates />
|
---|
618 | <xsl:text>
\end{tabulary}
\end{center}}
</xsl:text>
|
---|
619 | </xsl:template>
|
---|
620 |
|
---|
621 | <xsl:template match="row">
|
---|
622 | <xsl:apply-templates />
|
---|
623 | <xsl:text>
\\ \hline
</xsl:text>
|
---|
624 | </xsl:template>
|
---|
625 |
|
---|
626 | <xsl:template match="entry">
|
---|
627 | <xsl:if test="not(position()=1)">
|
---|
628 | <xsl:text> & </xsl:text>
|
---|
629 | </xsl:if>
|
---|
630 | <xsl:apply-templates />
|
---|
631 | </xsl:template>
|
---|
632 |
|
---|
633 | <xsl:template match="itemizedlist">
|
---|
634 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
635 | <xsl:text>
\begin{itemize}
</xsl:text>
|
---|
636 | <xsl:if test="@spacing = 'compact'">
|
---|
637 | <xsl:text> \setlength{\parskip}{0pt}
</xsl:text>
|
---|
638 | <xsl:text> \setlength{\itemsep}{0pt}
</xsl:text>
|
---|
639 | <xsl:text> \setlength{\topsep}{0pt}
</xsl:text>
|
---|
640 | <xsl:text> \setlength{\parsep}{0pt}
</xsl:text>
|
---|
641 | <xsl:text> \setlength{\partopsep}{0pt}
</xsl:text>
|
---|
642 | </xsl:if>
|
---|
643 | <xsl:apply-templates />
|
---|
644 | <xsl:text>
\end{itemize}
</xsl:text>
|
---|
645 | </xsl:template>
|
---|
646 |
|
---|
647 | <xsl:template match="orderedlist">
|
---|
648 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
649 | <xsl:text>
\begin{enumerate}
</xsl:text>
|
---|
650 | <xsl:if test="@spacing = 'compact'">
|
---|
651 | <xsl:text> \setlength{\parskip}{0pt}
</xsl:text>
|
---|
652 | <xsl:text> \setlength{\itemsep}{0pt}
</xsl:text>
|
---|
653 | <xsl:text> \setlength{\topsep}{0pt}
</xsl:text>
|
---|
654 | <xsl:text> \setlength{\parsep}{0pt}
</xsl:text>
|
---|
655 | <xsl:text> \setlength{\partopsep}{0pt}
</xsl:text>
|
---|
656 | </xsl:if>
|
---|
657 | <xsl:apply-templates />
|
---|
658 | <xsl:text>
\end{enumerate}
</xsl:text>
|
---|
659 | </xsl:template>
|
---|
660 |
|
---|
661 | <xsl:template match="variablelist">
|
---|
662 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
663 | <xsl:text>
\begin{description}
</xsl:text>
|
---|
664 | <xsl:if test="@spacing = 'compact'">
|
---|
665 | <xsl:text> \setlength{\parskip}{0pt}
</xsl:text>
|
---|
666 | <xsl:text> \setlength{\itemsep}{0pt}
</xsl:text>
|
---|
667 | <xsl:text> \setlength{\topsep}{0pt}
</xsl:text>
|
---|
668 | <xsl:text> \setlength{\parsep}{0pt}
</xsl:text>
|
---|
669 | <xsl:text> \setlength{\partopsep}{0pt}
</xsl:text>
|
---|
670 | </xsl:if>
|
---|
671 | <xsl:apply-templates />
|
---|
672 | <xsl:text>
\end{description}
</xsl:text>
|
---|
673 | </xsl:template>
|
---|
674 |
|
---|
675 | <xsl:template match="varlistentry">
|
---|
676 | <xsl:if test="not(./term) or not(./listitem) or count(./listitem) != 1">
|
---|
677 | <xsl:message terminate="yes">Expected at least one term and one listitem element in the varlistentry.</xsl:message>
|
---|
678 | </xsl:if>
|
---|
679 | <xsl:text>

\item[{\parbox[t]{\linewidth}{\raggedright </xsl:text>
|
---|
680 | <xsl:apply-templates select="./term[1]"/>
|
---|
681 | <xsl:for-each select="./term[position() > 1]">
|
---|
682 | <xsl:text>\\
 </xsl:text>
|
---|
683 | <xsl:apply-templates select="."/>
|
---|
684 | </xsl:for-each>
|
---|
685 | <xsl:text>}}]\hfill\\</xsl:text>
|
---|
686 | <xsl:apply-templates select="listitem/*"/>
|
---|
687 | </xsl:template>
|
---|
688 |
|
---|
689 | <xsl:template match="listitem">
|
---|
690 | <xsl:text>

\item </xsl:text>
|
---|
691 | <xsl:apply-templates />
|
---|
692 | <xsl:text>
</xsl:text>
|
---|
693 | </xsl:template>
|
---|
694 |
|
---|
695 | <xsl:template match="glossterm">
|
---|
696 | <xsl:variable name="refid" select="(@id)" />
|
---|
697 | <xsl:if test="$refid">
|
---|
698 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
699 | </xsl:if>
|
---|
700 | <xsl:text>

\item[</xsl:text>
|
---|
701 | <xsl:apply-templates />
|
---|
702 | <xsl:text>]</xsl:text>
|
---|
703 | </xsl:template>
|
---|
704 |
|
---|
705 | <xsl:template match="glosslist | glossdiv">
|
---|
706 | <xsl:text>

\begin{description}
</xsl:text>
|
---|
707 | <xsl:apply-templates />
|
---|
708 | <xsl:text>
\end{description}
</xsl:text>
|
---|
709 | </xsl:template>
|
---|
710 |
|
---|
711 | <xsl:template match="superscript">
|
---|
712 | <xsl:variable name="contents">
|
---|
713 | <xsl:apply-templates />
|
---|
714 | </xsl:variable>
|
---|
715 | <xsl:value-of select="concat('\texorpdfstring{\textsuperscript{', $contents, '}}{', $contents, '}')" />
|
---|
716 | </xsl:template>
|
---|
717 |
|
---|
718 | <xsl:template match="emphasis">
|
---|
719 | <xsl:choose>
|
---|
720 | <xsl:when test="@role='bold'">
|
---|
721 | <xsl:text>\textbf{</xsl:text>
|
---|
722 | </xsl:when>
|
---|
723 | <xsl:otherwise>
|
---|
724 | <xsl:text>\textit{</xsl:text>
|
---|
725 | </xsl:otherwise>
|
---|
726 | </xsl:choose>
|
---|
727 | <xsl:apply-templates />
|
---|
728 | <xsl:text>}</xsl:text>
|
---|
729 | </xsl:template>
|
---|
730 |
|
---|
731 | <xsl:template match="computeroutput | code">
|
---|
732 | <xsl:text>\texttt{</xsl:text>
|
---|
733 | <xsl:apply-templates />
|
---|
734 | <xsl:text>}</xsl:text>
|
---|
735 | </xsl:template>
|
---|
736 |
|
---|
737 | <xsl:template match="literal | filename">
|
---|
738 | <xsl:text>\texttt{</xsl:text>
|
---|
739 | <xsl:apply-templates />
|
---|
740 | <xsl:text>}</xsl:text>
|
---|
741 | </xsl:template>
|
---|
742 |
|
---|
743 | <xsl:template match="citetitle">
|
---|
744 | <xsl:text>\textit{</xsl:text>
|
---|
745 | <xsl:apply-templates />
|
---|
746 | <xsl:text>}</xsl:text>
|
---|
747 | </xsl:template>
|
---|
748 |
|
---|
749 | <xsl:template match="lineannotation">
|
---|
750 | <xsl:text>\textit{</xsl:text>
|
---|
751 | <xsl:apply-templates />
|
---|
752 | <xsl:text>}</xsl:text>
|
---|
753 | </xsl:template>
|
---|
754 |
|
---|
755 | <xsl:template match="ulink[@url!='' and not(text())]">
|
---|
756 | <xsl:text>\url{</xsl:text>
|
---|
757 | <xsl:value-of select="@url"/>
|
---|
758 | <xsl:text>}</xsl:text>
|
---|
759 | </xsl:template>
|
---|
760 |
|
---|
761 | <xsl:template match="ulink[@url!='' and text()]">
|
---|
762 | <xsl:text>\href{</xsl:text>
|
---|
763 | <xsl:value-of select="@url"/>
|
---|
764 | <xsl:text>}{</xsl:text>
|
---|
765 | <xsl:apply-templates />
|
---|
766 | <xsl:text>}</xsl:text>
|
---|
767 | </xsl:template>
|
---|
768 |
|
---|
769 | <xsl:template match="ulink[(@url='' or not(@url)) and text()]">
|
---|
770 | <xsl:text>\url{</xsl:text>
|
---|
771 | <xsl:apply-templates />
|
---|
772 | <xsl:text>}</xsl:text>
|
---|
773 | </xsl:template>
|
---|
774 |
|
---|
775 | <xsl:template match="xref">
|
---|
776 | <xsl:choose>
|
---|
777 | <xsl:when test="@endterm">
|
---|
778 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
|
---|
779 | </xsl:when>
|
---|
780 | <xsl:otherwise>
|
---|
781 | <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
|
---|
782 | </xsl:otherwise>
|
---|
783 | </xsl:choose>
|
---|
784 | </xsl:template>
|
---|
785 |
|
---|
786 | <xsl:template match="link">
|
---|
787 | <xsl:choose>
|
---|
788 | <xsl:when test="@endterm">
|
---|
789 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
|
---|
790 | </xsl:when>
|
---|
791 | <xsl:when test="./text()">
|
---|
792 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{')" />
|
---|
793 | <xsl:apply-templates select="./text()"/>
|
---|
794 | <xsl:value-of select="'}}'" />
|
---|
795 | </xsl:when>
|
---|
796 | <xsl:otherwise>
|
---|
797 | <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
|
---|
798 | </xsl:otherwise>
|
---|
799 | </xsl:choose>
|
---|
800 | </xsl:template>
|
---|
801 |
|
---|
802 | <xsl:template match="trademark">
|
---|
803 | <xsl:apply-templates />
|
---|
804 | <xsl:text>\textsuperscript{\textregistered}</xsl:text>
|
---|
805 | </xsl:template>
|
---|
806 |
|
---|
807 | <!-- for some reason, DocBook insists of having image data nested this way always:
|
---|
808 | mediaobject -> imageobject -> imagedata
|
---|
809 | but only imagedata is interesting -->
|
---|
810 | <xsl:template match="imagedata">
|
---|
811 | <xsl:if test="@align='center'">
|
---|
812 | <xsl:text>\begin{center}</xsl:text>
|
---|
813 | </xsl:if>
|
---|
814 | <xsl:value-of select="concat('
\includegraphics[width=', @width, ']{', @fileref, '}
')" />
|
---|
815 | <xsl:apply-templates />
|
---|
816 | <xsl:if test="@align='center'">
|
---|
817 | <xsl:text>\end{center}</xsl:text>
|
---|
818 | </xsl:if>
|
---|
819 | </xsl:template>
|
---|
820 |
|
---|
821 | <!--
|
---|
822 | Turn the refsynopsisdiv part of a manpage into a named & indented paragraph.
|
---|
823 | -->
|
---|
824 | <xsl:template match="refsynopsisdiv">
|
---|
825 | <xsl:if test="name(*[1]) != 'cmdsynopsis'"><xsl:message terminate="yes">Expected refsynopsisdiv to start with cmdsynopsis</xsl:message></xsl:if>
|
---|
826 | <xsl:if test="title"><xsl:message terminate="yes">No title element supported in refsynopsisdiv</xsl:message></xsl:if>
|
---|
827 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
828 | <xsl:text>
\subsection*{Synopsis}
</xsl:text>
|
---|
829 | <xsl:apply-templates />
|
---|
830 | </xsl:template>
|
---|
831 |
|
---|
832 | <!--
|
---|
833 | The refsect1 is used for 'Description' and such. Do same as with refsynopsisdiv
|
---|
834 | and turn it into a named & indented paragraph.
|
---|
835 | -->
|
---|
836 | <xsl:template match="refsect1">
|
---|
837 | <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
|
---|
838 | <xsl:message terminate="yes">Expected exactly one title as the first refsect1 element (remarks goes after title!).</xsl:message>
|
---|
839 | </xsl:if>
|
---|
840 | <xsl:apply-templates/>
|
---|
841 | </xsl:template>
|
---|
842 |
|
---|
843 | <!--
|
---|
844 | The refsect2 element will be turned into a subparagraph if it has a title,
|
---|
845 | however, that didn't work out when it didn't have a title and started with
|
---|
846 | a cmdsynopsis instead (subcommand docs). So, we're doing some trickery
|
---|
847 | here (HACK ALERT) for the non-title case to feign a paragraph.
|
---|
848 | -->
|
---|
849 | <xsl:template match="refsect2">
|
---|
850 | <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
|
---|
851 | <xsl:message terminate="yes">Expected exactly one title as the first refsect2 element (remarks goes after title!).</xsl:message>
|
---|
852 | </xsl:if>
|
---|
853 | <xsl:apply-templates/>
|
---|
854 | <xsl:text>
</xsl:text>
|
---|
855 | </xsl:template>
|
---|
856 |
|
---|
857 |
|
---|
858 | <!--
|
---|
859 | Command Synopsis elements.
|
---|
860 |
|
---|
861 | We treat each command element inside a cmdsynopsis as the start of
|
---|
862 | a new paragraph. The DocBook HTML converter does so too, but the
|
---|
863 | manpage one doesn't.
|
---|
864 |
|
---|
865 | sbr and linebreaks made by latex should be indented from the base
|
---|
866 | command level. This is done by the \hangindent3em\hangafter1 bits.
|
---|
867 |
|
---|
868 | We exploit the default paragraph indentation to get each command
|
---|
869 | indented from the left margin. This, unfortunately, doesn't work
|
---|
870 | if we're the first paragraph in a (sub*)section. \noindent cannot
|
---|
871 | counter this due to when latex enforces first paragraph stuff. Since
|
---|
872 | it's tedious to figure out when we're in the first paragraph and when
|
---|
873 | not, we just do \noindent\hspace{1em} everywhere.
|
---|
874 | -->
|
---|
875 | <xsl:template match="sbr">
|
---|
876 | <xsl:if test="not(ancestor::cmdsynopsis)">
|
---|
877 | <xsl:message terminate="yes">sbr only supported inside cmdsynopsis (because of hangindent)</xsl:message>
|
---|
878 | </xsl:if>
|
---|
879 | <xsl:text>\newline</xsl:text>
|
---|
880 | </xsl:template>
|
---|
881 |
|
---|
882 | <xsl:template match="refentry|refnamediv|refentryinfo|refmeta|refsect3|refsect4|refsect5|synopfragment|synopfragmentref|cmdsynopsis/info">
|
---|
883 | <xsl:message terminate="yes"><xsl:value-of select="name()"/> is not supported</xsl:message>
|
---|
884 | </xsl:template>
|
---|
885 |
|
---|
886 | <xsl:template match="cmdsynopsis">
|
---|
887 | <xsl:if test="preceding-sibling::cmdsynopsis">
|
---|
888 | <xsl:text>%cmdsynopsis</xsl:text>
|
---|
889 | </xsl:if>
|
---|
890 | <xsl:text>
</xsl:text>
|
---|
891 | <xsl:text>\begin{flushleft}</xsl:text>
|
---|
892 | <xsl:if test="parent::remark[@role='VBoxManage-overview']">
|
---|
893 | <!-- Overview fontsize trick -->
|
---|
894 | <xsl:text>{\footnotesize</xsl:text>
|
---|
895 | </xsl:if>
|
---|
896 | <xsl:text>\noindent\hspace{1em}</xsl:text>
|
---|
897 | <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
|
---|
898 | <xsl:apply-templates />
|
---|
899 | <xsl:text>}</xsl:text>
|
---|
900 | <xsl:if test="following-sibling::*">
|
---|
901 | </xsl:if>
|
---|
902 |
|
---|
903 | <!-- For refsect2 subcommand descriptions. -->
|
---|
904 | <xsl:if test="not(following-sibling::cmdsynopsis) and position() != last()">
|
---|
905 | <xsl:text>\linebreak</xsl:text>
|
---|
906 | </xsl:if>
|
---|
907 | <!-- Special overview trick for the current VBoxManage command overview. -->
|
---|
908 | <xsl:if test="parent::remark[@role='VBoxManage-overview']">
|
---|
909 | <xsl:text>\par}</xsl:text>
|
---|
910 | </xsl:if>
|
---|
911 | <xsl:text>\end{flushleft}</xsl:text>
|
---|
912 | </xsl:template>
|
---|
913 |
|
---|
914 | <xsl:template match="command">
|
---|
915 | <xsl:choose>
|
---|
916 | <xsl:when test="ancestor::cmdsynopsis">
|
---|
917 | <!-- Trigger a line break if this isn't the first command in a synopsis -->
|
---|
918 | <xsl:if test="preceding-sibling::command">
|
---|
919 | <xsl:text>}\par%command
</xsl:text>
|
---|
920 | <xsl:text>\noindent\hspace{1em}</xsl:text>
|
---|
921 | <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
|
---|
922 | </xsl:if>
|
---|
923 | <xsl:apply-templates />
|
---|
924 | </xsl:when>
|
---|
925 | <xsl:otherwise>
|
---|
926 | <xsl:text>\texttt{</xsl:text>
|
---|
927 | <xsl:apply-templates />
|
---|
928 | <xsl:text>}</xsl:text>
|
---|
929 | </xsl:otherwise>
|
---|
930 | </xsl:choose>
|
---|
931 | </xsl:template>
|
---|
932 |
|
---|
933 | <xsl:template match="option">
|
---|
934 | <xsl:choose>
|
---|
935 | <xsl:when test="ancestor::cmdsynopsis">
|
---|
936 | <xsl:apply-templates />
|
---|
937 | </xsl:when>
|
---|
938 | <xsl:otherwise>
|
---|
939 | <xsl:text>\texttt{</xsl:text>
|
---|
940 | <xsl:apply-templates />
|
---|
941 | <xsl:text>}</xsl:text>
|
---|
942 | </xsl:otherwise>
|
---|
943 | </xsl:choose>
|
---|
944 | </xsl:template>
|
---|
945 |
|
---|
946 | <!-- duplicated in docbook-refentry-to-C-help.xsl -->
|
---|
947 | <xsl:template match="arg|group">
|
---|
948 | <!-- separator char if we're not the first child -->
|
---|
949 | <xsl:if test="position() > 1">
|
---|
950 | <xsl:choose>
|
---|
951 | <xsl:when test="parent::group and ancestor::*[@role='compact']"><xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.or.sep.compact.tex"/><xsl:text>}</xsl:text></xsl:when>
|
---|
952 | <xsl:when test="parent::group"><xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.or.sep.tex"/><xsl:text>}</xsl:text></xsl:when>
|
---|
953 | <xsl:when test="ancestor::*[@role='compact']"></xsl:when>
|
---|
954 | <xsl:when test="ancestor::*/@sepchar"><xsl:value-of select="ancestor::*/@sepchar"/></xsl:when>
|
---|
955 | <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
|
---|
956 | </xsl:choose>
|
---|
957 | </xsl:if>
|
---|
958 |
|
---|
959 | <!-- open wrapping -->
|
---|
960 | <xsl:choose>
|
---|
961 | <xsl:when test="not(@choice) or @choice = ''"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.def.open.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
962 | <xsl:when test="@choice = 'opt'"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.opt.open.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
963 | <xsl:when test="@choice = 'req'"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.req.open.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
964 | <xsl:when test="@choice = 'plain'"/>
|
---|
965 | <xsl:otherwise><xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Invalid arg choice: "<xsl:value-of select="@choice"/>"</xsl:message></xsl:otherwise>
|
---|
966 | </xsl:choose>
|
---|
967 |
|
---|
968 | <xsl:apply-templates />
|
---|
969 |
|
---|
970 | <!-- repeat indication -->
|
---|
971 | <xsl:choose>
|
---|
972 | <xsl:when test="@rep = 'norepeat' or not(@rep) or @rep = ''"/>
|
---|
973 | <xsl:when test="@rep = 'repeat'">
|
---|
974 | <!-- add space padding if we're in a repeating group -->
|
---|
975 | <xsl:if test="self::group">
|
---|
976 | <xsl:text> </xsl:text>
|
---|
977 | </xsl:if>
|
---|
978 | <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.rep.repeat.str.tex"/><xsl:text>}</xsl:text>
|
---|
979 | </xsl:when>
|
---|
980 | <xsl:otherwise><xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Invalid rep choice: "<xsl:value-of select="@rep"/>"</xsl:message></xsl:otherwise>
|
---|
981 | </xsl:choose>
|
---|
982 |
|
---|
983 | <!-- close wrapping -->
|
---|
984 | <xsl:choose>
|
---|
985 | <xsl:when test="not(@choice) or @choice = ''"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.def.close.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
986 | <xsl:when test="@choice = 'opt'"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.opt.close.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
987 | <xsl:when test="@choice = 'req'"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.req.close.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
988 | </xsl:choose>
|
---|
989 |
|
---|
990 | <!-- add space padding if we're the last element in a nested arg -->
|
---|
991 | <!-- 2023-03-22 bird: This is incorrectly written. Fix as needed...
|
---|
992 | <xsl:if test="(parent::arg or parent::group) and not(following-sibling) and not(ancestor::*[@role='compact'])">
|
---|
993 | <xsl:text> </xsl:text>
|
---|
994 | </xsl:if> -->
|
---|
995 | </xsl:template>
|
---|
996 |
|
---|
997 | <xsl:template match="replaceable">
|
---|
998 | <xsl:choose>
|
---|
999 | <xsl:when test="(not(ancestor::cmdsynopsis) and not(ancestor::option) and not(ancestor::screen)) or ancestor::arg">
|
---|
1000 | <xsl:text>\texttt{\textit{</xsl:text>
|
---|
1001 | <xsl:apply-templates />
|
---|
1002 | <xsl:text>}}</xsl:text>
|
---|
1003 | </xsl:when>
|
---|
1004 | <xsl:otherwise>
|
---|
1005 | <xsl:text>\textit{<</xsl:text>
|
---|
1006 | <xsl:apply-templates />
|
---|
1007 | <xsl:text>>}</xsl:text>
|
---|
1008 | </xsl:otherwise>
|
---|
1009 | </xsl:choose>
|
---|
1010 | </xsl:template>
|
---|
1011 |
|
---|
1012 |
|
---|
1013 | <!--
|
---|
1014 | Generic element text magic.
|
---|
1015 | -->
|
---|
1016 | <xsl:template match="//text()">
|
---|
1017 |
|
---|
1018 | <!-- Do the translation of \ into \textbackslash{} in two steps, to avoid
|
---|
1019 | running into replacing {} as well which would be very wrong. -->
|
---|
1020 | <xsl:variable name="subst1">
|
---|
1021 | <xsl:call-template name="str:subst">
|
---|
1022 | <xsl:with-param name="text" select="." />
|
---|
1023 | <xsl:with-param name="replace" select="'\'" />
|
---|
1024 | <xsl:with-param name="with" select="'\textbackslash'" />
|
---|
1025 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1026 | </xsl:call-template>
|
---|
1027 | </xsl:variable>
|
---|
1028 | <xsl:variable name="subst2">
|
---|
1029 | <xsl:call-template name="str:subst">
|
---|
1030 | <xsl:with-param name="text" select="$subst1" />
|
---|
1031 | <xsl:with-param name="replace" select="'{'" />
|
---|
1032 | <xsl:with-param name="with" select="'\{'" />
|
---|
1033 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1034 | </xsl:call-template>
|
---|
1035 | </xsl:variable>
|
---|
1036 | <xsl:variable name="subst3">
|
---|
1037 | <xsl:call-template name="str:subst">
|
---|
1038 | <xsl:with-param name="text" select="$subst2" />
|
---|
1039 | <xsl:with-param name="replace" select="'}'" />
|
---|
1040 | <xsl:with-param name="with" select="'\}'" />
|
---|
1041 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1042 | </xsl:call-template>
|
---|
1043 | </xsl:variable>
|
---|
1044 | <xsl:variable name="subst4">
|
---|
1045 | <xsl:call-template name="str:subst">
|
---|
1046 | <xsl:with-param name="text" select="$subst3" />
|
---|
1047 | <xsl:with-param name="replace" select="'\textbackslash'" />
|
---|
1048 | <xsl:with-param name="with" select="'\textbackslash{}'" />
|
---|
1049 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1050 | </xsl:call-template>
|
---|
1051 | </xsl:variable>
|
---|
1052 |
|
---|
1053 | <xsl:choose>
|
---|
1054 | <xsl:when test="(name(..) = 'computeroutput') or (name(../..) = 'computeroutput')
|
---|
1055 | or (name(..) = 'code') or (name(../..) = 'code')
|
---|
1056 | or (name(..) = 'arg') or (name(../..) = 'arg')
|
---|
1057 | or (name(..) = 'option') or (name(../..) = 'option')
|
---|
1058 | or (name(..) = 'command') or (name(../..) = 'command')
|
---|
1059 | or (name(..) = 'cmdsynopsis') or (name(../..) = 'cmdsynopsis')
|
---|
1060 | or (name(..) = 'replaceable') or (name(../..) = 'replaceable')
|
---|
1061 | or (name(..) = 'entry') or (name(../..) = 'entry')
|
---|
1062 | ">
|
---|
1063 | <xsl:variable name="subst5">
|
---|
1064 | <xsl:call-template name="str:subst">
|
---|
1065 | <xsl:with-param name="text" select="translate(normalize-space(concat('',$subst4,'')),'','')" />
|
---|
1066 | <xsl:with-param name="replace" select="'--'" />
|
---|
1067 | <xsl:with-param name="with" select="'-{}-'" />
|
---|
1068 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1069 | </xsl:call-template>
|
---|
1070 | </xsl:variable>
|
---|
1071 | <xsl:variable name="subst6">
|
---|
1072 | <xsl:call-template name="str:subst">
|
---|
1073 | <xsl:with-param name="text" select="$subst5" />
|
---|
1074 | <xsl:with-param name="replace" select="'_'" />
|
---|
1075 | <xsl:with-param name="with" select="'\_'" />
|
---|
1076 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1077 | </xsl:call-template>
|
---|
1078 | </xsl:variable>
|
---|
1079 | <xsl:variable name="subst7">
|
---|
1080 | <xsl:call-template name="str:subst">
|
---|
1081 | <xsl:with-param name="text" select="$subst6" />
|
---|
1082 | <xsl:with-param name="replace" select="'$'" />
|
---|
1083 | <xsl:with-param name="with" select="'\$'" />
|
---|
1084 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1085 | </xsl:call-template>
|
---|
1086 | </xsl:variable>
|
---|
1087 | <xsl:variable name="subst8">
|
---|
1088 | <xsl:call-template name="str:subst">
|
---|
1089 | <xsl:with-param name="text" select="$subst7" />
|
---|
1090 | <xsl:with-param name="replace" select="'%'" />
|
---|
1091 | <xsl:with-param name="with" select="'\%'" />
|
---|
1092 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1093 | </xsl:call-template>
|
---|
1094 | </xsl:variable>
|
---|
1095 | <xsl:variable name="subst9">
|
---|
1096 | <xsl:call-template name="str:subst">
|
---|
1097 | <xsl:with-param name="text" select="$subst8" />
|
---|
1098 | <xsl:with-param name="replace" select="'#'" />
|
---|
1099 | <xsl:with-param name="with" select="'\#'" />
|
---|
1100 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1101 | </xsl:call-template>
|
---|
1102 | </xsl:variable>
|
---|
1103 | <xsl:variable name="subst10">
|
---|
1104 | <xsl:call-template name="str:subst">
|
---|
1105 | <xsl:with-param name="text" select="$subst9" />
|
---|
1106 | <xsl:with-param name="replace" select="'~'" />
|
---|
1107 | <xsl:with-param name="with" select="'\textasciitilde{}'" />
|
---|
1108 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1109 | </xsl:call-template>
|
---|
1110 | </xsl:variable>
|
---|
1111 | <xsl:variable name="subst11">
|
---|
1112 | <xsl:call-template name="str:subst">
|
---|
1113 | <xsl:with-param name="text" select="$subst10" />
|
---|
1114 | <xsl:with-param name="replace" select="'&'" />
|
---|
1115 | <xsl:with-param name="with" select="'\&'" />
|
---|
1116 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1117 | </xsl:call-template>
|
---|
1118 | </xsl:variable>
|
---|
1119 | <xsl:choose>
|
---|
1120 | <xsl:when test="parent::arg or parent::command">
|
---|
1121 | <xsl:variable name="subst12">
|
---|
1122 | <xsl:call-template name="str:subst">
|
---|
1123 | <xsl:with-param name="text" select="$subst10" />
|
---|
1124 | <xsl:with-param name="replace" select="' '" />
|
---|
1125 | <xsl:with-param name="with" select="'~'" />
|
---|
1126 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1127 | </xsl:call-template>
|
---|
1128 | </xsl:variable>
|
---|
1129 | <xsl:value-of select="$subst12" />
|
---|
1130 | </xsl:when>
|
---|
1131 | <xsl:otherwise>
|
---|
1132 | <xsl:value-of select="$subst11" />
|
---|
1133 | </xsl:otherwise>
|
---|
1134 | </xsl:choose>
|
---|
1135 | </xsl:when>
|
---|
1136 |
|
---|
1137 | <xsl:when test="(name(..)='address') or (name(../..)='address')">
|
---|
1138 | <xsl:variable name="subst5">
|
---|
1139 | <xsl:call-template name="str:subst">
|
---|
1140 | <xsl:with-param name="text" select="$subst4" />
|
---|
1141 | <xsl:with-param name="replace" select="'
'" />
|
---|
1142 | <xsl:with-param name="with" select="' \\'" />
|
---|
1143 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1144 | </xsl:call-template>
|
---|
1145 | </xsl:variable>
|
---|
1146 | <xsl:value-of select="$subst5" />
|
---|
1147 | </xsl:when>
|
---|
1148 |
|
---|
1149 | <!-- <screen> and <programlisting>, which work with alltt environment. -->
|
---|
1150 | <xsl:otherwise>
|
---|
1151 | <xsl:variable name="subst5">
|
---|
1152 | <xsl:call-template name="str:subst">
|
---|
1153 | <xsl:with-param name="text" select="$subst4" />
|
---|
1154 | <xsl:with-param name="replace" select="'_'" />
|
---|
1155 | <xsl:with-param name="with" select="'\_'" />
|
---|
1156 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1157 | </xsl:call-template>
|
---|
1158 | </xsl:variable>
|
---|
1159 | <xsl:variable name="subst6">
|
---|
1160 | <xsl:call-template name="str:subst">
|
---|
1161 | <xsl:with-param name="text" select="$subst5" />
|
---|
1162 | <xsl:with-param name="replace" select="'$'" />
|
---|
1163 | <xsl:with-param name="with" select="'\$'" />
|
---|
1164 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1165 | </xsl:call-template>
|
---|
1166 | </xsl:variable>
|
---|
1167 | <xsl:variable name="subst7">
|
---|
1168 | <xsl:call-template name="str:subst">
|
---|
1169 | <xsl:with-param name="text" select="$subst6" />
|
---|
1170 | <xsl:with-param name="replace" select="'%'" />
|
---|
1171 | <xsl:with-param name="with" select="'\%'" />
|
---|
1172 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1173 | </xsl:call-template>
|
---|
1174 | </xsl:variable>
|
---|
1175 | <xsl:variable name="subst8">
|
---|
1176 | <xsl:call-template name="str:subst">
|
---|
1177 | <xsl:with-param name="text" select="$subst7" />
|
---|
1178 | <xsl:with-param name="replace" select="'#'" />
|
---|
1179 | <xsl:with-param name="with" select="'\#'" />
|
---|
1180 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1181 | </xsl:call-template>
|
---|
1182 | </xsl:variable>
|
---|
1183 | <xsl:variable name="subst9">
|
---|
1184 | <xsl:call-template name="str:subst">
|
---|
1185 | <xsl:with-param name="text" select="$subst8" />
|
---|
1186 | <xsl:with-param name="replace" select="'µ'" />
|
---|
1187 | <xsl:with-param name="with" select="'$\mu$'" />
|
---|
1188 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1189 | </xsl:call-template>
|
---|
1190 | </xsl:variable>
|
---|
1191 | <xsl:variable name="subst10">
|
---|
1192 | <xsl:call-template name="str:subst">
|
---|
1193 | <xsl:with-param name="text" select="$subst9" />
|
---|
1194 | <xsl:with-param name="replace" select="'®'" />
|
---|
1195 | <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
|
---|
1196 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1197 | </xsl:call-template>
|
---|
1198 | </xsl:variable>
|
---|
1199 | <xsl:variable name="quote">"</xsl:variable>
|
---|
1200 | <!-- preparation for pretty quotes: replace all double quotes _outside_ screen
|
---|
1201 | sections with "\QUOTE{}" strings, which the makefile will then replace
|
---|
1202 | with pretty quotes by invoking sed a few times. Unfortunately there are
|
---|
1203 | no regular expressions in XSLT so there's no other way. -->
|
---|
1204 | <xsl:variable name="subst11">
|
---|
1205 | <xsl:choose>
|
---|
1206 | <xsl:when test="(name(..)='screen') or (name(../..)='screen')
|
---|
1207 | or (name(..)='programlisting') or (name(../..)='programlisting')
|
---|
1208 | or (name(..)='literal') or (name(../..)='literal')
|
---|
1209 | ">
|
---|
1210 | <xsl:value-of select="$subst10" />
|
---|
1211 | </xsl:when>
|
---|
1212 | <xsl:otherwise>
|
---|
1213 | <xsl:call-template name="str:subst">
|
---|
1214 | <xsl:with-param name="text" select="$subst10" />
|
---|
1215 | <xsl:with-param name="replace" select="$quote" />
|
---|
1216 | <xsl:with-param name="with" select="'\QUOTE{}'" />
|
---|
1217 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1218 | </xsl:call-template>
|
---|
1219 | </xsl:otherwise>
|
---|
1220 | </xsl:choose>
|
---|
1221 | </xsl:variable>
|
---|
1222 | <xsl:variable name="subst12">
|
---|
1223 | <xsl:call-template name="str:subst">
|
---|
1224 | <xsl:with-param name="text" select="$subst11" />
|
---|
1225 | <xsl:with-param name="replace" select="'~'" />
|
---|
1226 | <xsl:with-param name="with" select="'\textasciitilde{}'" />
|
---|
1227 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1228 | </xsl:call-template>
|
---|
1229 | </xsl:variable>
|
---|
1230 | <xsl:variable name="subst13">
|
---|
1231 | <xsl:call-template name="str:subst">
|
---|
1232 | <xsl:with-param name="text" select="$subst12" />
|
---|
1233 | <xsl:with-param name="replace" select="'&'" />
|
---|
1234 | <xsl:with-param name="with" select="'\&'" />
|
---|
1235 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1236 | </xsl:call-template>
|
---|
1237 | </xsl:variable>
|
---|
1238 | <xsl:variable name="subst14">
|
---|
1239 | <xsl:call-template name="str:subst">
|
---|
1240 | <xsl:with-param name="text" select="$subst13" />
|
---|
1241 | <xsl:with-param name="replace" select="'→'" />
|
---|
1242 | <xsl:with-param name="with" select="'\ensuremath{\rightarrow}'" />
|
---|
1243 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1244 | </xsl:call-template>
|
---|
1245 | </xsl:variable>
|
---|
1246 | <xsl:variable name="subst15">
|
---|
1247 | <xsl:call-template name="str:subst">
|
---|
1248 | <xsl:with-param name="text" select="$subst14" />
|
---|
1249 | <xsl:with-param name="replace" select="'←'" />
|
---|
1250 | <xsl:with-param name="with" select="'\ensuremath{\leftarrow}'" />
|
---|
1251 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1252 | </xsl:call-template>
|
---|
1253 | </xsl:variable>
|
---|
1254 | <xsl:variable name="subst16">
|
---|
1255 | <xsl:call-template name="str:subst">
|
---|
1256 | <xsl:with-param name="text" select="$subst15" />
|
---|
1257 | <xsl:with-param name="replace" select="'↔'" />
|
---|
1258 | <xsl:with-param name="with" select="'\ensuremath{\leftrightarrow}'" />
|
---|
1259 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1260 | </xsl:call-template>
|
---|
1261 | </xsl:variable>
|
---|
1262 | <xsl:value-of select="$subst16" />
|
---|
1263 | </xsl:otherwise>
|
---|
1264 | </xsl:choose>
|
---|
1265 | </xsl:template>
|
---|
1266 |
|
---|
1267 | <!--
|
---|
1268 | xsltprocNewlineOutputHack - emits a single new line.
|
---|
1269 |
|
---|
1270 | Hack Alert! This template helps xsltproc split up the output text elements
|
---|
1271 | and avoid reallocating them into the MB range. Calls to this
|
---|
1272 | template is made occationally while generating larger output
|
---|
1273 | file. It's not necessary for small stuff like header.
|
---|
1274 |
|
---|
1275 | The trick we're playing on xsltproc has to do with CDATA
|
---|
1276 | and/or the escape setting of the xsl:text element. It forces
|
---|
1277 | xsltproc to allocate a new output element, thus preventing
|
---|
1278 | things from growing out of proportions and slowing us down.
|
---|
1279 |
|
---|
1280 | This was successfully employed to reduce a 18+ seconds run to
|
---|
1281 | around one second (possibly less due to kmk overhead).
|
---|
1282 | -->
|
---|
1283 | <xsl:template name="xsltprocNewlineOutputHack">
|
---|
1284 | <xsl:text disable-output-escaping="yes"><![CDATA[
|
---|
1285 | ]]></xsl:text>
|
---|
1286 | </xsl:template>
|
---|
1287 |
|
---|
1288 | </xsl:stylesheet>
|
---|
1289 |
|
---|