VirtualBox

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

Last change on this file since 84144 was 82969, checked in by vboxsync, 5 years ago

Copyright year updates - manual ones.

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