VirtualBox

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

Last change on this file since 78505 was 78505, checked in by vboxsync, 6 years ago

manual/docbook2latex.xsl: Render lineannotation as italics (normally used inside programlisting). bugref:9216

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 44.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-2012 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 <!--
286 Inserts \hypertarget{@id} that can be referenced via the /A "nameddest=@id"
287 command line or #nameddest=@id URL parameter.
288
289 TODO: The placement of the target could be improved on. The raisebox
290 stuff is a crude hack to make it a little more acceptable. -->
291 <xsl:template name="title-wrapper">
292 <xsl:param name="texcmd" select="concat('\',name(..))"/>
293 <xsl:param name="refid" select="../@id"/>
294 <xsl:param name="role" select="../@role"/>
295
296 <xsl:call-template name="xsltprocNewlineOutputHack"/>
297 <xsl:if test="$texcmd='\chapter' and $role='frontmatter'">
298 <xsl:text>\frontmatter&#x0a;</xsl:text>
299 </xsl:if>
300 <xsl:if test="$texcmd='\chapter' and ../preceding-sibling::*[1][@role='frontmatter']">
301 <xsl:text>\mainmatter&#x0a;</xsl:text>
302 </xsl:if>
303 <xsl:choose>
304 <xsl:when test="$refid">
305 <xsl:text>&#x0a;</xsl:text>
306 <xsl:value-of select="$texcmd"/>
307 <xsl:if test="not(contains($texcmd, '*'))">
308 <xsl:text>[</xsl:text> <!-- for toc -->
309 <xsl:apply-templates />
310 <xsl:text>]</xsl:text>
311 </xsl:if>
312 <xsl:text>{</xsl:text> <!-- for doc -->
313 <xsl:text>\raisebox{\ht\strutbox}{\hypertarget{</xsl:text>
314 <xsl:value-of select="$refid"/>
315 <xsl:text>}{}}</xsl:text>
316 <xsl:apply-templates />
317 <xsl:text>}</xsl:text>
318 </xsl:when>
319 <xsl:otherwise>
320 <xsl:text>&#x0a;</xsl:text><xsl:value-of select="$texcmd"/><xsl:text>{</xsl:text>
321 <xsl:apply-templates />
322 <xsl:text>}</xsl:text>
323 </xsl:otherwise>
324 </xsl:choose>
325 </xsl:template>
326
327 <xsl:template match="title">
328 <xsl:variable name="refid" select="../@id" />
329 <xsl:choose>
330 <xsl:when test="name(..)='bookinfo'">
331 <xsl:text>\newcommand\docbooktitle{</xsl:text>
332 <xsl:apply-templates />
333 <xsl:text>}</xsl:text>
334 </xsl:when>
335 <xsl:when test="name(..)='chapter'">
336 <xsl:call-template name="title-wrapper"/>
337 </xsl:when>
338 <xsl:when test="name(..)='preface'">
339 <xsl:call-template name="title-wrapper">
340 <xsl:with-param name="texcmd">\chapter</xsl:with-param>
341 </xsl:call-template>
342 </xsl:when>
343 <xsl:when test="name(..)='sect1' and ../../@role='frontmatter'">
344 <xsl:call-template name="title-wrapper">
345 <xsl:with-param name="texcmd">\section*</xsl:with-param>
346 </xsl:call-template>
347 </xsl:when>
348 <xsl:when test="name(..)='sect1'">
349 <xsl:call-template name="title-wrapper">
350 <xsl:with-param name="texcmd">\section</xsl:with-param>
351 </xsl:call-template>
352 </xsl:when>
353 <xsl:when test="parent::sect2[@role='not-in-toc'] or parent::refsect1 or (parent::section and count(ancestor::section) = 2)">
354 <xsl:call-template name="title-wrapper">
355 <xsl:with-param name="texcmd">\subsection*</xsl:with-param>
356 </xsl:call-template>
357 </xsl:when>
358 <xsl:when test="name(..)='sect2'">
359 <xsl:call-template name="title-wrapper">
360 <xsl:with-param name="texcmd">\subsection</xsl:with-param>
361 </xsl:call-template>
362 </xsl:when>
363 <xsl:when test="parent::sect3[@role='not-in-toc'] or parent::refsect2 or (parent::section and count(ancestor::section) = 3)">
364 <xsl:call-template name="title-wrapper">
365 <xsl:with-param name="texcmd">\subsubsection*</xsl:with-param>
366 </xsl:call-template>
367 </xsl:when>
368 <xsl:when test="name(..)='sect3'">
369 <xsl:call-template name="title-wrapper">
370 <xsl:with-param name="texcmd">\subsubsection</xsl:with-param>
371 </xsl:call-template>
372 </xsl:when>
373 <xsl:when test="parent::sect4[@role='not-in-toc'] or parent::refsect3 or (parent::section and count(ancestor::section) = 4)">
374 <xsl:call-template name="title-wrapper">
375 <xsl:with-param name="texcmd">\paragraph*</xsl:with-param>
376 </xsl:call-template>
377 </xsl:when>
378 <xsl:when test="name(..)='sect4'">
379 <xsl:call-template name="title-wrapper">
380 <xsl:with-param name="texcmd">\paragraph</xsl:with-param>
381 </xsl:call-template>
382 </xsl:when>
383 <xsl:when test="parent::sect5[@role='not-in-toc'] or parent::refsect4 or (parent::section and count(ancestor::section) = 5)">
384 <xsl:call-template name="title-wrapper">
385 <xsl:with-param name="texcmd">\subparagraph*</xsl:with-param>
386 </xsl:call-template>
387 </xsl:when>
388 <xsl:when test="name(..)='sect5'">
389 <xsl:call-template name="title-wrapper">
390 <xsl:with-param name="texcmd">\subparagraph</xsl:with-param>
391 </xsl:call-template>
392 </xsl:when>
393 <xsl:when test="name(..)='appendix'">
394 <xsl:call-template name="title-wrapper">
395 <xsl:with-param name="texcmd">\chapter</xsl:with-param>
396 </xsl:call-template>
397 </xsl:when>
398 <xsl:when test="name(..)='glossdiv'">
399 <xsl:call-template name="title-wrapper">
400 <xsl:with-param name="texcmd">\section*</xsl:with-param>
401 </xsl:call-template>
402 </xsl:when>
403 </xsl:choose>
404 <xsl:if test="$refid">
405 <xsl:value-of select="concat('&#x0a;\label{', $refid, '}')" />
406 </xsl:if>
407 <xsl:text>&#x0a;</xsl:text>
408 </xsl:template>
409
410 <xsl:template match="edition">
411 <xsl:choose>
412 <xsl:when test="name(..)='bookinfo'">
413 <xsl:text>\newcommand\docbooktitleedition{</xsl:text>
414 <xsl:apply-templates />
415 <xsl:text>}&#x0a;</xsl:text>
416 </xsl:when>
417 </xsl:choose>
418 </xsl:template>
419
420 <xsl:template match="corpauthor">
421 <xsl:choose>
422 <xsl:when test="name(..)='bookinfo'">
423 <xsl:text>\newcommand\docbookcorpauthor{</xsl:text>
424 <xsl:apply-templates />
425 <xsl:text>}&#x0a;</xsl:text>
426 </xsl:when>
427 </xsl:choose>
428 </xsl:template>
429
430 <xsl:template match="address">
431 <xsl:choose>
432 <xsl:when test="name(..)='bookinfo'">
433 <xsl:text>\newcommand\docbookbookinfoaddress{</xsl:text>
434 <xsl:apply-templates />
435 <xsl:text>}&#x0a;</xsl:text>
436 </xsl:when>
437 </xsl:choose>
438 </xsl:template>
439
440 <xsl:template match="year">
441 <xsl:choose>
442 <xsl:when test="name(..)='copyright'">
443 <xsl:text>\newcommand\docbookbookinfocopyrightyear{</xsl:text>
444 <xsl:apply-templates />
445 <xsl:text>}&#x0a;</xsl:text>
446 </xsl:when>
447 </xsl:choose>
448 </xsl:template>
449
450 <xsl:template match="holder">
451 <xsl:choose>
452 <xsl:when test="name(..)='copyright'">
453 <xsl:text>\newcommand\docbookbookinfocopyrightholder{</xsl:text>
454 <xsl:apply-templates />
455 <xsl:text>}&#x0a;</xsl:text>
456 </xsl:when>
457 </xsl:choose>
458 </xsl:template>
459
460 <xsl:template match="firstname">
461 <xsl:choose>
462 <xsl:when test="name(..)='othercredit'">
463 <xsl:text>\newcommand\docbookbookinfoothercreditfirstname{</xsl:text>
464 <xsl:apply-templates />
465 <xsl:text>}&#x0a;</xsl:text>
466 </xsl:when>
467 </xsl:choose>
468 </xsl:template>
469
470 <xsl:template match="surname">
471 <xsl:choose>
472 <xsl:when test="name(..)='othercredit'">
473 <xsl:text>\newcommand\docbookbookinfoothercreditsurname{</xsl:text>
474 <xsl:apply-templates />
475 <xsl:text>}&#x0a;</xsl:text>
476 </xsl:when>
477 </xsl:choose>
478 </xsl:template>
479
480 <xsl:template match="contrib">
481 <xsl:choose>
482 <xsl:when test="name(..)='othercredit'">
483 <xsl:text>\newcommand\docbookbookinfoothercreditcontrib{</xsl:text>
484 <xsl:apply-templates />
485 <xsl:text>}&#x0a;</xsl:text>
486 </xsl:when>
487 </xsl:choose>
488 </xsl:template>
489
490 <xsl:template match="glossary">
491 <xsl:text>&#x0a;&#x0a;\backmatter&#x0a;\chapter{Glossary}&#x0a;</xsl:text>
492 <xsl:apply-templates />
493 </xsl:template>
494
495 <xsl:template match="para">
496 <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or (name(../..)='varlistentry' and position()=1))">
497 <xsl:text>&#x0a;&#x0a;</xsl:text>
498 </xsl:if>
499 <xsl:apply-templates />
500 </xsl:template>
501
502 <xsl:template match="note">
503 <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, ':} ')" />
504 <xsl:apply-templates />
505 <xsl:text>\end{minipage}}\end{center}&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;</xsl:text>
506 </xsl:template>
507
508 <xsl:template match="warning">
509 <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, ':} ')" />
510 <xsl:apply-templates />
511 <xsl:text>\end{minipage}}\end{center}&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;</xsl:text>
512 </xsl:template>
513
514 <xsl:template match="screen">
515 <xsl:text>&#x0a;&#x0a;{\footnotesize\begin{alltt}&#x0a;</xsl:text>
516 <xsl:apply-templates />
517 <xsl:text>&#x0a;\end{alltt}}&#x0a;</xsl:text>
518 </xsl:template>
519
520 <xsl:template match="programlisting">
521 <xsl:text>&#x0a;&#x0a;{\small\begin{alltt}&#x0a;</xsl:text>
522 <xsl:apply-templates />
523 <xsl:text>&#x0a;\end{alltt}}&#x0a;</xsl:text>
524 </xsl:template>
525
526 <xsl:template match="footnote">
527 <xsl:text>\footnote{</xsl:text>
528 <xsl:apply-templates />
529 <xsl:text>}</xsl:text>
530 </xsl:template>
531
532 <xsl:template match="tgroup">
533 <xsl:choose>
534 <xsl:when test="@style='verywide'">
535 <xsl:text>&#x0a;&#x0a;{\small\begin{center}&#x0a;\begin{tabulary}{1.1\textwidth}[]</xsl:text>
536 </xsl:when>
537 <xsl:otherwise>
538 <xsl:text>&#x0a;&#x0a;{\small\begin{center}&#x0a;\begin{tabulary}{.9\textwidth}[]</xsl:text>
539 </xsl:otherwise>
540 </xsl:choose>
541 <xsl:text>{</xsl:text>
542 <xsl:choose>
543 <xsl:when test="@cols='1'">
544 <xsl:text>|L|</xsl:text>
545 </xsl:when>
546 <xsl:when test="@cols='2'">
547 <xsl:text>|L|L|</xsl:text>
548 </xsl:when>
549 <xsl:when test="@cols='3'">
550 <xsl:text>|L|L|L|</xsl:text>
551 </xsl:when>
552 <xsl:when test="@cols='4'">
553 <xsl:text>|L|L|L|L|</xsl:text>
554 </xsl:when>
555 <xsl:when test="@cols='5'">
556 <xsl:text>|L|L|L|L|L|</xsl:text>
557 </xsl:when>
558 <xsl:when test="@cols='6'">
559 <xsl:text>|L|L|L|L|L|L|</xsl:text>
560 </xsl:when>
561 <xsl:otherwise>
562 <xsl:message terminate="yes">Unsupported number of columns (<xsl:value-of select="@cols"/>), fix document or converter</xsl:message>
563 </xsl:otherwise>
564 </xsl:choose>
565 <xsl:text>}&#x0a;\hline&#x0a;</xsl:text>
566 <xsl:apply-templates />
567 <xsl:text>&#x0a;\end{tabulary}&#x0a;\end{center}}&#x0a;</xsl:text>
568 </xsl:template>
569
570 <xsl:template match="row">
571 <xsl:apply-templates />
572 <xsl:text>&#x0a;\\ \hline&#x0a;</xsl:text>
573 </xsl:template>
574
575 <xsl:template match="entry">
576 <xsl:if test="not(position()=1)">
577 <xsl:text> &amp; </xsl:text>
578 </xsl:if>
579 <xsl:apply-templates />
580 </xsl:template>
581
582 <xsl:template match="itemizedlist">
583 <xsl:call-template name="xsltprocNewlineOutputHack"/>
584 <xsl:text>&#x0a;\begin{itemize}&#x0a;</xsl:text>
585 <xsl:if test="@spacing = 'compact'">
586 <xsl:text> \setlength{\parskip}{0pt}&#x0a;</xsl:text>
587 <xsl:text> \setlength{\itemsep}{0pt}&#x0a;</xsl:text>
588 <xsl:text> \setlength{\topsep}{0pt}&#x0a;</xsl:text>
589 <xsl:text> \setlength{\parsep}{0pt}&#x0a;</xsl:text>
590 <xsl:text> \setlength{\partopsep}{0pt}&#x0a;</xsl:text>
591 </xsl:if>
592 <xsl:apply-templates />
593 <xsl:text>&#x0a;\end{itemize}&#x0a;</xsl:text>
594 </xsl:template>
595
596 <xsl:template match="orderedlist">
597 <xsl:call-template name="xsltprocNewlineOutputHack"/>
598 <xsl:text>&#x0a;\begin{enumerate}&#x0a;</xsl:text>
599 <xsl:if test="@spacing = 'compact'">
600 <xsl:text> \setlength{\parskip}{0pt}&#x0a;</xsl:text>
601 <xsl:text> \setlength{\itemsep}{0pt}&#x0a;</xsl:text>
602 <xsl:text> \setlength{\topsep}{0pt}&#x0a;</xsl:text>
603 <xsl:text> \setlength{\parsep}{0pt}&#x0a;</xsl:text>
604 <xsl:text> \setlength{\partopsep}{0pt}&#x0a;</xsl:text>
605 </xsl:if>
606 <xsl:apply-templates />
607 <xsl:text>&#x0a;\end{enumerate}&#x0a;</xsl:text>
608 </xsl:template>
609
610 <xsl:template match="variablelist">
611 <xsl:call-template name="xsltprocNewlineOutputHack"/>
612 <xsl:text>&#x0a;\begin{description}&#x0a;</xsl:text>
613 <xsl:if test="@spacing = 'compact'">
614 <xsl:text> \setlength{\parskip}{0pt}&#x0a;</xsl:text>
615 <xsl:text> \setlength{\itemsep}{0pt}&#x0a;</xsl:text>
616 <xsl:text> \setlength{\topsep}{0pt}&#x0a;</xsl:text>
617 <xsl:text> \setlength{\parsep}{0pt}&#x0a;</xsl:text>
618 <xsl:text> \setlength{\partopsep}{0pt}&#x0a;</xsl:text>
619 </xsl:if>
620 <xsl:apply-templates />
621 <xsl:text>&#x0a;\end{description}&#x0a;</xsl:text>
622 </xsl:template>
623
624 <xsl:template match="varlistentry">
625 <xsl:if test="not(./term) or not(./listitem) or count(./listitem) != 1">
626 <xsl:message terminate="yes">Expected at least one term and one listitem element in the varlistentry.</xsl:message>
627 </xsl:if>
628 <xsl:text>&#x0a;&#x0a;\item[{\parbox[t]{\linewidth}{\raggedright </xsl:text>
629 <xsl:apply-templates select="./term[1]"/>
630 <xsl:for-each select="./term[position() > 1]">
631 <xsl:text>\\&#x0a; </xsl:text>
632 <xsl:apply-templates select="."/>
633 </xsl:for-each>
634 <xsl:text>}}] \hfill \\&#x0a;</xsl:text>
635 <xsl:apply-templates select="listitem/*"/>
636 </xsl:template>
637
638 <xsl:template match="listitem">
639 <xsl:text>&#x0a;&#x0a;\item </xsl:text>
640 <xsl:apply-templates />
641 <xsl:text>&#x0a;</xsl:text>
642 </xsl:template>
643
644 <xsl:template match="glossterm">
645 <xsl:variable name="refid" select="(@id)" />
646 <xsl:if test="$refid">
647 <xsl:value-of select="concat('&#x0a;\label{', $refid, '}')" />
648 </xsl:if>
649 <xsl:text>&#x0a;&#x0a;\item[</xsl:text>
650 <xsl:apply-templates />
651 <xsl:text>]</xsl:text>
652 </xsl:template>
653
654 <xsl:template match="glosslist | glossdiv">
655 <xsl:text>&#x0a;&#x0a;\begin{description}&#x0a;</xsl:text>
656 <xsl:apply-templates />
657 <xsl:text>&#x0a;\end{description}&#x0a;</xsl:text>
658 </xsl:template>
659
660 <xsl:template match="superscript">
661 <xsl:variable name="contents">
662 <xsl:apply-templates />
663 </xsl:variable>
664 <xsl:value-of select="concat('\texorpdfstring{\textsuperscript{', $contents, '}}{', $contents, '}')" />
665 </xsl:template>
666
667 <xsl:template match="emphasis">
668 <xsl:choose>
669 <xsl:when test="@role='bold'">
670 <xsl:text>\textbf{</xsl:text>
671 </xsl:when>
672 <xsl:otherwise>
673 <xsl:text>\textit{</xsl:text>
674 </xsl:otherwise>
675 </xsl:choose>
676 <xsl:apply-templates />
677 <xsl:text>}</xsl:text>
678 </xsl:template>
679
680 <xsl:template match="computeroutput | code">
681 <xsl:text>\texttt{</xsl:text>
682 <xsl:apply-templates />
683 <xsl:text>}</xsl:text>
684 </xsl:template>
685
686 <xsl:template match="literal | filename">
687 <xsl:text>\texttt{</xsl:text>
688 <xsl:apply-templates />
689 <xsl:text>}</xsl:text>
690 </xsl:template>
691
692 <xsl:template match="citetitle">
693 <xsl:text>\textit{</xsl:text>
694 <xsl:apply-templates />
695 <xsl:text>}</xsl:text>
696 </xsl:template>
697
698 <xsl:template match="lineannotation">
699 <xsl:text>\textit{</xsl:text>
700 <xsl:apply-templates />
701 <xsl:text>}</xsl:text>
702 </xsl:template>
703
704 <xsl:template match="ulink">
705 <xsl:text>\url{</xsl:text>
706 <xsl:apply-templates />
707 <xsl:text>}</xsl:text>
708 </xsl:template>
709
710 <xsl:template match="xref">
711 <xsl:choose>
712 <xsl:when test="@endterm">
713 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
714 </xsl:when>
715 <xsl:otherwise>
716 <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
717 </xsl:otherwise>
718 </xsl:choose>
719 </xsl:template>
720
721 <xsl:template match="link">
722 <xsl:choose>
723 <xsl:when test="@endterm">
724 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
725 </xsl:when>
726 <xsl:when test="./text()">
727 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{')" />
728 <xsl:apply-templates select="./text()"/>
729 <xsl:value-of select="'}}'" />
730 </xsl:when>
731 <xsl:otherwise>
732 <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
733 </xsl:otherwise>
734 </xsl:choose>
735 </xsl:template>
736
737 <xsl:template match="trademark">
738 <xsl:apply-templates />
739 <xsl:text>\textsuperscript{\textregistered}</xsl:text>
740 </xsl:template>
741
742 <!-- for some reason, DocBook insists of having image data nested this way always:
743 mediaobject -> imageobject -> imagedata
744 but only imagedata is interesting -->
745 <xsl:template match="imagedata">
746 <xsl:if test="@align='center'">
747 <xsl:text>\begin{center}</xsl:text>
748 </xsl:if>
749 <xsl:value-of select="concat('&#x0a;\includegraphics[width=', @width, ']{', @fileref, '}&#x0a;')" />
750 <xsl:apply-templates />
751 <xsl:if test="@align='center'">
752 <xsl:text>\end{center}</xsl:text>
753 </xsl:if>
754 </xsl:template>
755
756 <!--
757 Turn the refsynopsisdiv part of a manpage into a named & indented paragraph.
758 -->
759 <xsl:template match="refsynopsisdiv">
760 <xsl:if test="name(*[1]) != 'cmdsynopsis'"><xsl:message terminate="yes">Expected refsynopsisdiv to start with cmdsynopsis</xsl:message></xsl:if>
761 <xsl:if test="title"><xsl:message terminate="yes">No title element supported in refsynopsisdiv</xsl:message></xsl:if>
762 <xsl:call-template name="xsltprocNewlineOutputHack"/>
763 <xsl:text>&#x0a;\subsection*{Synopsis}</xsl:text>
764 <xsl:if test="name(*[1]) != 'cmdsynopsis'"> <!-- just in case -->
765 <xsl:text>\hfill \\&#x0a;</xsl:text>
766 </xsl:if>
767 <xsl:text>&#x0a;</xsl:text>
768 <xsl:apply-templates />
769 </xsl:template>
770
771 <!--
772 The refsect1 is used for 'Description' and such. Do same as with refsynopsisdiv
773 and turn it into a named & indented paragraph.
774 -->
775 <xsl:template match="refsect1">
776 <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
777 <xsl:message terminate="yes">Expected exactly one title as the first refsect1 element (remarks goes after title!).</xsl:message>
778 </xsl:if>
779 <xsl:apply-templates/>
780 </xsl:template>
781
782 <!--
783 The refsect2 element will be turned into a subparagraph if it has a title,
784 however, that didn't work out when it didn't have a title and started with
785 a cmdsynopsis instead (subcommand docs). So, we're doing some trickery
786 here (HACK ALERT) for the non-title case to feign a paragraph.
787 -->
788 <xsl:template match="refsect2">
789 <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
790 <xsl:message terminate="yes">Expected exactly one title as the first refsect2 element (remarks goes after title!).</xsl:message>
791 </xsl:if>
792 <xsl:apply-templates/>
793 <xsl:text>&#x0a;</xsl:text>
794 </xsl:template>
795
796
797 <!--
798 Command Synopsis elements.
799
800 We treat each command element inside a cmdsynopsis as the start of
801 a new paragraph. The DocBook HTML converter does so too, but the
802 manpage one doesn't.
803
804 sbr and linebreaks made by latex should be indented from the base
805 command level. This is done by the \hangindent3em\hangafter1 bits.
806
807 We exploit the default paragraph indentation to get each command
808 indented from the left margin. This, unfortunately, doesn't work
809 if we're the first paragraph in a (sub*)section. \noindent cannot
810 counter this due to when latex enforces first paragraph stuff. Since
811 it's tedious to figure out when we're in the first paragraph and when
812 not, we just do \noindent\hspace{1em} everywhere.
813 -->
814 <xsl:template match="sbr">
815 <xsl:if test="not(ancestor::cmdsynopsis)">
816 <xsl:message terminate="yes">sbr only supported inside cmdsynopsis (because of hangindent)</xsl:message>
817 </xsl:if>
818 <xsl:text>\linebreak</xsl:text>
819 </xsl:template>
820
821 <xsl:template match="refentry|refnamediv|refentryinfo|refmeta|refsect3|refsect4|refsect5|synopfragment|synopfragmentref|cmdsynopsis/info">
822 <xsl:message terminate="yes"><xsl:value-of select="name()"/> is not supported</xsl:message>
823 </xsl:template>
824
825 <xsl:template match="cmdsynopsis">
826 <xsl:if test="preceding-sibling::cmdsynopsis">
827 <xsl:text>\par%cmdsynopsis</xsl:text>
828 </xsl:if>
829 <xsl:text>&#x0a;</xsl:text>
830 <xsl:if test="parent::remark[@role='VBoxManage-overview']">
831 <!-- Overview fontsize trick -->
832 <xsl:text>{\footnotesize</xsl:text>
833 </xsl:if>
834 <xsl:text>\noindent\hspace{1em}</xsl:text>
835 <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
836 <xsl:apply-templates />
837 <xsl:text>}</xsl:text>
838 <xsl:if test="following-sibling::*">
839 </xsl:if>
840
841 <!-- For refsect2 subcommand descriptions. -->
842 <xsl:if test="not(following-sibling::cmdsynopsis) and position() != last()">
843 <xsl:text>\linebreak</xsl:text>
844 </xsl:if>
845 <!-- Special overview trick for the current VBoxManage command overview. -->
846 <xsl:if test="parent::remark[@role='VBoxManage-overview']">
847 <xsl:text>}\vspace{1em}</xsl:text>
848 </xsl:if>
849 </xsl:template>
850
851 <xsl:template match="command">
852 <xsl:choose>
853 <xsl:when test="ancestor::cmdsynopsis">
854 <!-- Trigger a line break if this isn't the first command in a the synopsis -->
855 <xsl:if test="preceding-sibling::command">
856 <xsl:text>}\par%command&#x0a;</xsl:text>
857 <xsl:text>\noindent\hspace{1em}</xsl:text>
858 <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
859 </xsl:if>
860 <xsl:apply-templates />
861 </xsl:when>
862 <xsl:otherwise>
863 <xsl:text>\texttt{</xsl:text>
864 <xsl:apply-templates />
865 <xsl:text>}</xsl:text>
866 </xsl:otherwise>
867 </xsl:choose>
868 </xsl:template>
869
870 <xsl:template match="option">
871 <xsl:choose>
872 <xsl:when test="ancestor::cmdsynopsis">
873 <xsl:apply-templates />
874 </xsl:when>
875 <xsl:otherwise>
876 <xsl:text>\texttt{</xsl:text>
877 <xsl:apply-templates />
878 <xsl:text>}</xsl:text>
879 </xsl:otherwise>
880 </xsl:choose>
881 </xsl:template>
882
883 <!-- duplicated in docbook2latex.xsl -->
884 <xsl:template match="arg|group">
885 <!-- separator char if we're not the first child -->
886 <xsl:if test="position() > 1">
887 <xsl:choose>
888 <xsl:when test="parent::group"><xsl:value-of select="$arg.or.sep"/></xsl:when>
889 <xsl:when test="ancestor-or-self::*/@sepchar"><xsl:value-of select="ancestor-or-self::*/@sepchar"/></xsl:when>
890 <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
891 </xsl:choose>
892 </xsl:if>
893 <!-- open wrapping -->
894 <xsl:choose>
895 <xsl:when test="not(@choice) or @choice = ''"> <xsl:value-of select="$arg.choice.def.open.str"/></xsl:when>
896 <xsl:when test="@choice = 'opt'"> <xsl:value-of select="$arg.choice.opt.open.str"/></xsl:when>
897 <xsl:when test="@choice = 'req'"> <xsl:value-of select="$arg.choice.req.open.str"/></xsl:when>
898 <xsl:when test="@choice = 'plain'"/>
899 <xsl:otherwise><xsl:message terminate="yes">Invalid arg choice: "<xsl:value-of select="@choice"/>"</xsl:message></xsl:otherwise>
900 </xsl:choose>
901
902 <!-- render the arg (TODO: may need to do more work here) -->
903 <xsl:apply-templates />
904
905 <!-- repeat wrapping -->
906 <xsl:choose>
907 <xsl:when test="@rep = 'norepeat' or not(@rep) or @rep = ''"/>
908 <xsl:when test="@rep = 'repeat'"> <xsl:value-of select="$arg.rep.repeat.str"/></xsl:when>
909 <xsl:otherwise><xsl:message terminate="yes">Invalid rep choice: "<xsl:value-of select="@rep"/>"</xsl:message></xsl:otherwise>
910 </xsl:choose>
911 <!-- close wrapping -->
912 <xsl:choose>
913 <xsl:when test="not(@choice) or @choice = ''"> <xsl:value-of select="$arg.choice.def.close.str"/></xsl:when>
914 <xsl:when test="@choice = 'opt'"> <xsl:value-of select="$arg.choice.opt.close.str"/></xsl:when>
915 <xsl:when test="@choice = 'req'"> <xsl:value-of select="$arg.choice.req.close.str"/></xsl:when>
916 </xsl:choose>
917 </xsl:template>
918
919 <xsl:template match="replaceable">
920 <xsl:choose>
921 <xsl:when test="(not(ancestor::cmdsynopsis) and not(ancestor::option) and not(ancestor::screen)) or ancestor::arg">
922 <xsl:text>\texttt{\textit{</xsl:text>
923 <xsl:apply-templates />
924 <xsl:text>}}</xsl:text>
925 </xsl:when>
926 <xsl:otherwise>
927 <xsl:text>\textit{&lt;</xsl:text>
928 <xsl:apply-templates />
929 <xsl:text>&gt;}</xsl:text>
930 </xsl:otherwise>
931 </xsl:choose>
932 </xsl:template>
933
934
935 <!--
936 Generic element text magic.
937 -->
938 <xsl:template match="//text()">
939
940 <!-- Do the translation of \ into \textbackslash{} in two steps, to avoid
941 running into replacing {} as well which would be very wrong. -->
942 <xsl:variable name="subst1">
943 <xsl:call-template name="str:subst">
944 <xsl:with-param name="text" select="." />
945 <xsl:with-param name="replace" select="'\'" />
946 <xsl:with-param name="with" select="'\textbackslash'" />
947 <xsl:with-param name="disable-output-escaping" select="no" />
948 </xsl:call-template>
949 </xsl:variable>
950 <xsl:variable name="subst2">
951 <xsl:call-template name="str:subst">
952 <xsl:with-param name="text" select="$subst1" />
953 <xsl:with-param name="replace" select="'{'" />
954 <xsl:with-param name="with" select="'\{'" />
955 <xsl:with-param name="disable-output-escaping" select="no" />
956 </xsl:call-template>
957 </xsl:variable>
958 <xsl:variable name="subst3">
959 <xsl:call-template name="str:subst">
960 <xsl:with-param name="text" select="$subst2" />
961 <xsl:with-param name="replace" select="'}'" />
962 <xsl:with-param name="with" select="'\}'" />
963 <xsl:with-param name="disable-output-escaping" select="no" />
964 </xsl:call-template>
965 </xsl:variable>
966 <xsl:variable name="subst4">
967 <xsl:call-template name="str:subst">
968 <xsl:with-param name="text" select="$subst3" />
969 <xsl:with-param name="replace" select="'\textbackslash'" />
970 <xsl:with-param name="with" select="'\textbackslash{}'" />
971 <xsl:with-param name="disable-output-escaping" select="no" />
972 </xsl:call-template>
973 </xsl:variable>
974
975 <xsl:choose>
976 <xsl:when test="(name(..) = 'computeroutput') or (name(../..) = 'computeroutput')
977 or (name(..) = 'code') or (name(../..) = 'code')
978 or (name(..) = 'arg') or (name(../..) = 'arg')
979 or (name(..) = 'option') or (name(../..) = 'option')
980 or (name(..) = 'command') or (name(../..) = 'command')
981 or (name(..) = 'cmdsynopsis') or (name(../..) = 'cmdsynopsis')
982 or (name(..) = 'replaceable') or (name(../..) = 'replaceable')
983 ">
984 <xsl:variable name="subst5">
985 <xsl:call-template name="str:subst">
986 <xsl:with-param name="text" select="translate(normalize-space(concat('&#x7f;',$subst4,'&#x7f;')),'&#x7f;','')" />
987 <xsl:with-param name="replace" select="'--'" />
988 <xsl:with-param name="with" select="'-{}-'" />
989 <xsl:with-param name="disable-output-escaping" select="no" />
990 </xsl:call-template>
991 </xsl:variable>
992 <xsl:variable name="subst6">
993 <xsl:call-template name="str:subst">
994 <xsl:with-param name="text" select="$subst5" />
995 <xsl:with-param name="replace" select="'_'" />
996 <xsl:with-param name="with" select="'\_'" />
997 <xsl:with-param name="disable-output-escaping" select="no" />
998 </xsl:call-template>
999 </xsl:variable>
1000 <xsl:variable name="subst7">
1001 <xsl:call-template name="str:subst">
1002 <xsl:with-param name="text" select="$subst6" />
1003 <xsl:with-param name="replace" select="'$'" />
1004 <xsl:with-param name="with" select="'\$'" />
1005 <xsl:with-param name="disable-output-escaping" select="no" />
1006 </xsl:call-template>
1007 </xsl:variable>
1008 <xsl:variable name="subst8">
1009 <xsl:call-template name="str:subst">
1010 <xsl:with-param name="text" select="$subst7" />
1011 <xsl:with-param name="replace" select="'%'" />
1012 <xsl:with-param name="with" select="'\%'" />
1013 <xsl:with-param name="disable-output-escaping" select="no" />
1014 </xsl:call-template>
1015 </xsl:variable>
1016 <xsl:variable name="subst9">
1017 <xsl:call-template name="str:subst">
1018 <xsl:with-param name="text" select="$subst8" />
1019 <xsl:with-param name="replace" select="'#'" />
1020 <xsl:with-param name="with" select="'\#'" />
1021 <xsl:with-param name="disable-output-escaping" select="no" />
1022 </xsl:call-template>
1023 </xsl:variable>
1024 <xsl:variable name="subst10">
1025 <xsl:call-template name="str:subst">
1026 <xsl:with-param name="text" select="$subst9" />
1027 <xsl:with-param name="replace" select="'~'" />
1028 <xsl:with-param name="with" select="'\textasciitilde{}'" />
1029 <xsl:with-param name="disable-output-escaping" select="no" />
1030 </xsl:call-template>
1031 </xsl:variable>
1032 <xsl:variable name="subst11">
1033 <xsl:call-template name="str:subst">
1034 <xsl:with-param name="text" select="$subst10" />
1035 <xsl:with-param name="replace" select="'&amp;'" />
1036 <xsl:with-param name="with" select="'\&amp;'" />
1037 <xsl:with-param name="disable-output-escaping" select="no" />
1038 </xsl:call-template>
1039 </xsl:variable>
1040 <xsl:choose>
1041 <xsl:when test="parent::arg or parent::command">
1042 <xsl:variable name="subst12">
1043 <xsl:call-template name="str:subst">
1044 <xsl:with-param name="text" select="$subst10" />
1045 <xsl:with-param name="replace" select="' '" />
1046 <xsl:with-param name="with" select="'~'" />
1047 <xsl:with-param name="disable-output-escaping" select="no" />
1048 </xsl:call-template>
1049 </xsl:variable>
1050 <xsl:value-of select="$subst12" />
1051 </xsl:when>
1052 <xsl:otherwise>
1053 <xsl:value-of select="$subst11" />
1054 </xsl:otherwise>
1055 </xsl:choose>
1056 </xsl:when>
1057
1058 <xsl:when test="(name(..)='address') or (name(../..)='address')">
1059 <xsl:variable name="subst5">
1060 <xsl:call-template name="str:subst">
1061 <xsl:with-param name="text" select="$subst4" />
1062 <xsl:with-param name="replace" select="'&#x0a;'" />
1063 <xsl:with-param name="with" select="' \\'" />
1064 <xsl:with-param name="disable-output-escaping" select="no" />
1065 </xsl:call-template>
1066 </xsl:variable>
1067 <xsl:value-of select="$subst5" />
1068 </xsl:when>
1069
1070 <!-- <screen> and <programlisting>, which work with alltt environment. -->
1071 <xsl:otherwise>
1072 <xsl:variable name="subst5">
1073 <xsl:call-template name="str:subst">
1074 <xsl:with-param name="text" select="$subst4" />
1075 <xsl:with-param name="replace" select="'_'" />
1076 <xsl:with-param name="with" select="'\_'" />
1077 <xsl:with-param name="disable-output-escaping" select="no" />
1078 </xsl:call-template>
1079 </xsl:variable>
1080 <xsl:variable name="subst6">
1081 <xsl:call-template name="str:subst">
1082 <xsl:with-param name="text" select="$subst5" />
1083 <xsl:with-param name="replace" select="'$'" />
1084 <xsl:with-param name="with" select="'\$'" />
1085 <xsl:with-param name="disable-output-escaping" select="no" />
1086 </xsl:call-template>
1087 </xsl:variable>
1088 <xsl:variable name="subst7">
1089 <xsl:call-template name="str:subst">
1090 <xsl:with-param name="text" select="$subst6" />
1091 <xsl:with-param name="replace" select="'%'" />
1092 <xsl:with-param name="with" select="'\%'" />
1093 <xsl:with-param name="disable-output-escaping" select="no" />
1094 </xsl:call-template>
1095 </xsl:variable>
1096 <xsl:variable name="subst8">
1097 <xsl:call-template name="str:subst">
1098 <xsl:with-param name="text" select="$subst7" />
1099 <xsl:with-param name="replace" select="'#'" />
1100 <xsl:with-param name="with" select="'\#'" />
1101 <xsl:with-param name="disable-output-escaping" select="no" />
1102 </xsl:call-template>
1103 </xsl:variable>
1104 <xsl:variable name="subst9">
1105 <xsl:call-template name="str:subst">
1106 <xsl:with-param name="text" select="$subst8" />
1107 <xsl:with-param name="replace" select="'µ'" />
1108 <xsl:with-param name="with" select="'$\mu$'" />
1109 <xsl:with-param name="disable-output-escaping" select="no" />
1110 </xsl:call-template>
1111 </xsl:variable>
1112 <xsl:variable name="subst10">
1113 <xsl:call-template name="str:subst">
1114 <xsl:with-param name="text" select="$subst9" />
1115 <xsl:with-param name="replace" select="'®'" />
1116 <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
1117 <xsl:with-param name="disable-output-escaping" select="no" />
1118 </xsl:call-template>
1119 </xsl:variable>
1120 <xsl:variable name="quote">"</xsl:variable>
1121 <!-- preparation for pretty quotes: replace all double quotes _outside_ screen
1122 sections with "\QUOTE{}" strings, which the makefile will then replace
1123 with pretty quotes by invoking sed a few times. Unfortunately there are
1124 no regular expressions in XSLT so there's no other way. -->
1125 <xsl:variable name="subst11">
1126 <xsl:choose>
1127 <xsl:when test="(name(..)='screen') or (name(../..)='screen')
1128 or (name(..)='programlisting') or (name(../..)='programlisting')
1129 ">
1130 <xsl:value-of select="$subst10" />
1131 </xsl:when>
1132 <xsl:otherwise>
1133 <xsl:call-template name="str:subst">
1134 <xsl:with-param name="text" select="$subst10" />
1135 <xsl:with-param name="replace" select="$quote" />
1136 <xsl:with-param name="with" select="'\QUOTE{}'" />
1137 <xsl:with-param name="disable-output-escaping" select="no" />
1138 </xsl:call-template>
1139 </xsl:otherwise>
1140 </xsl:choose>
1141 </xsl:variable>
1142 <xsl:variable name="subst12">
1143 <xsl:call-template name="str:subst">
1144 <xsl:with-param name="text" select="$subst11" />
1145 <xsl:with-param name="replace" select="'~'" />
1146 <xsl:with-param name="with" select="'\textasciitilde{}'" />
1147 <xsl:with-param name="disable-output-escaping" select="no" />
1148 </xsl:call-template>
1149 </xsl:variable>
1150 <xsl:variable name="subst13">
1151 <xsl:call-template name="str:subst">
1152 <xsl:with-param name="text" select="$subst12" />
1153 <xsl:with-param name="replace" select="'&amp;'" />
1154 <xsl:with-param name="with" select="'\&amp;'" />
1155 <xsl:with-param name="disable-output-escaping" select="no" />
1156 </xsl:call-template>
1157 </xsl:variable>
1158 <xsl:value-of select="$subst13" />
1159 </xsl:otherwise>
1160 </xsl:choose>
1161 </xsl:template>
1162
1163 <!--
1164 xsltprocNewlineOutputHack - emits a single new line.
1165
1166 Hack Alert! This template helps xsltproc split up the output text elements
1167 and avoid reallocating them into the MB range. Calls to this
1168 template is made occationally while generating larger output
1169 file. It's not necessary for small stuff like header.
1170
1171 The trick we're playing on xsltproc has to do with CDATA
1172 and/or the escape setting of the xsl:text element. It forces
1173 xsltproc to allocate a new output element, thus preventing
1174 things from growing out of proportions and slowing us down.
1175
1176 This was successfully employed to reduce a 18+ seconds run to
1177 around one second (possibly less due to kmk overhead).
1178 -->
1179 <xsl:template name="xsltprocNewlineOutputHack">
1180 <xsl:text disable-output-escaping="yes"><![CDATA[
1181]]></xsl:text>
1182 </xsl:template>
1183
1184</xsl:stylesheet>
1185
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