VirtualBox

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

Last change on this file since 93483 was 89922, checked in by vboxsync, 3 years ago

doc/docbook2latex.xsl: Remove unwanted empty line after every term in a variable list. Also drop some dead code (same condition checked a little earlier, bailing out).

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