VirtualBox

source: vbox/trunk/doc/manual/docbook2latex.xsl@ 97708

Last change on this file since 97708 was 97708, checked in by vboxsync, 2 years ago

doc/manual/docbook2latex.xsl: Fix page numbering style for SDK reference manual.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 49.9 KB
Line 
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-2022 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.tex"> |~</xsl:variable>
100
101 <xsl:output method="text"/>
102
103 <xsl:strip-space elements="*"/>
104 <xsl:preserve-space elements="para"/>
105
106 <xsl:template match="/book">
107 <xsl:text>
108\documentclass[oneside,a4paper,10pt,DIV10]{scrbook}
109\usepackage{geometry}
110\geometry{top=3cm,bottom=4cm}
111\usepackage[T1]{fontenc}
112\usepackage{tabulary}
113\usepackage[pdftex,
114 a4paper,
115 colorlinks=true,
116 linkcolor=blue,
117 urlcolor=darkgreen,
118 bookmarksnumbered,
119 bookmarksopen=true,
120 bookmarksopenlevel=0,
121 hyperfootnotes=false,
122 plainpages=false,
123 pdfpagelabels
124 ]{hyperref}
125
126\usepackage{nameref}
127\usepackage{graphicx}
128\usepackage{hyperref}
129\usepackage{fancybox}
130\usepackage{alltt}
131\usepackage{color}
132\usepackage{scrextend}
133\definecolor{darkgreen}{rgb}{0,0.6,0}
134\tymin=21pt
135
136</xsl:text>
137 <xsl:if test="$TARGETLANG='de_DE'">\usepackage[ngerman]{babel}&#10;\PrerenderUnicode{ü}</xsl:if>
138<!-- <xsl:if test="$TARGETLANG='fr_FR'">\usepackage[french]{babel}&#10;\FrenchItemizeSpacingfalse&#10;\renewcommand{\FrenchLabelItem}{\textbullet}</xsl:if>
139 this command is no longer understood by TexLive2008
140 -->
141 <xsl:text>
142
143% use Palatino as serif font:
144% \usepackage{mathpazo}
145\usepackage{charter}
146% use Helvetica as sans-serif font:
147\usepackage{helvet}
148
149% use Bera Mono (a variant of Bitstream Vera Mono) as typewriter font
150% (requires texlive-fontsextra)
151\usepackage[scaled]{beramono}
152% previously: use Courier as typewriter font:
153% \usepackage{courier}
154
155\definecolor{colNote}{rgb}{0,0,0}
156\definecolor{colWarning}{rgb}{0,0,0}
157\definecolor{colScreenFrame}{rgb}{0,0,0}
158\definecolor{colScreenText}{rgb}{0,0,0}
159
160% number headings down to this level
161\setcounter{secnumdepth}{3}
162% more space for the section numbers
163\makeatletter
164\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.9em}}
165\renewcommand*\l@subsection{\@dottedtocline{2}{4.4em}{3.8em}}
166\renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{3.8em}}
167\renewcommand*\@pnumwidth{1.7em}
168\renewcommand*\@tocrmarg{5.0em}
169\makeatother
170
171% more tolerance at 2nd wrap stage:
172\tolerance = 1000
173% allow 3rd wrap stage:
174\emergencystretch = 10pt
175% no Schusterjungen:
176\clubpenalty = 10000
177% no Hurenkinder:
178\widowpenalty = 10000
179\displaywidowpenalty = 10000
180% max pdf compression:
181\pdfcompresslevel9
182
183% opening and closing quotes: the OQ and CQ macros define this (and the makefile employs some sed magic also)
184</xsl:text>
185 <xsl:choose>
186 <xsl:when test="$TARGETLANG='de_DE'">
187 <xsl:text>\newcommand\OQ{\texorpdfstring{\glqq}{"}}&#10;\newcommand\CQ{\texorpdfstring{\grqq}{"}}&#10;</xsl:text>
188 </xsl:when>
189 <xsl:when test="$TARGETLANG='fr_FR'">
190 <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}}&#10;\newcommand\CQ{\texorpdfstring{''}{"}}&#10;</xsl:text>
191 </xsl:when>
192 <xsl:when test="$TARGETLANG='en_US'">
193 <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}}&#10;\newcommand\CQ{\texorpdfstring{''}{"}}&#10;</xsl:text>
194 </xsl:when>
195 <xsl:otherwise>
196 <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
197 </xsl:otherwise>
198 </xsl:choose>
199
200 <xsl:apply-templates />
201
202 <xsl:text>
203\end{sloppypar}
204\end{document}
205 </xsl:text>
206
207 </xsl:template>
208
209 <xsl:template match="bookinfo">
210 <xsl:apply-templates />
211 <xsl:text>&#x0a;\newcommand\docbookbookinfocopyright{Copyright \copyright{} \docbookbookinfocopyrightyear{} \docbookbookinfocopyrightholder{}}&#x0a;
212\author{ \docbooktitleedition \\ %
213\\ %
214</xsl:text>
215 <xsl:if test="//bookinfo/address">
216 <xsl:text>\docbookbookinfoaddress \\ %
217\\ %
218</xsl:text>
219 </xsl:if>
220 <xsl:text>\docbookbookinfocopyright \\ %
221}
222
223\title{\docbooktitle \\
224\docbooksubtitle}
225% \subtitle{\docbooksubtitle}
226\hypersetup{pdfauthor=\docbookcorpauthor}
227\hypersetup{pdftitle=\docbooktitle{} \docbooksubtitle{}}
228
229\hyphenation{da-ta-ba-ses}
230\hyphenation{deb-conf}
231\hyphenation{VirtualBox}
232
233\begin{document}
234\frontmatter
235% bird/2018-05-14: Use sloppypar so we don't push path names and other long words
236% thru the right margin. TODO: Find better solution? microtype?
237\begin{sloppypar}
238% \maketitle
239%\begin{titlepage}
240\thispagestyle{empty}
241\begin{minipage}{\textwidth}
242\begin{center}
243\includegraphics[width=4cm]{images/vboxlogo.png}
244\end{center}%
245\vspace{10mm}
246
247{\fontsize{40pt}{40pt}\selectfont\rmfamily\bfseries%
248\begin{center}
249\docbooktitle
250\end{center}%
251\vspace{10mm}
252}
253
254{\fontsize{30pt}{30pt}\selectfont\rmfamily\bfseries%
255\begin{center}
256\docbooksubtitle
257\end{center}%
258\vspace{10mm}
259}
260
261{\fontsize{16pt}{20pt}\selectfont\rmfamily%
262\begin{center}
263</xsl:text>
264 <xsl:if test="//bookinfo/othercredit">
265 <xsl:text>\docbookbookinfoothercreditcontrib{}: \docbookbookinfoothercreditfirstname{} \docbookbookinfoothercreditsurname
266
267\vspace{8mm}
268</xsl:text>
269 </xsl:if>
270 <xsl:text>\docbooktitleedition
271
272\vspace{2mm}
273
274\docbookbookinfocopyright
275
276\vspace{2mm}
277
278\docbookbookinfoaddress
279\end{center}%
280}
281
282%\end{titlepage}
283\end{minipage}
284
285\tableofcontents
286 </xsl:text>
287 </xsl:template>
288
289 <xsl:template match="subtitle">
290 <xsl:choose>
291 <xsl:when test="name(..)='bookinfo'">
292 <xsl:text>\newcommand\docbooksubtitle{</xsl:text>
293 <xsl:apply-templates />
294 <xsl:text>}</xsl:text>
295 </xsl:when>
296 </xsl:choose>
297 </xsl:template>
298
299 <!-- Determins the section depth, returning a number 1,2,3,4,5,6,7,... -->
300 <xsl:template name="get-section-level">
301 <xsl:param name="a_Node" select=".."/>
302 <xsl:for-each select="$a_Node"> <!-- makes it current -->
303 <xsl:choose>
304 <xsl:when test="self::sect1"><xsl:text>1</xsl:text></xsl:when>
305 <xsl:when test="self::sect2"><xsl:text>2</xsl:text></xsl:when>
306 <xsl:when test="self::sect3"><xsl:text>3</xsl:text></xsl:when>
307 <xsl:when test="self::sect4"><xsl:text>4</xsl:text></xsl:when>
308 <xsl:when test="self::sect5"><xsl:text>5</xsl:text></xsl:when>
309 <xsl:when test="self::section">
310 <xsl:value-of select="count(ancestor::section) + 1"/>
311 </xsl:when>
312 <xsl:when test="self::simplesect">
313 <xsl:variable name="tmp">
314 <xsl:call-template name="get-section-level">
315 <xsl:with-param name="a_Node" select="parent::*"/>
316 </xsl:call-template>
317 </xsl:variable>
318 <xsl:value-of select="$tmp + 1"/>
319 </xsl:when>
320 <xsl:when test="self::preface"><xsl:text>0</xsl:text></xsl:when>
321 <xsl:when test="self::chapter"><xsl:text>0</xsl:text></xsl:when>
322 <xsl:when test="self::appendix"><xsl:text>0</xsl:text></xsl:when>
323 <xsl:when test="self::article"><xsl:text>0</xsl:text></xsl:when>
324 <xsl:otherwise>
325 <xsl:message terminate="yes">get-section-level was called on non-section element: <xsl:value-of select="."/> </xsl:message>
326 </xsl:otherwise>
327 </xsl:choose>
328 </xsl:for-each>
329 </xsl:template>
330
331 <!--
332 Inserts \hypertarget{@id} that can be referenced via the /A "nameddest=@id"
333 command line or #nameddest=@id URL parameter.
334
335 TODO: The placement of the target could be improved on. The raisebox
336 stuff is a crude hack to make it a little more acceptable. -->
337 <xsl:template name="title-wrapper">
338 <xsl:param name="texcmd" select="concat('\',name(..))"/>
339 <xsl:param name="refid" select="../@id"/>
340 <xsl:param name="role" select="../@role"/>
341
342 <xsl:call-template name="xsltprocNewlineOutputHack"/>
343 <xsl:if test="$texcmd='\chapter' and (name(../preceding-sibling::*[1])='preface' or name(../preceding-sibling::*[1])='bookinfo')">
344 <xsl:text>\mainmatter&#x0a;</xsl:text>
345 </xsl:if>
346 <xsl:choose>
347 <xsl:when test="$refid">
348 <xsl:text>&#x0a;</xsl:text>
349 <xsl:value-of select="$texcmd"/>
350 <xsl:if test="not(contains($texcmd, '*'))">
351 <xsl:text>[</xsl:text> <!-- for toc -->
352 <xsl:apply-templates />
353 <xsl:text>]</xsl:text>
354 </xsl:if>
355 <xsl:text>{</xsl:text> <!-- for doc -->
356 <xsl:text>\raisebox{\ht\strutbox}{\hypertarget{</xsl:text>
357 <xsl:value-of select="$refid"/>
358 <xsl:text>}{}}</xsl:text>
359 <xsl:apply-templates />
360 <xsl:text>}</xsl:text>
361 </xsl:when>
362 <xsl:otherwise>
363 <xsl:text>&#x0a;</xsl:text><xsl:value-of select="$texcmd"/><xsl:text>{</xsl:text>
364 <xsl:apply-templates />
365 <xsl:text>}</xsl:text>
366 </xsl:otherwise>
367 </xsl:choose>
368 </xsl:template>
369
370 <xsl:template match="title">
371 <xsl:variable name="refid" select="../@id" />
372 <xsl:choose>
373 <xsl:when test="name(..)='bookinfo'">
374 <xsl:text>\newcommand\docbooktitle{</xsl:text>
375 <xsl:apply-templates />
376 <xsl:text>}</xsl:text>
377 </xsl:when>
378 <xsl:when test="name(..)='chapter'">
379 <xsl:call-template name="title-wrapper"/>
380 </xsl:when>
381 <xsl:when test="name(..)='preface'">
382 <xsl:call-template name="title-wrapper">
383 <xsl:with-param name="texcmd">\chapter</xsl:with-param>
384 </xsl:call-template>
385 </xsl:when>
386 <xsl:when test="name(..)='sect1'">
387 <xsl:call-template name="title-wrapper">
388 <xsl:with-param name="texcmd">\section</xsl:with-param>
389 </xsl:call-template>
390 </xsl:when>
391 <xsl:when test="parent::sect2[@role='not-in-toc'] or parent::refsect1 or (parent::section and count(ancestor::section) = 2)">
392 <xsl:call-template name="title-wrapper">
393 <xsl:with-param name="texcmd">\subsection*</xsl:with-param>
394 </xsl:call-template>
395 </xsl:when>
396 <xsl:when test="name(..)='sect2'">
397 <xsl:call-template name="title-wrapper">
398 <xsl:with-param name="texcmd">\subsection</xsl:with-param>
399 </xsl:call-template>
400 </xsl:when>
401 <xsl:when test="parent::sect3[@role='not-in-toc'] or parent::refsect2 or (parent::section and count(ancestor::section) = 3)">
402 <xsl:call-template name="title-wrapper">
403 <xsl:with-param name="texcmd">\subsubsection*</xsl:with-param>
404 </xsl:call-template>
405 </xsl:when>
406 <xsl:when test="name(..)='sect3'">
407 <xsl:call-template name="title-wrapper">
408 <xsl:with-param name="texcmd">\subsubsection</xsl:with-param>
409 </xsl:call-template>
410 </xsl:when>
411 <xsl:when test="parent::sect4[@role='not-in-toc'] or parent::refsect3 or (parent::section and count(ancestor::section) = 4)">
412 <xsl:call-template name="title-wrapper">
413 <xsl:with-param name="texcmd">\paragraph*</xsl:with-param>
414 </xsl:call-template>
415 </xsl:when>
416 <xsl:when test="name(..)='sect4'">
417 <xsl:call-template name="title-wrapper">
418 <xsl:with-param name="texcmd">\paragraph</xsl:with-param>
419 </xsl:call-template>
420 </xsl:when>
421 <xsl:when test="parent::sect5[@role='not-in-toc'] or parent::refsect4 or (parent::section and count(ancestor::section) = 5)">
422 <xsl:call-template name="title-wrapper">
423 <xsl:with-param name="texcmd">\subparagraph*</xsl:with-param>
424 </xsl:call-template>
425 </xsl:when>
426 <xsl:when test="name(..)='sect5'">
427 <xsl:call-template name="title-wrapper">
428 <xsl:with-param name="texcmd">\subparagraph</xsl:with-param>
429 </xsl:call-template>
430 </xsl:when>
431 <xsl:when test="name(..)='appendix'">
432 <xsl:call-template name="title-wrapper">
433 <xsl:with-param name="texcmd">\chapter</xsl:with-param>
434 </xsl:call-template>
435 </xsl:when>
436 <xsl:when test="name(..)='glossdiv'">
437 <xsl:call-template name="title-wrapper">
438 <xsl:with-param name="texcmd">\section*</xsl:with-param>
439 </xsl:call-template>
440 </xsl:when>
441
442 <xsl:when test="parent::simplesect">
443 <xsl:if test="../@role">
444 <xsl:message terminate="yes">Role not allowed with simplesect: <xsl:value-of select="../@role"/></xsl:message>
445 </xsl:if>
446 <xsl:variable name="level">
447 <xsl:call-template name="get-section-level">
448 <xsl:with-param name="a_Node" select=".."/>
449 </xsl:call-template>
450 </xsl:variable>
451 <xsl:choose>
452 <xsl:when test="$level = 1">
453 <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\section*</xsl:with-param></xsl:call-template>
454 </xsl:when>
455 <xsl:when test="$level = 2">
456 <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\subsection*</xsl:with-param></xsl:call-template>
457 </xsl:when>
458 <xsl:when test="$level = 3">
459 <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\subsubsection*</xsl:with-param></xsl:call-template>
460 </xsl:when>
461 <xsl:when test="$level = 4">
462 <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\paragraph*</xsl:with-param></xsl:call-template>
463 </xsl:when>
464 <xsl:when test="$level = 5">
465 <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\subparagraph*</xsl:with-param></xsl:call-template>
466 </xsl:when>
467 <xsl:otherwise>
468 <xsl:message terminate="yes">Unsupported simplesect/title depth: <xsl:value-of select="$level"/></xsl:message>
469 </xsl:otherwise>
470 </xsl:choose>
471 </xsl:when>
472
473 </xsl:choose>
474 <xsl:if test="$refid">
475 <xsl:value-of select="concat('&#x0a;\label{', $refid, '}')" />
476 </xsl:if>
477 <xsl:text>&#x0a;</xsl:text>
478 </xsl:template>
479
480 <xsl:template match="edition">
481 <xsl:choose>
482 <xsl:when test="name(..)='bookinfo'">
483 <xsl:text>\newcommand\docbooktitleedition{</xsl:text>
484 <xsl:apply-templates />
485 <xsl:text>}&#x0a;</xsl:text>
486 </xsl:when>
487 </xsl:choose>
488 </xsl:template>
489
490 <xsl:template match="corpauthor">
491 <xsl:choose>
492 <xsl:when test="name(..)='bookinfo'">
493 <xsl:text>\newcommand\docbookcorpauthor{</xsl:text>
494 <xsl:apply-templates />
495 <xsl:text>}&#x0a;</xsl:text>
496 </xsl:when>
497 </xsl:choose>
498 </xsl:template>
499
500 <xsl:template match="address">
501 <xsl:choose>
502 <xsl:when test="name(..)='bookinfo'">
503 <xsl:text>\newcommand\docbookbookinfoaddress{</xsl:text>
504 <xsl:apply-templates />
505 <xsl:text>}&#x0a;</xsl:text>
506 </xsl:when>
507 </xsl:choose>
508 </xsl:template>
509
510 <xsl:template match="year">
511 <xsl:choose>
512 <xsl:when test="name(..)='copyright'">
513 <xsl:text>\newcommand\docbookbookinfocopyrightyear{</xsl:text>
514 <xsl:apply-templates />
515 <xsl:text>}&#x0a;</xsl:text>
516 </xsl:when>
517 </xsl:choose>
518 </xsl:template>
519
520 <xsl:template match="holder">
521 <xsl:choose>
522 <xsl:when test="name(..)='copyright'">
523 <xsl:text>\newcommand\docbookbookinfocopyrightholder{</xsl:text>
524 <xsl:apply-templates />
525 <xsl:text>}&#x0a;</xsl:text>
526 </xsl:when>
527 </xsl:choose>
528 </xsl:template>
529
530 <xsl:template match="firstname">
531 <xsl:choose>
532 <xsl:when test="name(..)='othercredit'">
533 <xsl:text>\newcommand\docbookbookinfoothercreditfirstname{</xsl:text>
534 <xsl:apply-templates />
535 <xsl:text>}&#x0a;</xsl:text>
536 </xsl:when>
537 </xsl:choose>
538 </xsl:template>
539
540 <xsl:template match="surname">
541 <xsl:choose>
542 <xsl:when test="name(..)='othercredit'">
543 <xsl:text>\newcommand\docbookbookinfoothercreditsurname{</xsl:text>
544 <xsl:apply-templates />
545 <xsl:text>}&#x0a;</xsl:text>
546 </xsl:when>
547 </xsl:choose>
548 </xsl:template>
549
550 <xsl:template match="contrib">
551 <xsl:choose>
552 <xsl:when test="name(..)='othercredit'">
553 <xsl:text>\newcommand\docbookbookinfoothercreditcontrib{</xsl:text>
554 <xsl:apply-templates />
555 <xsl:text>}&#x0a;</xsl:text>
556 </xsl:when>
557 </xsl:choose>
558 </xsl:template>
559
560 <xsl:template match="glossary">
561 <xsl:text>&#x0a;&#x0a;\backmatter&#x0a;\chapter{Glossary}&#x0a;</xsl:text>
562 <xsl:apply-templates />
563 </xsl:template>
564
565 <xsl:template match="para">
566 <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or name(..)='entry' or (name(../..)='varlistentry' and position()=1))">
567 <xsl:text>&#x0a;&#x0a;</xsl:text>
568 </xsl:if>
569 <xsl:apply-templates />
570 </xsl:template>
571
572 <xsl:template match="note">
573 <xsl:value-of select="concat('&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;\begin{center}\fbox{\begin{minipage}[c]{0.9\textwidth}\color{colNote}\textbf{', $g_nlsNote, ':} ')" />
574 <xsl:apply-templates />
575 <xsl:text>\end{minipage}}\end{center}&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;</xsl:text>
576 </xsl:template>
577
578 <xsl:template match="warning">
579 <xsl:value-of select="concat('&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;\begin{center}\fbox{\begin{minipage}[c]{0.9\textwidth}\color{colWarning}\textbf{', $g_nlsWarning, ':} ')" />
580 <xsl:apply-templates />
581 <xsl:text>\end{minipage}}\end{center}&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;</xsl:text>
582 </xsl:template>
583
584 <xsl:template match="screen">
585 <xsl:text>&#x0a;&#x0a;{\footnotesize\begin{alltt}&#x0a;</xsl:text>
586 <xsl:apply-templates />
587 <xsl:text>&#x0a;\end{alltt}}&#x0a;</xsl:text>
588 </xsl:template>
589
590 <xsl:template match="programlisting">
591 <xsl:text>&#x0a;&#x0a;{\small\begin{alltt}&#x0a;</xsl:text>
592 <xsl:apply-templates />
593 <xsl:text>&#x0a;\end{alltt}}&#x0a;</xsl:text>
594 </xsl:template>
595
596 <xsl:template match="footnote">
597 <xsl:text>\footnote{</xsl:text>
598 <xsl:apply-templates />
599 <xsl:text>}</xsl:text>
600 </xsl:template>
601
602 <xsl:template match="tgroup">
603 <xsl:choose>
604 <xsl:when test="@style='verywide'">
605 <xsl:text>&#x0a;&#x0a;{\small\begin{center}&#x0a;\begin{tabulary}{1.1\textwidth}[]</xsl:text>
606 </xsl:when>
607 <xsl:otherwise>
608 <xsl:text>&#x0a;&#x0a;{\small\begin{center}&#x0a;\begin{tabulary}{.9\textwidth}[]</xsl:text>
609 </xsl:otherwise>
610 </xsl:choose>
611 <xsl:text>{</xsl:text>
612 <xsl:choose>
613 <xsl:when test="@cols='1'">
614 <xsl:text>|L|</xsl:text>
615 </xsl:when>
616 <xsl:when test="@cols='2'">
617 <xsl:text>|L|L|</xsl:text>
618 </xsl:when>
619 <xsl:when test="@cols='3'">
620 <xsl:text>|L|L|L|</xsl:text>
621 </xsl:when>
622 <xsl:when test="@cols='4'">
623 <xsl:text>|L|L|L|L|</xsl:text>
624 </xsl:when>
625 <xsl:when test="@cols='5'">
626 <xsl:text>|L|L|L|L|L|</xsl:text>
627 </xsl:when>
628 <xsl:when test="@cols='6'">
629 <xsl:text>|L|L|L|L|L|L|</xsl:text>
630 </xsl:when>
631 <xsl:otherwise>
632 <xsl:message terminate="yes">Unsupported number of columns (<xsl:value-of select="@cols"/>), fix document or converter</xsl:message>
633 </xsl:otherwise>
634 </xsl:choose>
635 <xsl:text>}&#x0a;\hline&#x0a;</xsl:text>
636 <xsl:apply-templates />
637 <xsl:text>&#x0a;\end{tabulary}&#x0a;\end{center}}&#x0a;</xsl:text>
638 </xsl:template>
639
640 <xsl:template match="row">
641 <xsl:apply-templates />
642 <xsl:text>&#x0a;\\ \hline&#x0a;</xsl:text>
643 </xsl:template>
644
645 <xsl:template match="entry">
646 <xsl:if test="not(position()=1)">
647 <xsl:text> &amp; </xsl:text>
648 </xsl:if>
649 <xsl:apply-templates />
650 </xsl:template>
651
652 <xsl:template match="itemizedlist">
653 <xsl:call-template name="xsltprocNewlineOutputHack"/>
654 <xsl:text>&#x0a;\begin{itemize}&#x0a;</xsl:text>
655 <xsl:if test="@spacing = 'compact'">
656 <xsl:text> \setlength{\parskip}{0pt}&#x0a;</xsl:text>
657 <xsl:text> \setlength{\itemsep}{0pt}&#x0a;</xsl:text>
658 <xsl:text> \setlength{\topsep}{0pt}&#x0a;</xsl:text>
659 <xsl:text> \setlength{\parsep}{0pt}&#x0a;</xsl:text>
660 <xsl:text> \setlength{\partopsep}{0pt}&#x0a;</xsl:text>
661 </xsl:if>
662 <xsl:apply-templates />
663 <xsl:text>&#x0a;\end{itemize}&#x0a;</xsl:text>
664 </xsl:template>
665
666 <xsl:template match="orderedlist">
667 <xsl:call-template name="xsltprocNewlineOutputHack"/>
668 <xsl:text>&#x0a;\begin{enumerate}&#x0a;</xsl:text>
669 <xsl:if test="@spacing = 'compact'">
670 <xsl:text> \setlength{\parskip}{0pt}&#x0a;</xsl:text>
671 <xsl:text> \setlength{\itemsep}{0pt}&#x0a;</xsl:text>
672 <xsl:text> \setlength{\topsep}{0pt}&#x0a;</xsl:text>
673 <xsl:text> \setlength{\parsep}{0pt}&#x0a;</xsl:text>
674 <xsl:text> \setlength{\partopsep}{0pt}&#x0a;</xsl:text>
675 </xsl:if>
676 <xsl:apply-templates />
677 <xsl:text>&#x0a;\end{enumerate}&#x0a;</xsl:text>
678 </xsl:template>
679
680 <xsl:template match="variablelist">
681 <xsl:call-template name="xsltprocNewlineOutputHack"/>
682 <xsl:text>&#x0a;\begin{description}&#x0a;</xsl:text>
683 <xsl:if test="@spacing = 'compact'">
684 <xsl:text> \setlength{\parskip}{0pt}&#x0a;</xsl:text>
685 <xsl:text> \setlength{\itemsep}{0pt}&#x0a;</xsl:text>
686 <xsl:text> \setlength{\topsep}{0pt}&#x0a;</xsl:text>
687 <xsl:text> \setlength{\parsep}{0pt}&#x0a;</xsl:text>
688 <xsl:text> \setlength{\partopsep}{0pt}&#x0a;</xsl:text>
689 </xsl:if>
690 <xsl:apply-templates />
691 <xsl:text>&#x0a;\end{description}&#x0a;</xsl:text>
692 </xsl:template>
693
694 <xsl:template match="varlistentry">
695 <xsl:if test="not(./term) or not(./listitem) or count(./listitem) != 1">
696 <xsl:message terminate="yes">Expected at least one term and one listitem element in the varlistentry.</xsl:message>
697 </xsl:if>
698 <xsl:text>&#x0a;&#x0a;\item[{\parbox[t]{\linewidth}{\raggedright </xsl:text>
699 <xsl:apply-templates select="./term[1]"/>
700 <xsl:for-each select="./term[position() > 1]">
701 <xsl:text>\\&#x0a; </xsl:text>
702 <xsl:apply-templates select="."/>
703 </xsl:for-each>
704 <xsl:text>}}]\hfill\\</xsl:text>
705 <xsl:apply-templates select="listitem/*"/>
706 </xsl:template>
707
708 <xsl:template match="listitem">
709 <xsl:text>&#x0a;&#x0a;\item </xsl:text>
710 <xsl:apply-templates />
711 <xsl:text>&#x0a;</xsl:text>
712 </xsl:template>
713
714 <xsl:template match="glossterm">
715 <xsl:variable name="refid" select="(@id)" />
716 <xsl:if test="$refid">
717 <xsl:value-of select="concat('&#x0a;\label{', $refid, '}')" />
718 </xsl:if>
719 <xsl:text>&#x0a;&#x0a;\item[</xsl:text>
720 <xsl:apply-templates />
721 <xsl:text>]</xsl:text>
722 </xsl:template>
723
724 <xsl:template match="glosslist | glossdiv">
725 <xsl:text>&#x0a;&#x0a;\begin{description}&#x0a;</xsl:text>
726 <xsl:apply-templates />
727 <xsl:text>&#x0a;\end{description}&#x0a;</xsl:text>
728 </xsl:template>
729
730 <xsl:template match="superscript">
731 <xsl:variable name="contents">
732 <xsl:apply-templates />
733 </xsl:variable>
734 <xsl:value-of select="concat('\texorpdfstring{\textsuperscript{', $contents, '}}{', $contents, '}')" />
735 </xsl:template>
736
737 <xsl:template match="emphasis">
738 <xsl:choose>
739 <xsl:when test="@role='bold'">
740 <xsl:text>\textbf{</xsl:text>
741 </xsl:when>
742 <xsl:otherwise>
743 <xsl:text>\textit{</xsl:text>
744 </xsl:otherwise>
745 </xsl:choose>
746 <xsl:apply-templates />
747 <xsl:text>}</xsl:text>
748 </xsl:template>
749
750 <xsl:template match="computeroutput | code">
751 <xsl:text>\texttt{</xsl:text>
752 <xsl:apply-templates />
753 <xsl:text>}</xsl:text>
754 </xsl:template>
755
756 <xsl:template match="literal | filename">
757 <xsl:text>\texttt{</xsl:text>
758 <xsl:apply-templates />
759 <xsl:text>}</xsl:text>
760 </xsl:template>
761
762 <xsl:template match="citetitle">
763 <xsl:text>\textit{</xsl:text>
764 <xsl:apply-templates />
765 <xsl:text>}</xsl:text>
766 </xsl:template>
767
768 <xsl:template match="lineannotation">
769 <xsl:text>\textit{</xsl:text>
770 <xsl:apply-templates />
771 <xsl:text>}</xsl:text>
772 </xsl:template>
773
774 <xsl:template match="ulink[@url!='' and not(text())]">
775 <xsl:text>\url{</xsl:text>
776 <xsl:value-of select="@url"/>
777 <xsl:text>}</xsl:text>
778 </xsl:template>
779
780 <xsl:template match="ulink[@url!='' and text()]">
781 <xsl:text>\href{</xsl:text>
782 <xsl:value-of select="@url"/>
783 <xsl:text>}{</xsl:text>
784 <xsl:apply-templates />
785 <xsl:text>}</xsl:text>
786 </xsl:template>
787
788 <xsl:template match="ulink[(@url='' or not(@url)) and text()]">
789 <xsl:text>\url{</xsl:text>
790 <xsl:apply-templates />
791 <xsl:text>}</xsl:text>
792 </xsl:template>
793
794 <xsl:template match="xref">
795 <xsl:choose>
796 <xsl:when test="@endterm">
797 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
798 </xsl:when>
799 <xsl:otherwise>
800 <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
801 </xsl:otherwise>
802 </xsl:choose>
803 </xsl:template>
804
805 <xsl:template match="link">
806 <xsl:choose>
807 <xsl:when test="@endterm">
808 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
809 </xsl:when>
810 <xsl:when test="./text()">
811 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{')" />
812 <xsl:apply-templates select="./text()"/>
813 <xsl:value-of select="'}}'" />
814 </xsl:when>
815 <xsl:otherwise>
816 <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
817 </xsl:otherwise>
818 </xsl:choose>
819 </xsl:template>
820
821 <xsl:template match="trademark">
822 <xsl:apply-templates />
823 <xsl:text>\textsuperscript{\textregistered}</xsl:text>
824 </xsl:template>
825
826 <!-- for some reason, DocBook insists of having image data nested this way always:
827 mediaobject -> imageobject -> imagedata
828 but only imagedata is interesting -->
829 <xsl:template match="imagedata">
830 <xsl:if test="@align='center'">
831 <xsl:text>\begin{center}</xsl:text>
832 </xsl:if>
833 <xsl:value-of select="concat('&#x0a;\includegraphics[width=', @width, ']{', @fileref, '}&#x0a;')" />
834 <xsl:apply-templates />
835 <xsl:if test="@align='center'">
836 <xsl:text>\end{center}</xsl:text>
837 </xsl:if>
838 </xsl:template>
839
840 <!--
841 Turn the refsynopsisdiv part of a manpage into a named & indented paragraph.
842 -->
843 <xsl:template match="refsynopsisdiv">
844 <xsl:if test="name(*[1]) != 'cmdsynopsis'"><xsl:message terminate="yes">Expected refsynopsisdiv to start with cmdsynopsis</xsl:message></xsl:if>
845 <xsl:if test="title"><xsl:message terminate="yes">No title element supported in refsynopsisdiv</xsl:message></xsl:if>
846 <xsl:call-template name="xsltprocNewlineOutputHack"/>
847 <xsl:text>&#x0a;\subsection*{Synopsis}&#x0a;</xsl:text>
848 <xsl:apply-templates />
849 </xsl:template>
850
851 <!--
852 The refsect1 is used for 'Description' and such. Do same as with refsynopsisdiv
853 and turn it into a named & indented paragraph.
854 -->
855 <xsl:template match="refsect1">
856 <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
857 <xsl:message terminate="yes">Expected exactly one title as the first refsect1 element (remarks goes after title!).</xsl:message>
858 </xsl:if>
859 <xsl:apply-templates/>
860 </xsl:template>
861
862 <!--
863 The refsect2 element will be turned into a subparagraph if it has a title,
864 however, that didn't work out when it didn't have a title and started with
865 a cmdsynopsis instead (subcommand docs). So, we're doing some trickery
866 here (HACK ALERT) for the non-title case to feign a paragraph.
867 -->
868 <xsl:template match="refsect2">
869 <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
870 <xsl:message terminate="yes">Expected exactly one title as the first refsect2 element (remarks goes after title!).</xsl:message>
871 </xsl:if>
872 <xsl:apply-templates/>
873 <xsl:text>&#x0a;</xsl:text>
874 </xsl:template>
875
876
877 <!--
878 Command Synopsis elements.
879
880 We treat each command element inside a cmdsynopsis as the start of
881 a new paragraph. The DocBook HTML converter does so too, but the
882 manpage one doesn't.
883
884 sbr and linebreaks made by latex should be indented from the base
885 command level. This is done by the \hangindent3em\hangafter1 bits.
886
887 We exploit the default paragraph indentation to get each command
888 indented from the left margin. This, unfortunately, doesn't work
889 if we're the first paragraph in a (sub*)section. \noindent cannot
890 counter this due to when latex enforces first paragraph stuff. Since
891 it's tedious to figure out when we're in the first paragraph and when
892 not, we just do \noindent\hspace{1em} everywhere.
893 -->
894 <xsl:template match="sbr">
895 <xsl:if test="not(ancestor::cmdsynopsis)">
896 <xsl:message terminate="yes">sbr only supported inside cmdsynopsis (because of hangindent)</xsl:message>
897 </xsl:if>
898 <xsl:text>\newline</xsl:text>
899 </xsl:template>
900
901 <xsl:template match="refentry|refnamediv|refentryinfo|refmeta|refsect3|refsect4|refsect5|synopfragment|synopfragmentref|cmdsynopsis/info">
902 <xsl:message terminate="yes"><xsl:value-of select="name()"/> is not supported</xsl:message>
903 </xsl:template>
904
905 <xsl:template match="cmdsynopsis">
906 <xsl:if test="preceding-sibling::cmdsynopsis">
907 <xsl:text>%cmdsynopsis</xsl:text>
908 </xsl:if>
909 <xsl:text>&#x0a;</xsl:text>
910 <xsl:text>\begin{flushleft}</xsl:text>
911 <xsl:if test="parent::remark[@role='VBoxManage-overview']">
912 <!-- Overview fontsize trick -->
913 <xsl:text>{\footnotesize</xsl:text>
914 </xsl:if>
915 <xsl:text>\noindent\hspace{1em}</xsl:text>
916 <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
917 <xsl:apply-templates />
918 <xsl:text>}</xsl:text>
919 <xsl:if test="following-sibling::*">
920 </xsl:if>
921
922 <!-- For refsect2 subcommand descriptions. -->
923 <xsl:if test="not(following-sibling::cmdsynopsis) and position() != last()">
924 <xsl:text>\linebreak</xsl:text>
925 </xsl:if>
926 <!-- Special overview trick for the current VBoxManage command overview. -->
927 <xsl:if test="parent::remark[@role='VBoxManage-overview']">
928 <xsl:text>\par}</xsl:text>
929 </xsl:if>
930 <xsl:text>\end{flushleft}</xsl:text>
931 </xsl:template>
932
933 <xsl:template match="command">
934 <xsl:choose>
935 <xsl:when test="ancestor::cmdsynopsis">
936 <!-- Trigger a line break if this isn't the first command in a synopsis -->
937 <xsl:if test="preceding-sibling::command">
938 <xsl:text>}\par%command&#x0a;</xsl:text>
939 <xsl:text>\noindent\hspace{1em}</xsl:text>
940 <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
941 </xsl:if>
942 <xsl:apply-templates />
943 </xsl:when>
944 <xsl:otherwise>
945 <xsl:text>\texttt{</xsl:text>
946 <xsl:apply-templates />
947 <xsl:text>}</xsl:text>
948 </xsl:otherwise>
949 </xsl:choose>
950 </xsl:template>
951
952 <xsl:template match="option">
953 <xsl:choose>
954 <xsl:when test="ancestor::cmdsynopsis">
955 <xsl:apply-templates />
956 </xsl:when>
957 <xsl:otherwise>
958 <xsl:text>\texttt{</xsl:text>
959 <xsl:apply-templates />
960 <xsl:text>}</xsl:text>
961 </xsl:otherwise>
962 </xsl:choose>
963 </xsl:template>
964
965 <!-- duplicated in docbook-refentry-to-C-help.xsl -->
966 <xsl:template match="arg|group">
967 <!-- separator char if we're not the first child -->
968 <xsl:if test="position() > 1">
969 <xsl:choose>
970 <xsl:when test="parent::group"><xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.or.sep.tex"/><xsl:text>}</xsl:text></xsl:when>
971 <xsl:when test="ancestor-or-self::*/@sepchar"><xsl:value-of select="ancestor-or-self::*/@sepchar"/></xsl:when>
972 <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
973 </xsl:choose>
974 </xsl:if>
975
976 <!-- open wrapping -->
977 <xsl:choose>
978 <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>
979 <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>
980 <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>
981 <xsl:when test="@choice = 'plain'"/>
982 <xsl:otherwise><xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Invalid arg choice: "<xsl:value-of select="@choice"/>"</xsl:message></xsl:otherwise>
983 </xsl:choose>
984
985 <xsl:apply-templates />
986
987 <!-- repeat indication -->
988 <xsl:choose>
989 <xsl:when test="@rep = 'norepeat' or not(@rep) or @rep = ''"/>
990 <xsl:when test="@rep = 'repeat'">
991 <!-- add space padding if we're in a repeating group -->
992 <xsl:if test="self::group">
993 <xsl:text> </xsl:text>
994 </xsl:if>
995 <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.rep.repeat.str.tex"/><xsl:text>}</xsl:text>
996 </xsl:when>
997 <xsl:otherwise><xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Invalid rep choice: "<xsl:value-of select="@rep"/>"</xsl:message></xsl:otherwise>
998 </xsl:choose>
999
1000 <!-- close wrapping -->
1001 <xsl:choose>
1002 <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>
1003 <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>
1004 <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>
1005 </xsl:choose>
1006
1007 <!-- add space padding if we're the last element in a nested arg -->
1008 <xsl:if test="parent::arg and not(following-sibling)">
1009 <xsl:text> </xsl:text>
1010 </xsl:if>
1011 </xsl:template>
1012
1013 <xsl:template match="replaceable">
1014 <xsl:choose>
1015 <xsl:when test="(not(ancestor::cmdsynopsis) and not(ancestor::option) and not(ancestor::screen)) or ancestor::arg">
1016 <xsl:text>\texttt{\textit{</xsl:text>
1017 <xsl:apply-templates />
1018 <xsl:text>}}</xsl:text>
1019 </xsl:when>
1020 <xsl:otherwise>
1021 <xsl:text>\textit{&lt;</xsl:text>
1022 <xsl:apply-templates />
1023 <xsl:text>&gt;}</xsl:text>
1024 </xsl:otherwise>
1025 </xsl:choose>
1026 </xsl:template>
1027
1028
1029 <!--
1030 Generic element text magic.
1031 -->
1032 <xsl:template match="//text()">
1033
1034 <!-- Do the translation of \ into \textbackslash{} in two steps, to avoid
1035 running into replacing {} as well which would be very wrong. -->
1036 <xsl:variable name="subst1">
1037 <xsl:call-template name="str:subst">
1038 <xsl:with-param name="text" select="." />
1039 <xsl:with-param name="replace" select="'\'" />
1040 <xsl:with-param name="with" select="'\textbackslash'" />
1041 <xsl:with-param name="disable-output-escaping" select="no" />
1042 </xsl:call-template>
1043 </xsl:variable>
1044 <xsl:variable name="subst2">
1045 <xsl:call-template name="str:subst">
1046 <xsl:with-param name="text" select="$subst1" />
1047 <xsl:with-param name="replace" select="'{'" />
1048 <xsl:with-param name="with" select="'\{'" />
1049 <xsl:with-param name="disable-output-escaping" select="no" />
1050 </xsl:call-template>
1051 </xsl:variable>
1052 <xsl:variable name="subst3">
1053 <xsl:call-template name="str:subst">
1054 <xsl:with-param name="text" select="$subst2" />
1055 <xsl:with-param name="replace" select="'}'" />
1056 <xsl:with-param name="with" select="'\}'" />
1057 <xsl:with-param name="disable-output-escaping" select="no" />
1058 </xsl:call-template>
1059 </xsl:variable>
1060 <xsl:variable name="subst4">
1061 <xsl:call-template name="str:subst">
1062 <xsl:with-param name="text" select="$subst3" />
1063 <xsl:with-param name="replace" select="'\textbackslash'" />
1064 <xsl:with-param name="with" select="'\textbackslash{}'" />
1065 <xsl:with-param name="disable-output-escaping" select="no" />
1066 </xsl:call-template>
1067 </xsl:variable>
1068
1069 <xsl:choose>
1070 <xsl:when test="(name(..) = 'computeroutput') or (name(../..) = 'computeroutput')
1071 or (name(..) = 'code') or (name(../..) = 'code')
1072 or (name(..) = 'arg') or (name(../..) = 'arg')
1073 or (name(..) = 'option') or (name(../..) = 'option')
1074 or (name(..) = 'command') or (name(../..) = 'command')
1075 or (name(..) = 'cmdsynopsis') or (name(../..) = 'cmdsynopsis')
1076 or (name(..) = 'replaceable') or (name(../..) = 'replaceable')
1077 or (name(..) = 'entry') or (name(../..) = 'entry')
1078 ">
1079 <xsl:variable name="subst5">
1080 <xsl:call-template name="str:subst">
1081 <xsl:with-param name="text" select="translate(normalize-space(concat('&#x7f;',$subst4,'&#x7f;')),'&#x7f;','')" />
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="subst6">
1088 <xsl:call-template name="str:subst">
1089 <xsl:with-param name="text" select="$subst5" />
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="subst7">
1096 <xsl:call-template name="str:subst">
1097 <xsl:with-param name="text" select="$subst6" />
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="subst8">
1104 <xsl:call-template name="str:subst">
1105 <xsl:with-param name="text" select="$subst7" />
1106 <xsl:with-param name="replace" select="'%'" />
1107 <xsl:with-param name="with" select="'\%'" />
1108 <xsl:with-param name="disable-output-escaping" select="no" />
1109 </xsl:call-template>
1110 </xsl:variable>
1111 <xsl:variable name="subst9">
1112 <xsl:call-template name="str:subst">
1113 <xsl:with-param name="text" select="$subst8" />
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:variable name="subst10">
1120 <xsl:call-template name="str:subst">
1121 <xsl:with-param name="text" select="$subst9" />
1122 <xsl:with-param name="replace" select="'~'" />
1123 <xsl:with-param name="with" select="'\textasciitilde{}'" />
1124 <xsl:with-param name="disable-output-escaping" select="no" />
1125 </xsl:call-template>
1126 </xsl:variable>
1127 <xsl:variable name="subst11">
1128 <xsl:call-template name="str:subst">
1129 <xsl:with-param name="text" select="$subst10" />
1130 <xsl:with-param name="replace" select="'&amp;'" />
1131 <xsl:with-param name="with" select="'\&amp;'" />
1132 <xsl:with-param name="disable-output-escaping" select="no" />
1133 </xsl:call-template>
1134 </xsl:variable>
1135 <xsl:choose>
1136 <xsl:when test="parent::arg or parent::command">
1137 <xsl:variable name="subst12">
1138 <xsl:call-template name="str:subst">
1139 <xsl:with-param name="text" select="$subst10" />
1140 <xsl:with-param name="replace" select="' '" />
1141 <xsl:with-param name="with" select="'~'" />
1142 <xsl:with-param name="disable-output-escaping" select="no" />
1143 </xsl:call-template>
1144 </xsl:variable>
1145 <xsl:value-of select="$subst12" />
1146 </xsl:when>
1147 <xsl:otherwise>
1148 <xsl:value-of select="$subst11" />
1149 </xsl:otherwise>
1150 </xsl:choose>
1151 </xsl:when>
1152
1153 <xsl:when test="(name(..)='address') or (name(../..)='address')">
1154 <xsl:variable name="subst5">
1155 <xsl:call-template name="str:subst">
1156 <xsl:with-param name="text" select="$subst4" />
1157 <xsl:with-param name="replace" select="'&#x0a;'" />
1158 <xsl:with-param name="with" select="' \\'" />
1159 <xsl:with-param name="disable-output-escaping" select="no" />
1160 </xsl:call-template>
1161 </xsl:variable>
1162 <xsl:value-of select="$subst5" />
1163 </xsl:when>
1164
1165 <!-- <screen> and <programlisting>, which work with alltt environment. -->
1166 <xsl:otherwise>
1167 <xsl:variable name="subst5">
1168 <xsl:call-template name="str:subst">
1169 <xsl:with-param name="text" select="$subst4" />
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="subst6">
1176 <xsl:call-template name="str:subst">
1177 <xsl:with-param name="text" select="$subst5" />
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="subst7">
1184 <xsl:call-template name="str:subst">
1185 <xsl:with-param name="text" select="$subst6" />
1186 <xsl:with-param name="replace" select="'%'" />
1187 <xsl:with-param name="with" select="'\%'" />
1188 <xsl:with-param name="disable-output-escaping" select="no" />
1189 </xsl:call-template>
1190 </xsl:variable>
1191 <xsl:variable name="subst8">
1192 <xsl:call-template name="str:subst">
1193 <xsl:with-param name="text" select="$subst7" />
1194 <xsl:with-param name="replace" select="'#'" />
1195 <xsl:with-param name="with" select="'\#'" />
1196 <xsl:with-param name="disable-output-escaping" select="no" />
1197 </xsl:call-template>
1198 </xsl:variable>
1199 <xsl:variable name="subst9">
1200 <xsl:call-template name="str:subst">
1201 <xsl:with-param name="text" select="$subst8" />
1202 <xsl:with-param name="replace" select="'µ'" />
1203 <xsl:with-param name="with" select="'$\mu$'" />
1204 <xsl:with-param name="disable-output-escaping" select="no" />
1205 </xsl:call-template>
1206 </xsl:variable>
1207 <xsl:variable name="subst10">
1208 <xsl:call-template name="str:subst">
1209 <xsl:with-param name="text" select="$subst9" />
1210 <xsl:with-param name="replace" select="'®'" />
1211 <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
1212 <xsl:with-param name="disable-output-escaping" select="no" />
1213 </xsl:call-template>
1214 </xsl:variable>
1215 <xsl:variable name="quote">"</xsl:variable>
1216 <!-- preparation for pretty quotes: replace all double quotes _outside_ screen
1217 sections with "\QUOTE{}" strings, which the makefile will then replace
1218 with pretty quotes by invoking sed a few times. Unfortunately there are
1219 no regular expressions in XSLT so there's no other way. -->
1220 <xsl:variable name="subst11">
1221 <xsl:choose>
1222 <xsl:when test="(name(..)='screen') or (name(../..)='screen')
1223 or (name(..)='programlisting') or (name(../..)='programlisting')
1224 or (name(..)='literal') or (name(../..)='literal')
1225 ">
1226 <xsl:value-of select="$subst10" />
1227 </xsl:when>
1228 <xsl:otherwise>
1229 <xsl:call-template name="str:subst">
1230 <xsl:with-param name="text" select="$subst10" />
1231 <xsl:with-param name="replace" select="$quote" />
1232 <xsl:with-param name="with" select="'\QUOTE{}'" />
1233 <xsl:with-param name="disable-output-escaping" select="no" />
1234 </xsl:call-template>
1235 </xsl:otherwise>
1236 </xsl:choose>
1237 </xsl:variable>
1238 <xsl:variable name="subst12">
1239 <xsl:call-template name="str:subst">
1240 <xsl:with-param name="text" select="$subst11" />
1241 <xsl:with-param name="replace" select="'~'" />
1242 <xsl:with-param name="with" select="'\textasciitilde{}'" />
1243 <xsl:with-param name="disable-output-escaping" select="no" />
1244 </xsl:call-template>
1245 </xsl:variable>
1246 <xsl:variable name="subst13">
1247 <xsl:call-template name="str:subst">
1248 <xsl:with-param name="text" select="$subst12" />
1249 <xsl:with-param name="replace" select="'&amp;'" />
1250 <xsl:with-param name="with" select="'\&amp;'" />
1251 <xsl:with-param name="disable-output-escaping" select="no" />
1252 </xsl:call-template>
1253 </xsl:variable>
1254 <xsl:variable name="subst14">
1255 <xsl:call-template name="str:subst">
1256 <xsl:with-param name="text" select="$subst13" />
1257 <xsl:with-param name="replace" select="'→'" />
1258 <xsl:with-param name="with" select="'\ensuremath{\rightarrow}'" />
1259 <xsl:with-param name="disable-output-escaping" select="no" />
1260 </xsl:call-template>
1261 </xsl:variable>
1262 <xsl:variable name="subst15">
1263 <xsl:call-template name="str:subst">
1264 <xsl:with-param name="text" select="$subst14" />
1265 <xsl:with-param name="replace" select="'←'" />
1266 <xsl:with-param name="with" select="'\ensuremath{\leftarrow}'" />
1267 <xsl:with-param name="disable-output-escaping" select="no" />
1268 </xsl:call-template>
1269 </xsl:variable>
1270 <xsl:variable name="subst16">
1271 <xsl:call-template name="str:subst">
1272 <xsl:with-param name="text" select="$subst15" />
1273 <xsl:with-param name="replace" select="'↔'" />
1274 <xsl:with-param name="with" select="'\ensuremath{\leftrightarrow}'" />
1275 <xsl:with-param name="disable-output-escaping" select="no" />
1276 </xsl:call-template>
1277 </xsl:variable>
1278 <xsl:value-of select="$subst16" />
1279 </xsl:otherwise>
1280 </xsl:choose>
1281 </xsl:template>
1282
1283 <!--
1284 xsltprocNewlineOutputHack - emits a single new line.
1285
1286 Hack Alert! This template helps xsltproc split up the output text elements
1287 and avoid reallocating them into the MB range. Calls to this
1288 template is made occationally while generating larger output
1289 file. It's not necessary for small stuff like header.
1290
1291 The trick we're playing on xsltproc has to do with CDATA
1292 and/or the escape setting of the xsl:text element. It forces
1293 xsltproc to allocate a new output element, thus preventing
1294 things from growing out of proportions and slowing us down.
1295
1296 This was successfully employed to reduce a 18+ seconds run to
1297 around one second (possibly less due to kmk overhead).
1298 -->
1299 <xsl:template name="xsltprocNewlineOutputHack">
1300 <xsl:text disable-output-escaping="yes"><![CDATA[
1301]]></xsl:text>
1302 </xsl:template>
1303
1304</xsl:stylesheet>
1305
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette