VirtualBox

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

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

/Config.kmk and many other places: Change VBOX_VENDOR to the official copyright holder text, needs follow-up changes and equivalent adjustments elsewhere.

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