VirtualBox

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

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

doc/manual: Big build system overhaul, because the use of entities and catalogs eliminates the need to have placeholders in XML which previously needed separate preprocessing. Many cleanups, including replacing almost all pattern rules (since their dependencies had to be too generous) and using defines instead. Also integrated many cleanups for the user manual text (which needs careful review, couldn't check yet if it uses any additional tags which some of our XSLT would ignore).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 41.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{fancyvrb}
118\usepackage{alltt}
119\usepackage{color}
120\usepackage{scrextend}
121\definecolor{darkgreen}{rgb}{0,0.6,0}
122\tymin=21pt
123
124</xsl:text>
125 <xsl:if test="$TARGETLANG='de_DE'">\usepackage[ngerman]{babel}&#10;\PrerenderUnicode{ü}</xsl:if>
126<!-- <xsl:if test="$TARGETLANG='fr_FR'">\usepackage[french]{babel}&#10;\FrenchItemizeSpacingfalse&#10;\renewcommand{\FrenchLabelItem}{\textbullet}</xsl:if>
127 this command is no longer understood by TexLive2008
128 -->
129 <xsl:text>
130
131% use Palatino as serif font:
132% \usepackage{mathpazo}
133\usepackage{charter}
134% use Helvetica as sans-serif font:
135\usepackage{helvet}
136
137% use Bera Mono (a variant of Bitstream Vera Mono) as typewriter font
138% (requires texlive-fontsextra)
139\usepackage[scaled]{beramono}
140% previously: use Courier as typewriter font:
141% \usepackage{courier}
142
143\definecolor{colNote}{rgb}{0,0,0}
144\definecolor{colWarning}{rgb}{0,0,0}
145\definecolor{colScreenFrame}{rgb}{0,0,0}
146\definecolor{colScreenText}{rgb}{0,0,0}
147
148% number headings down to this level
149\setcounter{secnumdepth}{3}
150% more space for the section numbers
151\makeatletter
152\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.9em}}
153\renewcommand*\l@subsection{\@dottedtocline{2}{4.4em}{3.8em}}
154\renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{3.8em}}
155\renewcommand*\@pnumwidth{1.7em}
156\renewcommand*\@tocrmarg{5.0em}
157\makeatother
158
159% more tolerance at 2nd wrap stage:
160\tolerance = 1000
161% allow 3rd wrap stage:
162\emergencystretch = 10pt
163% no Schusterjungen:
164\clubpenalty = 10000
165% no Hurenkinder:
166\widowpenalty = 10000
167\displaywidowpenalty = 10000
168% max pdf compression:
169\pdfcompresslevel9
170
171% opening and closing quotes: the OQ and CQ macros define this (and the makefile employs some sed magic also)
172</xsl:text>
173 <xsl:choose>
174 <xsl:when test="$TARGETLANG='de_DE'">
175 <xsl:text>\newcommand\OQ{\texorpdfstring{\glqq}{"}}&#10;\newcommand\CQ{\texorpdfstring{\grqq}{"}}&#10;</xsl:text>
176 </xsl:when>
177 <xsl:when test="$TARGETLANG='fr_FR'">
178 <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}}&#10;\newcommand\CQ{\texorpdfstring{''}{"}}&#10;</xsl:text>
179 </xsl:when>
180 <xsl:when test="$TARGETLANG='en_US'">
181 <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}}&#10;\newcommand\CQ{\texorpdfstring{''}{"}}&#10;</xsl:text>
182 </xsl:when>
183 <xsl:otherwise>
184 <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
185 </xsl:otherwise>
186 </xsl:choose>
187
188 <xsl:apply-templates />
189
190 <xsl:text>
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% \maketitle
222%\begin{titlepage}
223\thispagestyle{empty}
224\begin{minipage}{\textwidth}
225\begin{center}
226\includegraphics[width=4cm]{images/vboxlogo.png}
227\end{center}%
228\vspace{10mm}
229
230{\fontsize{40pt}{40pt}\selectfont\rmfamily\bfseries%
231\begin{center}
232\docbooktitle
233\end{center}%
234\vspace{10mm}
235}
236
237{\fontsize{30pt}{30pt}\selectfont\rmfamily\bfseries%
238\begin{center}
239\docbooksubtitle
240\end{center}%
241\vspace{10mm}
242}
243
244{\fontsize{16pt}{20pt}\selectfont\rmfamily%
245\begin{center}
246</xsl:text>
247 <xsl:if test="//bookinfo/othercredit">
248 <xsl:text>\docbookbookinfoothercreditcontrib{}: \docbookbookinfoothercreditfirstname{} \docbookbookinfoothercreditsurname
249
250\vspace{8mm}
251</xsl:text>
252 </xsl:if>
253 <xsl:text>\docbooktitleedition
254
255\vspace{2mm}
256
257\docbookbookinfocopyright
258
259\vspace{2mm}
260
261\docbookbookinfoaddress
262\end{center}%
263}
264
265%\end{titlepage}
266\end{minipage}
267
268\tableofcontents
269 </xsl:text>
270 </xsl:template>
271
272 <xsl:template match="subtitle">
273 <xsl:choose>
274 <xsl:when test="name(..)='bookinfo'">
275 <xsl:text>\newcommand\docbooksubtitle{</xsl:text>
276 <xsl:apply-templates />
277 <xsl:text>}</xsl:text>
278 </xsl:when>
279 </xsl:choose>
280 </xsl:template>
281
282 <!--
283 Inserts \hypertarget{@id} that can be referenced via the /A "nameddest=@id"
284 command line or #nameddest=@id URL parameter.
285
286 TODO: The placement of the target could be improved on. The raisebox
287 stuff is a crude hack to make it a little more acceptable. -->
288 <xsl:template name="title-wrapper">
289 <xsl:param name="texcmd" select="concat('\',name(..))"/>
290 <xsl:param name="refid" select="../@id"/>
291
292 <xsl:call-template name="xsltprocNewlineOutputHack"/>
293 <xsl:choose>
294 <xsl:when test="$refid">
295 <xsl:text>&#x0a;</xsl:text>
296 <xsl:value-of select="$texcmd"/>
297 <xsl:if test="not(contains($texcmd, '*'))">
298 <xsl:text>[</xsl:text> <!-- for toc -->
299 <xsl:apply-templates />
300 <xsl:text>]</xsl:text>
301 </xsl:if>
302 <xsl:text>{</xsl:text> <!-- for doc -->
303 <xsl:text>\raisebox{\ht\strutbox}{\hypertarget{</xsl:text>
304 <xsl:value-of select="$refid"/>
305 <xsl:text>}{}}</xsl:text>
306 <xsl:apply-templates />
307 <xsl:text>}</xsl:text>
308 </xsl:when>
309 <xsl:otherwise>
310 <xsl:text>&#x0a;</xsl:text><xsl:value-of select="$texcmd"/><xsl:text>{</xsl:text>
311 <xsl:apply-templates />
312 <xsl:text>}</xsl:text>
313 </xsl:otherwise>
314 </xsl:choose>
315 </xsl:template>
316
317 <xsl:template match="title">
318 <xsl:variable name="refid" select="../@id" />
319 <xsl:choose>
320 <xsl:when test="name(..)='bookinfo'">
321 <xsl:text>\newcommand\docbooktitle{</xsl:text>
322 <xsl:apply-templates />
323 <xsl:text>}</xsl:text>
324 </xsl:when>
325 <xsl:when test="name(..)='chapter'">
326 <xsl:call-template name="title-wrapper"/>
327 </xsl:when>
328 <xsl:when test="name(..)='sect1'">
329 <xsl:call-template name="title-wrapper">
330 <xsl:with-param name="texcmd">\section</xsl:with-param>
331 </xsl:call-template>
332 </xsl:when>
333 <xsl:when test="parent::sect2[@role='not-in-toc'] or parent::refsect1 or (parent::section and count(ancestor::section) = 2)">
334 <xsl:call-template name="title-wrapper">
335 <xsl:with-param name="texcmd">\subsection*</xsl:with-param>
336 </xsl:call-template>
337 </xsl:when>
338 <xsl:when test="name(..)='sect2'">
339 <xsl:call-template name="title-wrapper">
340 <xsl:with-param name="texcmd">\subsection</xsl:with-param>
341 </xsl:call-template>
342 </xsl:when>
343 <xsl:when test="parent::sect3[@role='not-in-toc'] or parent::refsect2 or (parent::section and count(ancestor::section) = 3)">
344 <xsl:call-template name="title-wrapper">
345 <xsl:with-param name="texcmd">\subsubsection*</xsl:with-param>
346 </xsl:call-template>
347 </xsl:when>
348 <xsl:when test="name(..)='sect3'">
349 <xsl:call-template name="title-wrapper">
350 <xsl:with-param name="texcmd">\subsubsection</xsl:with-param>
351 </xsl:call-template>
352 </xsl:when>
353 <xsl:when test="parent::sect4[@role='not-in-toc'] or parent::refsect3 or (parent::section and count(ancestor::section) = 4)">
354 <xsl:call-template name="title-wrapper">
355 <xsl:with-param name="texcmd">\paragraph*</xsl:with-param>
356 </xsl:call-template>
357 </xsl:when>
358 <xsl:when test="name(..)='sect4'">
359 <xsl:call-template name="title-wrapper">
360 <xsl:with-param name="texcmd">\paragraph</xsl:with-param>
361 </xsl:call-template>
362 </xsl:when>
363 <xsl:when test="parent::sect5[@role='not-in-toc'] or parent::refsect4 or (parent::section and count(ancestor::section) = 5)">
364 <xsl:call-template name="title-wrapper">
365 <xsl:with-param name="texcmd">\subparagraph*</xsl:with-param>
366 </xsl:call-template>
367 </xsl:when>
368 <xsl:when test="name(..)='sect5'">
369 <xsl:call-template name="title-wrapper">
370 <xsl:with-param name="texcmd">\subparagraph</xsl:with-param>
371 </xsl:call-template>
372 </xsl:when>
373 <xsl:when test="name(..)='appendix'">
374 <xsl:call-template name="title-wrapper">
375 <xsl:with-param name="texcmd">\chapter</xsl:with-param>
376 </xsl:call-template>
377 </xsl:when>
378 <xsl:when test="name(..)='glossdiv'">
379 <xsl:call-template name="title-wrapper">
380 <xsl:with-param name="texcmd">\section*</xsl:with-param>
381 </xsl:call-template>
382 </xsl:when>
383 </xsl:choose>
384 <xsl:if test="$refid">
385 <xsl:value-of select="concat('&#x0a;\label{', $refid, '}')" />
386 </xsl:if>
387 <xsl:text>&#x0a;</xsl:text>
388 </xsl:template>
389
390 <xsl:template match="edition">
391 <xsl:choose>
392 <xsl:when test="name(..)='bookinfo'">
393 <xsl:text>\newcommand\docbooktitleedition{</xsl:text>
394 <xsl:apply-templates />
395 <xsl:text>}&#x0a;</xsl:text>
396 </xsl:when>
397 </xsl:choose>
398 </xsl:template>
399
400 <xsl:template match="corpauthor">
401 <xsl:choose>
402 <xsl:when test="name(..)='bookinfo'">
403 <xsl:text>\newcommand\docbookcorpauthor{</xsl:text>
404 <xsl:apply-templates />
405 <xsl:text>}&#x0a;</xsl:text>
406 </xsl:when>
407 </xsl:choose>
408 </xsl:template>
409
410 <xsl:template match="address">
411 <xsl:choose>
412 <xsl:when test="name(..)='bookinfo'">
413 <xsl:text>\newcommand\docbookbookinfoaddress{</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="year">
421 <xsl:choose>
422 <xsl:when test="name(..)='copyright'">
423 <xsl:text>\newcommand\docbookbookinfocopyrightyear{</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="holder">
431 <xsl:choose>
432 <xsl:when test="name(..)='copyright'">
433 <xsl:text>\newcommand\docbookbookinfocopyrightholder{</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="firstname">
441 <xsl:choose>
442 <xsl:when test="name(..)='othercredit'">
443 <xsl:text>\newcommand\docbookbookinfoothercreditfirstname{</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="surname">
451 <xsl:choose>
452 <xsl:when test="name(..)='othercredit'">
453 <xsl:text>\newcommand\docbookbookinfoothercreditsurname{</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="contrib">
461 <xsl:choose>
462 <xsl:when test="name(..)='othercredit'">
463 <xsl:text>\newcommand\docbookbookinfoothercreditcontrib{</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="glossary">
471 <xsl:text>&#x0a;&#x0a;\backmatter&#x0a;\chapter{Glossary}&#x0a;</xsl:text>
472 <xsl:apply-templates />
473 </xsl:template>
474
475 <xsl:template match="para">
476 <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or (name(../..)='varlistentry' and position()=1))">
477 <xsl:text>&#x0a;&#x0a;</xsl:text>
478 </xsl:if>
479 <xsl:apply-templates />
480 </xsl:template>
481
482 <xsl:template match="note">
483 <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, ':} ')" />
484 <xsl:apply-templates />
485 <xsl:text>\end{minipage}}\end{center}&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;</xsl:text>
486 </xsl:template>
487
488 <xsl:template match="warning">
489 <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, ':} ')" />
490 <xsl:apply-templates />
491 <xsl:text>\end{minipage}}\end{center}&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;</xsl:text>
492 </xsl:template>
493
494 <xsl:template match="screen">
495 <xsl:text>&#x0a;&#x0a;\begin{Verbatim}[fontsize=\footnotesize]&#x0a;</xsl:text>
496 <xsl:apply-templates />
497 <xsl:text>&#x0a;\end{Verbatim}&#x0a;</xsl:text>
498 </xsl:template>
499
500 <xsl:template match="programlisting">
501 <xsl:text>&#x0a;&#x0a;{\small\begin{alltt}&#x0a;</xsl:text>
502 <xsl:apply-templates />
503 <xsl:text>&#x0a;\end{alltt}}&#x0a;</xsl:text>
504 </xsl:template>
505
506 <xsl:template match="footnote">
507 <xsl:text>\footnote{</xsl:text>
508 <xsl:apply-templates />
509 <xsl:text>}</xsl:text>
510 </xsl:template>
511
512 <xsl:template match="tgroup">
513 <xsl:choose>
514 <xsl:when test="@style='verywide'">
515 <xsl:text>&#x0a;&#x0a;{\small\begin{center}&#x0a;\begin{tabulary}{1.1\textwidth}[]</xsl:text>
516 </xsl:when>
517 <xsl:otherwise>
518 <xsl:text>&#x0a;&#x0a;{\small\begin{center}&#x0a;\begin{tabulary}{.9\textwidth}[]</xsl:text>
519 </xsl:otherwise>
520 </xsl:choose>
521 <xsl:text>{</xsl:text>
522 <xsl:choose>
523 <xsl:when test="@cols='1'">
524 <xsl:text>|L|</xsl:text>
525 </xsl:when>
526 <xsl:when test="@cols='2'">
527 <xsl:text>|L|L|</xsl:text>
528 </xsl:when>
529 <xsl:when test="@cols='3'">
530 <xsl:text>|L|L|L|</xsl:text>
531 </xsl:when>
532 <xsl:when test="@cols='4'">
533 <xsl:text>|L|L|L|L|</xsl:text>
534 </xsl:when>
535 <xsl:when test="@cols='5'">
536 <xsl:text>|L|L|L|L|L|</xsl:text>
537 </xsl:when>
538 <xsl:when test="@cols='6'">
539 <xsl:text>|L|L|L|L|L|L|</xsl:text>
540 </xsl:when>
541 <xsl:otherwise>
542 <xsl:message terminate="yes">Unsupported number of columns (<xsl:value-of select="@cols"/>), fix document or converter</xsl:message>
543 </xsl:otherwise>
544 </xsl:choose>
545 <xsl:text>}&#x0a;\hline&#x0a;</xsl:text>
546 <xsl:apply-templates />
547 <xsl:text>&#x0a;\end{tabulary}&#x0a;\end{center}}&#x0a;</xsl:text>
548 </xsl:template>
549
550 <xsl:template match="row">
551 <xsl:apply-templates />
552 <xsl:text>&#x0a;\\ \hline&#x0a;</xsl:text>
553 </xsl:template>
554
555 <xsl:template match="entry">
556 <xsl:if test="not(position()=1)">
557 <xsl:text> &amp; </xsl:text>
558 </xsl:if>
559 <xsl:apply-templates />
560 </xsl:template>
561
562 <xsl:template match="itemizedlist">
563 <xsl:call-template name="xsltprocNewlineOutputHack"/>
564 <xsl:text>&#x0a;\begin{itemize}&#x0a;</xsl:text>
565 <xsl:if test="@spacing = 'compact'">
566 <xsl:text> \setlength{\parskip}{0pt}&#x0a;</xsl:text>
567 <xsl:text> \setlength{\itemsep}{0pt}&#x0a;</xsl:text>
568 <xsl:text> \setlength{\topsep}{0pt}&#x0a;</xsl:text>
569 <xsl:text> \setlength{\parsep}{0pt}&#x0a;</xsl:text>
570 <xsl:text> \setlength{\partopsep}{0pt}&#x0a;</xsl:text>
571 </xsl:if>
572 <xsl:apply-templates />
573 <xsl:text>&#x0a;\end{itemize}&#x0a;</xsl:text>
574 </xsl:template>
575
576 <xsl:template match="orderedlist">
577 <xsl:call-template name="xsltprocNewlineOutputHack"/>
578 <xsl:text>&#x0a;\begin{enumerate}&#x0a;</xsl:text>
579 <xsl:if test="@spacing = 'compact'">
580 <xsl:text> \setlength{\parskip}{0pt}&#x0a;</xsl:text>
581 <xsl:text> \setlength{\itemsep}{0pt}&#x0a;</xsl:text>
582 <xsl:text> \setlength{\topsep}{0pt}&#x0a;</xsl:text>
583 <xsl:text> \setlength{\parsep}{0pt}&#x0a;</xsl:text>
584 <xsl:text> \setlength{\partopsep}{0pt}&#x0a;</xsl:text>
585 </xsl:if>
586 <xsl:apply-templates />
587 <xsl:text>&#x0a;\end{enumerate}&#x0a;</xsl:text>
588 </xsl:template>
589
590 <xsl:template match="variablelist">
591 <xsl:call-template name="xsltprocNewlineOutputHack"/>
592 <xsl:text>&#x0a;\begin{description}&#x0a;</xsl:text>
593 <xsl:if test="@spacing = 'compact'">
594 <xsl:text> \setlength{\parskip}{0pt}&#x0a;</xsl:text>
595 <xsl:text> \setlength{\itemsep}{0pt}&#x0a;</xsl:text>
596 <xsl:text> \setlength{\topsep}{0pt}&#x0a;</xsl:text>
597 <xsl:text> \setlength{\parsep}{0pt}&#x0a;</xsl:text>
598 <xsl:text> \setlength{\partopsep}{0pt}&#x0a;</xsl:text>
599 </xsl:if>
600 <xsl:apply-templates />
601 <xsl:text>&#x0a;\end{description}&#x0a;</xsl:text>
602 </xsl:template>
603
604 <xsl:template match="varlistentry">
605 <xsl:if test="not(./term) or not(./listitem) or count(./listitem) != 1">
606 <xsl:message terminate="yes">Expected at least one term and one listitem element in the varlistentry.</xsl:message>
607 </xsl:if>
608 <xsl:text>&#x0a;&#x0a;\item[{\parbox[t]{\linewidth}{\raggedright </xsl:text>
609 <xsl:apply-templates select="./term[1]"/>
610 <xsl:for-each select="./term[position() > 1]">
611 <xsl:text>\\&#x0a; </xsl:text>
612 <xsl:apply-templates select="."/>
613 </xsl:for-each>
614 <xsl:text>}}] \hfill \\&#x0a;</xsl:text>
615 <xsl:apply-templates select="listitem/*"/>
616 </xsl:template>
617
618 <xsl:template match="listitem">
619 <xsl:text>&#x0a;&#x0a;\item </xsl:text>
620 <xsl:apply-templates />
621 <xsl:text>&#x0a;</xsl:text>
622 </xsl:template>
623
624 <xsl:template match="glossterm">
625 <xsl:variable name="refid" select="(@id)" />
626 <xsl:if test="$refid">
627 <xsl:value-of select="concat('&#x0a;\label{', $refid, '}')" />
628 </xsl:if>
629 <xsl:text>&#x0a;&#x0a;\item[</xsl:text>
630 <xsl:apply-templates />
631 <xsl:text>]</xsl:text>
632 </xsl:template>
633
634 <xsl:template match="glosslist | glossdiv">
635 <xsl:text>&#x0a;&#x0a;\begin{description}&#x0a;</xsl:text>
636 <xsl:apply-templates />
637 <xsl:text>&#x0a;\end{description}&#x0a;</xsl:text>
638 </xsl:template>
639
640 <xsl:template match="superscript">
641 <xsl:variable name="contents">
642 <xsl:apply-templates />
643 </xsl:variable>
644 <xsl:value-of select="concat('\texorpdfstring{\textsuperscript{', $contents, '}}{', $contents, '}')" />
645 </xsl:template>
646
647 <xsl:template match="emphasis">
648 <xsl:choose>
649 <xsl:when test="@role='bold'">
650 <xsl:text>\textbf{</xsl:text>
651 </xsl:when>
652 <xsl:otherwise>
653 <xsl:text>\textit{</xsl:text>
654 </xsl:otherwise>
655 </xsl:choose>
656 <xsl:apply-templates />
657 <xsl:text>}</xsl:text>
658 </xsl:template>
659
660 <xsl:template match="computeroutput | code">
661 <xsl:text>\texttt{</xsl:text>
662 <xsl:apply-templates />
663 <xsl:text>}</xsl:text>
664 </xsl:template>
665
666 <xsl:template match="ulink">
667 <xsl:text>\url{</xsl:text>
668 <xsl:apply-templates />
669 <xsl:text>}</xsl:text>
670 </xsl:template>
671
672 <xsl:template match="xref">
673 <xsl:choose>
674 <xsl:when test="@endterm">
675 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
676 </xsl:when>
677 <xsl:otherwise>
678 <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
679 </xsl:otherwise>
680 </xsl:choose>
681 </xsl:template>
682
683 <xsl:template match="link">
684 <xsl:choose>
685 <xsl:when test="@endterm">
686 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
687 </xsl:when>
688 <xsl:when test="./text()">
689 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{')" />
690 <xsl:apply-templates select="./text()"/>
691 <xsl:value-of select="'}}'" />
692 </xsl:when>
693 <xsl:otherwise>
694 <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
695 </xsl:otherwise>
696 </xsl:choose>
697 </xsl:template>
698
699 <xsl:template match="trademark">
700 <xsl:apply-templates />
701 <xsl:text>\textsuperscript{\textregistered}</xsl:text>
702 </xsl:template>
703
704 <!-- for some reason, DocBook insists of having image data nested this way always:
705 mediaobject -> imageobject -> imagedata
706 but only imagedata is interesting -->
707 <xsl:template match="imagedata">
708 <xsl:if test="@align='center'">
709 <xsl:text>\begin{center}</xsl:text>
710 </xsl:if>
711 <xsl:value-of select="concat('&#x0a;\includegraphics[width=', @width, ']{', @fileref, '}&#x0a;')" />
712 <xsl:apply-templates />
713 <xsl:if test="@align='center'">
714 <xsl:text>\end{center}</xsl:text>
715 </xsl:if>
716 </xsl:template>
717
718 <!--
719 Turn the refsynopsisdiv part of a manpage into a named & indented paragraph.
720 -->
721 <xsl:template match="refsynopsisdiv">
722 <xsl:if test="name(*[1]) != 'cmdsynopsis'"><xsl:message terminate="yes">Expected refsynopsisdiv to start with cmdsynopsis</xsl:message></xsl:if>
723 <xsl:if test="title"><xsl:message terminate="yes">No title element supported in refsynopsisdiv</xsl:message></xsl:if>
724 <xsl:call-template name="xsltprocNewlineOutputHack"/>
725 <xsl:text>&#x0a;\subsection*{Synopsis}</xsl:text>
726 <xsl:if test="name(*[1]) != 'cmdsynopsis'"> <!-- just in case -->
727 <xsl:text>\hfill \\&#x0a;</xsl:text>
728 </xsl:if>
729 <xsl:text>&#x0a;</xsl:text>
730 <xsl:apply-templates />
731 </xsl:template>
732
733 <!--
734 The refsect1 is used for 'Description' and such. Do same as with refsynopsisdiv
735 and turn it into a named & indented paragraph.
736 -->
737 <xsl:template match="refsect1">
738 <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
739 <xsl:message terminate="yes">Expected exactly one title as the first refsect1 element (remarks goes after title!).</xsl:message>
740 </xsl:if>
741 <xsl:apply-templates/>
742 </xsl:template>
743
744 <!--
745 The refsect2 element will be turned into a subparagraph if it has a title,
746 however, that didn't work out when it didn't have a title and started with
747 a cmdsynopsis instead (subcommand docs). So, we're doing some trickery
748 here (HACK ALERT) for the non-title case to feign a paragraph.
749 -->
750 <xsl:template match="refsect2">
751 <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
752 <xsl:message terminate="yes">Expected exactly one title as the first refsect2 element (remarks goes after title!).</xsl:message>
753 </xsl:if>
754 <xsl:apply-templates/>
755 <xsl:text>&#x0a;</xsl:text>
756 </xsl:template>
757
758
759 <!--
760 Command Synopsis elements.
761
762 We treat each command element inside a cmdsynopsis as the start of
763 a new paragraph. The DocBook HTML converter does so too, but the
764 manpage one doesn't.
765
766 sbr and linebreaks made by latex should be indented from the base
767 command level. This is done by the \hangindent3em\hangafter1 bits.
768
769 We exploit the default paragraph indentation to get each command
770 indented from the left margin. This, unfortunately, doesn't work
771 if we're the first paragraph in a (sub*)section. \noindent cannot
772 counter this due to when latex enforces first paragraph stuff. Since
773 it's tedious to figure out when we're in the first paragraph and when
774 not, we just do \noindent\hspace{1em} everywhere.
775 -->
776 <xsl:template match="sbr">
777 <xsl:if test="not(ancestor::cmdsynopsis)">
778 <xsl:message terminate="yes">sbr only supported inside cmdsynopsis (because of hangindent)</xsl:message>
779 </xsl:if>
780 <xsl:text>\linebreak</xsl:text>
781 </xsl:template>
782
783 <xsl:template match="refentry|refnamediv|refentryinfo|refmeta|refsect3|refsect4|refsect5|synopfragment|synopfragmentref|cmdsynopsis/info">
784 <xsl:message terminate="yes"><xsl:value-of select="name()"/> is not supported</xsl:message>
785 </xsl:template>
786
787 <xsl:template match="cmdsynopsis">
788 <xsl:if test="preceding-sibling::cmdsynopsis">
789 <xsl:text>\par%cmdsynopsis</xsl:text>
790 </xsl:if>
791 <xsl:text>&#x0a;</xsl:text>
792 <xsl:if test="parent::remark[@role='VBoxManage-overview']">
793 <!-- Overview fontsize trick -->
794 <xsl:text>{\footnotesize</xsl:text>
795 </xsl:if>
796 <xsl:text>\noindent\hspace{1em}</xsl:text>
797 <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
798 <xsl:apply-templates />
799 <xsl:text>}</xsl:text>
800 <xsl:if test="following-sibling::*">
801 </xsl:if>
802
803 <!-- For refsect2 subcommand descriptions. -->
804 <xsl:if test="not(following-sibling::cmdsynopsis) and position() != last()">
805 <xsl:text>\linebreak</xsl:text>
806 </xsl:if>
807 <!-- Special overview trick for the current VBoxManage command overview. -->
808 <xsl:if test="parent::remark[@role='VBoxManage-overview']">
809 <xsl:text>}\vspace{1em}</xsl:text>
810 </xsl:if>
811 </xsl:template>
812
813 <xsl:template match="command">
814 <xsl:choose>
815 <xsl:when test="ancestor::cmdsynopsis">
816 <!-- Trigger a line break if this isn't the first command in a the synopsis -->
817 <xsl:if test="preceding-sibling::command">
818 <xsl:text>}\par%command&#x0a;</xsl:text>
819 <xsl:text>\noindent\hspace{1em}</xsl:text>
820 <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
821 </xsl:if>
822 <xsl:apply-templates />
823 </xsl:when>
824 <xsl:otherwise>
825 <xsl:text>\texttt{</xsl:text>
826 <xsl:apply-templates />
827 <xsl:text>}</xsl:text>
828 </xsl:otherwise>
829 </xsl:choose>
830 </xsl:template>
831
832 <xsl:template match="option">
833 <xsl:choose>
834 <xsl:when test="ancestor::cmdsynopsis">
835 <xsl:apply-templates />
836 </xsl:when>
837 <xsl:otherwise>
838 <xsl:text>\texttt{</xsl:text>
839 <xsl:apply-templates />
840 <xsl:text>}</xsl:text>
841 </xsl:otherwise>
842 </xsl:choose>
843 </xsl:template>
844
845 <!-- duplicated in docbook2latex.xsl -->
846 <xsl:template match="arg|group">
847 <!-- separator char if we're not the first child -->
848 <xsl:if test="position() > 1">
849 <xsl:choose>
850 <xsl:when test="parent::group"><xsl:value-of select="$arg.or.sep"/></xsl:when>
851 <xsl:when test="ancestor-or-self::*/@sepchar"><xsl:value-of select="ancestor-or-self::*/@sepchar"/></xsl:when>
852 <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
853 </xsl:choose>
854 </xsl:if>
855 <!-- open wrapping -->
856 <xsl:choose>
857 <xsl:when test="not(@choice) or @choice = ''"> <xsl:value-of select="$arg.choice.def.open.str"/></xsl:when>
858 <xsl:when test="@choice = 'opt'"> <xsl:value-of select="$arg.choice.opt.open.str"/></xsl:when>
859 <xsl:when test="@choice = 'req'"> <xsl:value-of select="$arg.choice.req.open.str"/></xsl:when>
860 <xsl:when test="@choice = 'plain'"/>
861 <xsl:otherwise><xsl:message terminate="yes">Invalid arg choice: "<xsl:value-of select="@choice"/>"</xsl:message></xsl:otherwise>
862 </xsl:choose>
863
864 <!-- render the arg (TODO: may need to do more work here) -->
865 <xsl:apply-templates />
866
867 <!-- repeat wrapping -->
868 <xsl:choose>
869 <xsl:when test="@rep = 'norepeat' or not(@rep) or @rep = ''"/>
870 <xsl:when test="@rep = 'repeat'"> <xsl:value-of select="$arg.rep.repeat.str"/></xsl:when>
871 <xsl:otherwise><xsl:message terminate="yes">Invalid rep choice: "<xsl:value-of select="@rep"/>"</xsl:message></xsl:otherwise>
872 </xsl:choose>
873 <!-- close wrapping -->
874 <xsl:choose>
875 <xsl:when test="not(@choice) or @choice = ''"> <xsl:value-of select="$arg.choice.def.close.str"/></xsl:when>
876 <xsl:when test="@choice = 'opt'"> <xsl:value-of select="$arg.choice.opt.close.str"/></xsl:when>
877 <xsl:when test="@choice = 'req'"> <xsl:value-of select="$arg.choice.req.close.str"/></xsl:when>
878 </xsl:choose>
879 </xsl:template>
880
881 <xsl:template match="replaceable">
882 <xsl:choose>
883 <xsl:when test="not(ancestor::cmdsynopsis) or ancestor::arg">
884 <xsl:text>\texttt{\textit{</xsl:text>
885 <xsl:apply-templates />
886 <xsl:text>}}</xsl:text>
887 </xsl:when>
888 <xsl:otherwise>
889 <xsl:text>\textit{&lt;</xsl:text>
890 <xsl:apply-templates />
891 <xsl:text>&gt;}</xsl:text>
892 </xsl:otherwise>
893 </xsl:choose>
894 </xsl:template>
895
896
897 <!--
898 Generic element text magic.
899 -->
900 <xsl:template match="//text()">
901
902 <xsl:variable name="subst1">
903 <xsl:call-template name="str:subst">
904 <xsl:with-param name="text" select="." />
905 <xsl:with-param name="replace" select="'\'" />
906 <xsl:with-param name="with" select="'\textbackslash{}'" />
907 <xsl:with-param name="disable-output-escaping" select="no" />
908 </xsl:call-template>
909 </xsl:variable>
910
911 <xsl:choose>
912 <xsl:when test="(name(..)='screen') or (name(../..)='screen')">
913 <xsl:value-of select="." />
914 </xsl:when>
915
916 <xsl:when test="(name(..) = 'computeroutput') or (name(../..) = 'computeroutput')
917 or (name(..) = 'code') or (name(../..) = 'code')
918 or (name(..) = 'arg') or (name(../..) = 'arg')
919 or (name(..) = 'option') or (name(../..) = 'option')
920 or (name(..) = 'command') or (name(../..) = 'command')
921 or (name(..) = 'cmdsynopsis') or (name(../..) = 'cmdsynopsis')
922 or (name(..) = 'replaceable') or (name(../..) = 'replaceable')
923 ">
924 <xsl:variable name="subst2">
925 <xsl:call-template name="str:subst">
926 <xsl:with-param name="text" select="$subst1" />
927 <xsl:with-param name="replace" select="'--'" />
928 <xsl:with-param name="with" select="'-{}-'" />
929 <xsl:with-param name="disable-output-escaping" select="no" />
930 </xsl:call-template>
931 </xsl:variable>
932 <xsl:variable name="subst3">
933 <xsl:call-template name="str:subst">
934 <xsl:with-param name="text" select="$subst2" />
935 <xsl:with-param name="replace" select="'_'" />
936 <xsl:with-param name="with" select="'\_'" />
937 <xsl:with-param name="disable-output-escaping" select="no" />
938 </xsl:call-template>
939 </xsl:variable>
940 <xsl:variable name="subst4">
941 <xsl:call-template name="str:subst">
942 <xsl:with-param name="text" select="$subst3" />
943 <xsl:with-param name="replace" select="'$'" />
944 <xsl:with-param name="with" select="'\$'" />
945 <xsl:with-param name="disable-output-escaping" select="no" />
946 </xsl:call-template>
947 </xsl:variable>
948 <xsl:variable name="subst5">
949 <xsl:call-template name="str:subst">
950 <xsl:with-param name="text" select="$subst4" />
951 <xsl:with-param name="replace" select="'%'" />
952 <xsl:with-param name="with" select="'\%'" />
953 <xsl:with-param name="disable-output-escaping" select="no" />
954 </xsl:call-template>
955 </xsl:variable>
956 <xsl:variable name="subst6">
957 <xsl:call-template name="str:subst">
958 <xsl:with-param name="text" select="$subst5" />
959 <xsl:with-param name="replace" select="'#'" />
960 <xsl:with-param name="with" select="'\#'" />
961 <xsl:with-param name="disable-output-escaping" select="no" />
962 </xsl:call-template>
963 </xsl:variable>
964 <xsl:variable name="subst7">
965 <xsl:call-template name="str:subst">
966 <xsl:with-param name="text" select="$subst6" />
967 <xsl:with-param name="replace" select="'~'" />
968 <xsl:with-param name="with" select="'\textasciitilde '" />
969 <xsl:with-param name="disable-output-escaping" select="no" />
970 </xsl:call-template>
971 </xsl:variable>
972 <xsl:variable name="subst8">
973 <xsl:call-template name="str:subst">
974 <xsl:with-param name="text" select="$subst7" />
975 <xsl:with-param name="replace" select="'&amp;'" />
976 <xsl:with-param name="with" select="'\&amp;'" />
977 <xsl:with-param name="disable-output-escaping" select="no" />
978 </xsl:call-template>
979 </xsl:variable>
980 <xsl:choose>
981 <xsl:when test="parent::arg or parent::command">
982 <xsl:variable name="subst9">
983 <xsl:call-template name="str:subst">
984 <xsl:with-param name="text" select="$subst8" />
985 <xsl:with-param name="replace" select="' '" />
986 <xsl:with-param name="with" select="'~'" />
987 <xsl:with-param name="disable-output-escaping" select="no" />
988 </xsl:call-template>
989 </xsl:variable>
990 <xsl:value-of select="$subst9" />
991 </xsl:when>
992 <xsl:otherwise>
993 <xsl:value-of select="$subst8" />
994 </xsl:otherwise>
995 </xsl:choose>
996 </xsl:when>
997
998 <xsl:when test="(name(..)='address') or (name(../..)='address')">
999 <xsl:variable name="subst2">
1000 <xsl:call-template name="str:subst">
1001 <xsl:with-param name="text" select="$subst1" />
1002 <xsl:with-param name="replace" select="'&#x0a;'" />
1003 <xsl:with-param name="with" select="' \\'" />
1004 <xsl:with-param name="disable-output-escaping" select="no" />
1005 </xsl:call-template>
1006 </xsl:variable>
1007 <xsl:value-of select="$subst2" />
1008 </xsl:when>
1009
1010 <xsl:otherwise>
1011 <xsl:variable name="subst2">
1012 <xsl:call-template name="str:subst">
1013 <xsl:with-param name="text" select="$subst1" />
1014 <xsl:with-param name="replace" select="'_'" />
1015 <xsl:with-param name="with" select="'\_'" />
1016 <xsl:with-param name="disable-output-escaping" select="no" />
1017 </xsl:call-template>
1018 </xsl:variable>
1019 <xsl:variable name="subst3">
1020 <xsl:call-template name="str:subst">
1021 <xsl:with-param name="text" select="$subst2" />
1022 <xsl:with-param name="replace" select="'$'" />
1023 <xsl:with-param name="with" select="'\$'" />
1024 <xsl:with-param name="disable-output-escaping" select="no" />
1025 </xsl:call-template>
1026 </xsl:variable>
1027 <xsl:variable name="subst4">
1028 <xsl:call-template name="str:subst">
1029 <xsl:with-param name="text" select="$subst3" />
1030 <xsl:with-param name="replace" select="'%'" />
1031 <xsl:with-param name="with" select="'\%'" />
1032 <xsl:with-param name="disable-output-escaping" select="no" />
1033 </xsl:call-template>
1034 </xsl:variable>
1035 <xsl:variable name="subst5">
1036 <xsl:call-template name="str:subst">
1037 <xsl:with-param name="text" select="$subst4" />
1038 <xsl:with-param name="replace" select="'#'" />
1039 <xsl:with-param name="with" select="'\#'" />
1040 <xsl:with-param name="disable-output-escaping" select="no" />
1041 </xsl:call-template>
1042 </xsl:variable>
1043 <xsl:variable name="subst6">
1044 <xsl:call-template name="str:subst">
1045 <xsl:with-param name="text" select="$subst5" />
1046 <xsl:with-param name="replace" select="'µ'" />
1047 <xsl:with-param name="with" select="'$\mu$'" />
1048 <xsl:with-param name="disable-output-escaping" select="no" />
1049 </xsl:call-template>
1050 </xsl:variable>
1051 <xsl:variable name="subst7">
1052 <xsl:call-template name="str:subst">
1053 <xsl:with-param name="text" select="$subst6" />
1054 <xsl:with-param name="replace" select="'®'" />
1055 <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
1056 <xsl:with-param name="disable-output-escaping" select="no" />
1057 </xsl:call-template>
1058 </xsl:variable>
1059 <xsl:variable name="quote">"</xsl:variable>
1060 <!-- preparation for pretty quotes: replace all double quotes _outside_ screen
1061 sections with "\QUOTE{}" strings, which the makefile will then replace
1062 with pretty quotes by invoking sed a few times. Unfortunately there are
1063 no regular expressions in XSLT so there's no other way. -->
1064 <xsl:variable name="subst8">
1065 <xsl:call-template name="str:subst">
1066 <xsl:with-param name="text" select="$subst7" />
1067 <xsl:with-param name="replace" select="$quote" />
1068 <xsl:with-param name="with" select="'\QUOTE{}'" />
1069 <xsl:with-param name="disable-output-escaping" select="no" />
1070 </xsl:call-template>
1071 </xsl:variable>
1072 <xsl:variable name="subst9">
1073 <xsl:call-template name="str:subst">
1074 <xsl:with-param name="text" select="$subst8" />
1075 <xsl:with-param name="replace" select="'~'" />
1076 <xsl:with-param name="with" select="'\textasciitilde '" />
1077 <xsl:with-param name="disable-output-escaping" select="no" />
1078 </xsl:call-template>
1079 </xsl:variable>
1080 <xsl:variable name="subst10">
1081 <xsl:call-template name="str:subst">
1082 <xsl:with-param name="text" select="$subst9" />
1083 <xsl:with-param name="replace" select="'&amp;'" />
1084 <xsl:with-param name="with" select="'\&amp;'" />
1085 <xsl:with-param name="disable-output-escaping" select="no" />
1086 </xsl:call-template>
1087 </xsl:variable>
1088 <xsl:value-of select="$subst10" />
1089 </xsl:otherwise>
1090 </xsl:choose>
1091 </xsl:template>
1092
1093 <!--
1094 xsltprocNewlineOutputHack - emits a single new line.
1095
1096 Hack Alert! This template helps xsltproc split up the output text elements
1097 and avoid reallocating them into the MB range. Calls to this
1098 template is made occationally while generating larger output
1099 file. It's not necessary for small stuff like header.
1100
1101 The trick we're playing on xsltproc has to do with CDATA
1102 and/or the escape setting of the xsl:text element. It forces
1103 xsltproc to allocate a new output element, thus preventing
1104 things from growing out of proportions and slowing us down.
1105
1106 This was successfully employed to reduce a 18+ seconds run to
1107 around one second (possibly less due to kmk overhead).
1108 -->
1109 <xsl:template name="xsltprocNewlineOutputHack">
1110 <xsl:text disable-output-escaping="yes"><![CDATA[
1111]]></xsl:text>
1112 </xsl:template>
1113
1114</xsl:stylesheet>
1115
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