VirtualBox

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

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

manual: integrate drop #30 with minimal manual adjustments (but everything into one book, with manually applied tweaks to turn the release notes into a pure changelog again and manually re-applied the last changelog change since it wasn't included yet)

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