VirtualBox

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

Last change on this file since 38443 was 37524, checked in by vboxsync, 13 years ago

doc/manual/docbook2latex: fix typo which led to incorrect quote handling in <cod
e> tags.

File size: 24.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-2010 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
41 <xsl:variable name="g_nlsChapter">
42 <xsl:choose>
43 <xsl:when test="$TARGETLANG='de_DE'">Kapitel</xsl:when>
44 <xsl:when test="$TARGETLANG='fr_FR'">chapitre</xsl:when>
45 <xsl:when test="$TARGETLANG='en_US'">chapter</xsl:when>
46 <xsl:otherwise>
47 <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
48 </xsl:otherwise>
49 </xsl:choose>
50 </xsl:variable>
51
52 <xsl:variable name="g_nlsPage">
53 <xsl:choose>
54 <xsl:when test="$TARGETLANG='de_DE'">auf Seite</xsl:when>
55 <xsl:when test="$TARGETLANG='fr_FR'">page</xsl:when>
56 <xsl:when test="$TARGETLANG='en_US'">page</xsl:when>
57 <xsl:otherwise>
58 <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
59 </xsl:otherwise>
60 </xsl:choose>
61 </xsl:variable>
62
63 <xsl:variable name="g_nlsNote">
64 <xsl:choose>
65 <xsl:when test="$TARGETLANG='de_DE'">Hinweis</xsl:when>
66 <xsl:when test="$TARGETLANG='fr_FR'">Note</xsl:when>
67 <xsl:when test="$TARGETLANG='en_US'">Note</xsl:when>
68 <xsl:otherwise>
69 <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
70 </xsl:otherwise>
71 </xsl:choose>
72 </xsl:variable>
73
74 <xsl:variable name="g_nlsWarning">
75 <xsl:choose>
76 <xsl:when test="$TARGETLANG='de_DE'">Warnung</xsl:when>
77 <xsl:when test="$TARGETLANG='fr_FR'">Avertissement</xsl:when>
78 <xsl:when test="$TARGETLANG='en_US'">Warning</xsl:when>
79 <xsl:otherwise>
80 <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
81 </xsl:otherwise>
82 </xsl:choose>
83 </xsl:variable>
84
85 <xsl:output method="text"/>
86
87 <xsl:strip-space elements="*"/>
88
89 <xsl:template match="/book">
90 <xsl:text>
91\documentclass[oneside,a4paper,10pt,DIV10]{scrbook}
92\usepackage{geometry}
93\geometry{top=3cm,bottom=4cm}
94\usepackage{ucs}
95\usepackage[utf8x]{inputenc}
96\usepackage[T1]{fontenc}
97\usepackage{tabulary}
98\usepackage[pdftex,
99 a4paper,
100 colorlinks=true,
101 linkcolor=blue,
102 bookmarksnumbered,
103 bookmarksopen=true,
104 bookmarksopenlevel=0,
105 hyperfootnotes=false,
106 plainpages=false,
107 pdfpagelabels
108 ]{hyperref}
109
110\usepackage{nameref}
111\usepackage{graphicx}
112\usepackage{fancybox}
113\usepackage{fancyvrb}
114\usepackage{alltt}
115\usepackage{color}
116
117</xsl:text>
118 <xsl:if test="$TARGETLANG='de_DE'">\usepackage[ngerman]{babel}&#10;\PrerenderUnicode{ü}</xsl:if>
119<!-- <xsl:if test="$TARGETLANG='fr_FR'">\usepackage[french]{babel}&#10;\FrenchItemizeSpacingfalse&#10;\renewcommand{\FrenchLabelItem}{\textbullet}</xsl:if>
120 this command is no longer understood by TexLive2008
121 -->
122 <xsl:text>
123
124% use Palatino as serif font:
125% \usepackage{mathpazo}
126\usepackage{charter}
127% use Helvetica as sans-serif font:
128\usepackage{helvet}
129
130% use Bera Mono (a variant of Bitstream Vera Mono) as typewriter font
131% (requires texlive-fontsextra)
132\usepackage[scaled]{beramono}
133% previously: use Courier as typewriter font:
134% \usepackage{courier}
135
136\definecolor{colNote}{rgb}{0,0,0}
137\definecolor{colWarning}{rgb}{0,0,0}
138\definecolor{colScreenFrame}{rgb}{0,0,0}
139\definecolor{colScreenText}{rgb}{0,0,0}
140
141% number headings down to this level
142\setcounter{secnumdepth}{3}
143% more space for the section numbers
144\makeatletter
145\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.9em}}
146\renewcommand*\l@subsection{\@dottedtocline{2}{4.4em}{3.8em}}
147\renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{3.8em}}
148\renewcommand*\@pnumwidth{1.7em}
149\renewcommand*\@tocrmarg{5.0em}
150\makeatother
151
152% more tolerance at 2nd wrap stage:
153\tolerance = 1000
154% allow 3rd wrap stage:
155\emergencystretch = 10pt
156% no Schusterjungen:
157\clubpenalty = 10000
158% no Hurenkinder:
159\widowpenalty = 10000
160\displaywidowpenalty = 10000
161% max pdf compression:
162\pdfcompresslevel9
163
164% opening and closing quotes: the OQ and CQ macros define this (and the makefile employs some sed magic also)
165</xsl:text>
166 <xsl:choose>
167 <xsl:when test="$TARGETLANG='de_DE'">
168 <xsl:text>\newcommand\OQ{\texorpdfstring{\glqq}{"}}&#10;\newcommand\CQ{\texorpdfstring{\grqq}{"}}&#10;</xsl:text>
169 </xsl:when>
170 <xsl:when test="$TARGETLANG='fr_FR'">
171 <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}}&#10;\newcommand\CQ{\texorpdfstring{''}{"}}&#10;</xsl:text>
172 </xsl:when>
173 <xsl:when test="$TARGETLANG='en_US'">
174 <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}}&#10;\newcommand\CQ{\texorpdfstring{''}{"}}&#10;</xsl:text>
175 </xsl:when>
176 <xsl:otherwise>
177 <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
178 </xsl:otherwise>
179 </xsl:choose>
180
181 <xsl:apply-templates />
182
183 <xsl:text>
184\end{document}
185 </xsl:text>
186
187 </xsl:template>
188
189 <xsl:template match="bookinfo">
190 <xsl:apply-templates />
191 <xsl:text>&#x0a;\newcommand\docbookbookinfocopyright{\copyright{} \docbookbookinfocopyrightyear{} \docbookbookinfocopyrightholder{}}&#x0a;
192\author{ \docbooktitleedition \\ %
193\\ %
194</xsl:text>
195 <xsl:if test="//bookinfo/address">
196 <xsl:text>\docbookbookinfoaddress \\ %
197\\ %
198</xsl:text>
199 </xsl:if>
200 <xsl:text>\docbookbookinfocopyright \\ %
201}
202
203\title{\docbooktitle \\
204\docbooksubtitle}
205% \subtitle{\docbooksubtitle}
206\hypersetup{pdfauthor=\docbookcorpauthor}
207\hypersetup{pdftitle=\docbooktitle{} \docbooksubtitle{}}
208
209\hyphenation{da-ta-ba-ses}
210\hyphenation{deb-conf}
211\hyphenation{VirtualBox}
212
213\begin{document}
214% \maketitle
215%\begin{titlepage}
216\thispagestyle{empty}
217\begin{minipage}{\textwidth}
218\begin{center}
219\includegraphics[width=4cm]{images/vboxlogo.png}
220\end{center}%
221\vspace{10mm}
222
223{\fontsize{40pt}{40pt}\selectfont\rmfamily\bfseries%
224\begin{center}
225\docbooktitle
226\end{center}%
227\vspace{10mm}
228}
229
230{\fontsize{30pt}{30pt}\selectfont\rmfamily\bfseries%
231\begin{center}
232\docbooksubtitle
233\end{center}%
234\vspace{10mm}
235}
236
237{\fontsize{16pt}{20pt}\selectfont\rmfamily%
238\begin{center}
239\docbooktitleedition
240
241\vspace{2mm}
242
243\docbookbookinfocopyright
244
245\vspace{2mm}
246
247\docbookbookinfoaddress
248\end{center}%
249}
250
251%\end{titlepage}
252\end{minipage}
253
254\tableofcontents
255 </xsl:text>
256 </xsl:template>
257
258 <xsl:template match="subtitle">
259 <xsl:choose>
260 <xsl:when test="name(..)='bookinfo'">
261 <xsl:text>\newcommand\docbooksubtitle{</xsl:text>
262 <xsl:apply-templates />
263 <xsl:text>}</xsl:text>
264 </xsl:when>
265 </xsl:choose>
266 </xsl:template>
267
268 <xsl:template match="title">
269 <xsl:choose>
270 <xsl:when test="name(..)='bookinfo'">
271 <xsl:text>\newcommand\docbooktitle{</xsl:text>
272 <xsl:apply-templates />
273 <xsl:text>}</xsl:text>
274 </xsl:when>
275 <xsl:when test="name(..)='chapter'">
276 <xsl:text>&#x0a;&#x0a;\chapter{</xsl:text>
277 <xsl:apply-templates />
278 <xsl:text>}</xsl:text>
279 </xsl:when>
280 <xsl:when test="name(..)='sect1'">
281 <xsl:text>&#x0a;&#x0a;\section{</xsl:text>
282 <xsl:apply-templates />
283 <xsl:text>}</xsl:text>
284 </xsl:when>
285 <xsl:when test="name(..)='sect2'">
286 <xsl:text>&#x0a;&#x0a;\subsection{</xsl:text>
287 <xsl:apply-templates />
288 <xsl:text>}</xsl:text>
289 </xsl:when>
290 <xsl:when test="name(..)='sect3'">
291 <xsl:text>&#x0a;&#x0a;\subsubsection{</xsl:text>
292 <xsl:apply-templates />
293 <xsl:text>}</xsl:text>
294 </xsl:when>
295 <xsl:when test="name(..)='sect4'">
296 <xsl:text>&#x0a;&#x0a;\paragraph{</xsl:text>
297 <xsl:apply-templates />
298 <xsl:text>}</xsl:text>
299 </xsl:when>
300 <xsl:when test="name(..)='sect5'">
301 <xsl:text>&#x0a;&#x0a;\subparagraph{</xsl:text>
302 <xsl:apply-templates />
303 <xsl:text>}</xsl:text>
304 </xsl:when>
305 <xsl:when test="name(..)='appendix'">
306 <xsl:text>&#x0a;&#x0a;\chapter{</xsl:text>
307 <xsl:apply-templates />
308 <xsl:text>}</xsl:text>
309 </xsl:when>
310 <xsl:when test="name(..)='glossdiv'">
311 <xsl:text>&#x0a;&#x0a;\section*{</xsl:text>
312 <xsl:apply-templates />
313 <xsl:text>}</xsl:text>
314 </xsl:when>
315 </xsl:choose>
316 <xsl:variable name="refid" select="(@id) | (../@id)" />
317 <xsl:if test="$refid">
318 <xsl:value-of select="concat('&#x0a;\label{', $refid, '}')" />
319 </xsl:if>
320 <xsl:text>&#x0a;</xsl:text>
321 </xsl:template>
322
323 <xsl:template match="edition">
324 <xsl:choose>
325 <xsl:when test="name(..)='bookinfo'">
326 <xsl:text>\newcommand\docbooktitleedition{</xsl:text>
327 <xsl:apply-templates />
328 <xsl:text>}&#x0a;</xsl:text>
329 </xsl:when>
330 </xsl:choose>
331 </xsl:template>
332
333 <xsl:template match="corpauthor">
334 <xsl:choose>
335 <xsl:when test="name(..)='bookinfo'">
336 <xsl:text>\newcommand\docbookcorpauthor{</xsl:text>
337 <xsl:apply-templates />
338 <xsl:text>}&#x0a;</xsl:text>
339 </xsl:when>
340 </xsl:choose>
341 </xsl:template>
342
343 <xsl:template match="address">
344 <xsl:choose>
345 <xsl:when test="name(..)='bookinfo'">
346 <xsl:text>\newcommand\docbookbookinfoaddress{</xsl:text>
347 <xsl:apply-templates />
348 <xsl:text>}&#x0a;</xsl:text>
349 </xsl:when>
350 </xsl:choose>
351 </xsl:template>
352
353 <xsl:template match="year">
354 <xsl:choose>
355 <xsl:when test="name(..)='copyright'">
356 <xsl:text>\newcommand\docbookbookinfocopyrightyear{</xsl:text>
357 <xsl:apply-templates />
358 <xsl:text>}&#x0a;</xsl:text>
359 </xsl:when>
360 </xsl:choose>
361 </xsl:template>
362
363 <xsl:template match="holder">
364 <xsl:choose>
365 <xsl:when test="name(..)='copyright'">
366 <xsl:text>\newcommand\docbookbookinfocopyrightholder{</xsl:text>
367 <xsl:apply-templates />
368 <xsl:text>}&#x0a;</xsl:text>
369 </xsl:when>
370 </xsl:choose>
371 </xsl:template>
372
373 <xsl:template match="glossary">
374 <xsl:text>&#x0a;&#x0a;\backmatter&#x0a;\chapter{Glossary}&#x0a;</xsl:text>
375 <xsl:apply-templates />
376 </xsl:template>
377
378 <xsl:template match="para">
379 <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning')">
380 <xsl:text>&#x0a;&#x0a;</xsl:text>
381 </xsl:if>
382 <xsl:apply-templates />
383 </xsl:template>
384
385 <xsl:template match="note">
386 <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, ':} ')" />
387 <xsl:apply-templates />
388 <xsl:text>\end{minipage}}\end{center}&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;</xsl:text>
389 </xsl:template>
390
391 <xsl:template match="warning">
392 <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, ':} ')" />
393 <xsl:apply-templates />
394 <xsl:text>\end{minipage}}\end{center}&#x0a;&#x0a;\vspace{.2cm}&#x0a;&#x0a;</xsl:text>
395 </xsl:template>
396
397 <xsl:template match="screen">
398 <xsl:text>&#x0a;&#x0a;\begin{Verbatim}[fontsize=\footnotesize]&#x0a;</xsl:text>
399 <xsl:apply-templates />
400 <xsl:text>&#x0a;\end{Verbatim}&#x0a;</xsl:text>
401 </xsl:template>
402
403 <xsl:template match="programlisting">
404 <xsl:text>&#x0a;&#x0a;{\small\begin{alltt}&#x0a;</xsl:text>
405 <xsl:apply-templates />
406 <xsl:text>&#x0a;\end{alltt}}&#x0a;</xsl:text>
407 </xsl:template>
408
409 <xsl:template match="footnote">
410 <xsl:text>\footnote{</xsl:text>
411 <xsl:apply-templates />
412 <xsl:text>}</xsl:text>
413 </xsl:template>
414
415 <xsl:template match="tgroup">
416 <xsl:text>&#x0a;&#x0a;{\small\begin{center}&#x0a;\begin{tabulary}{.9\textwidth}[]{|L|L|L|}&#x0a;\hline&#x0a;</xsl:text>
417 <xsl:apply-templates />
418 <xsl:text>&#x0a;\end{tabulary}&#x0a;\end{center}}&#x0a;</xsl:text>
419 </xsl:template>
420
421 <xsl:template match="row">
422 <xsl:apply-templates />
423 <xsl:text>&#x0a;\\ \hline&#x0a;</xsl:text>
424 </xsl:template>
425
426 <xsl:template match="entry">
427 <xsl:if test="not(position()=1)">
428 <xsl:text> &amp; </xsl:text>
429 </xsl:if>
430 <xsl:apply-templates />
431 </xsl:template>
432
433 <xsl:template match="itemizedlist">
434 <xsl:text>&#x0a;&#x0a;\begin{itemize}&#x0a;</xsl:text>
435 <xsl:apply-templates />
436 <xsl:text>&#x0a;\end{itemize}&#x0a;</xsl:text>
437 </xsl:template>
438
439 <xsl:template match="orderedlist">
440 <xsl:text>&#x0a;&#x0a;\begin{enumerate}&#x0a;</xsl:text>
441 <xsl:apply-templates />
442 <xsl:text>&#x0a;\end{enumerate}&#x0a;</xsl:text>
443 </xsl:template>
444
445 <xsl:template match="listitem">
446 <xsl:text>&#x0a;&#x0a;\item </xsl:text>
447 <xsl:apply-templates />
448 <xsl:text>&#x0a;</xsl:text>
449 </xsl:template>
450
451 <xsl:template match="glossterm">
452 <xsl:variable name="refid" select="(@id)" />
453 <xsl:if test="$refid">
454 <xsl:value-of select="concat('&#x0a;\label{', $refid, '}')" />
455 </xsl:if>
456 <xsl:text>&#x0a;&#x0a;\item[</xsl:text>
457 <xsl:apply-templates />
458 <xsl:text>]</xsl:text>
459 </xsl:template>
460
461 <xsl:template match="glosslist | glossdiv">
462 <xsl:text>&#x0a;&#x0a;\begin{description}&#x0a;</xsl:text>
463 <xsl:apply-templates />
464 <xsl:text>&#x0a;\end{description}&#x0a;</xsl:text>
465 </xsl:template>
466
467 <xsl:template match="superscript">
468 <xsl:variable name="contents">
469 <xsl:apply-templates />
470 </xsl:variable>
471 <xsl:value-of select="concat('\texorpdfstring{\textsuperscript{', $contents, '}}{', $contents, '}')" />
472 </xsl:template>
473
474 <xsl:template match="emphasis">
475 <xsl:choose>
476 <xsl:when test="@role='bold'">
477 <xsl:text>\textbf{</xsl:text>
478 </xsl:when>
479 <xsl:otherwise>
480 <xsl:text>\textit{</xsl:text>
481 </xsl:otherwise>
482 </xsl:choose>
483 <xsl:apply-templates />
484 <xsl:text>}</xsl:text>
485 </xsl:template>
486
487 <xsl:template match="computeroutput | code">
488 <xsl:text>\texttt{</xsl:text>
489 <xsl:apply-templates />
490 <xsl:text>}</xsl:text>
491 </xsl:template>
492
493 <xsl:template match="ulink">
494 <xsl:text>\url{</xsl:text>
495 <xsl:apply-templates />
496 <xsl:text>}</xsl:text>
497 </xsl:template>
498
499 <xsl:template match="xref">
500 <xsl:choose>
501 <xsl:when test="@xreflabel">
502 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @xreflabel, '}}')" />
503 </xsl:when>
504 <xsl:when test="@apiref='yes'">
505 <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{')" />
506 <xsl:apply-templates />
507 <xsl:value-of select="'}}'" />
508 </xsl:when>
509 <xsl:otherwise>
510 <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
511 </xsl:otherwise>
512 </xsl:choose>
513 </xsl:template>
514
515 <!-- for some reason, DocBook insists of having image data nested this way always:
516 mediaobject -> imageobject -> imagedata
517 but only imagedata is interesting -->
518 <xsl:template match="imagedata">
519 <xsl:if test="@align='center'">
520 <xsl:text>\begin{center}</xsl:text>
521 </xsl:if>
522 <xsl:value-of select="concat('&#x0a;\includegraphics[width=', @width, ']{', @fileref, '}&#x0a;')" />
523 <xsl:apply-templates />
524 <xsl:if test="@align='center'">
525 <xsl:text>\end{center}</xsl:text>
526 </xsl:if>
527 </xsl:template>
528
529 <xsl:template match="//text()">
530 <xsl:variable name="subst1">
531 <xsl:call-template name="str:subst">
532 <xsl:with-param name="text" select="." />
533 <xsl:with-param name="replace" select="'\'" />
534 <xsl:with-param name="with" select="'\textbackslash{}'" />
535 <xsl:with-param name="disable-output-escaping" select="no" />
536 </xsl:call-template>
537 </xsl:variable>
538 <xsl:choose>
539 <xsl:when test="(name(..)='screen') or (name(../..)='screen')">
540 <xsl:value-of select="." />
541 </xsl:when>
542 <xsl:when test="(name(..)='computeroutput') or (name(../..)='computeroutput') or (name(..)='code') or (name(../..)='code')">
543 <xsl:variable name="subst2">
544 <xsl:call-template name="str:subst">
545 <xsl:with-param name="text" select="$subst1" />
546 <xsl:with-param name="replace" select="'--'" />
547 <xsl:with-param name="with" select="'-{}-'" />
548 <xsl:with-param name="disable-output-escaping" select="no" />
549 </xsl:call-template>
550 </xsl:variable>
551 <xsl:variable name="subst3">
552 <xsl:call-template name="str:subst">
553 <xsl:with-param name="text" select="$subst2" />
554 <xsl:with-param name="replace" select="'_'" />
555 <xsl:with-param name="with" select="'\_'" />
556 <xsl:with-param name="disable-output-escaping" select="no" />
557 </xsl:call-template>
558 </xsl:variable>
559 <xsl:variable name="subst4">
560 <xsl:call-template name="str:subst">
561 <xsl:with-param name="text" select="$subst3" />
562 <xsl:with-param name="replace" select="'$'" />
563 <xsl:with-param name="with" select="'\$'" />
564 <xsl:with-param name="disable-output-escaping" select="no" />
565 </xsl:call-template>
566 </xsl:variable>
567 <xsl:variable name="subst5">
568 <xsl:call-template name="str:subst">
569 <xsl:with-param name="text" select="$subst4" />
570 <xsl:with-param name="replace" select="'%'" />
571 <xsl:with-param name="with" select="'\%'" />
572 <xsl:with-param name="disable-output-escaping" select="no" />
573 </xsl:call-template>
574 </xsl:variable>
575 <xsl:variable name="subst6">
576 <xsl:call-template name="str:subst">
577 <xsl:with-param name="text" select="$subst5" />
578 <xsl:with-param name="replace" select="'#'" />
579 <xsl:with-param name="with" select="'\#'" />
580 <xsl:with-param name="disable-output-escaping" select="no" />
581 </xsl:call-template>
582 </xsl:variable>
583 <xsl:variable name="subst7">
584 <xsl:call-template name="str:subst">
585 <xsl:with-param name="text" select="$subst6" />
586 <xsl:with-param name="replace" select="'~'" />
587 <xsl:with-param name="with" select="'\~'" />
588 <xsl:with-param name="disable-output-escaping" select="no" />
589 </xsl:call-template>
590 </xsl:variable>
591 <xsl:variable name="subst8">
592 <xsl:call-template name="str:subst">
593 <xsl:with-param name="text" select="$subst7" />
594 <xsl:with-param name="replace" select="'&amp;'" />
595 <xsl:with-param name="with" select="'\&amp;'" />
596 <xsl:with-param name="disable-output-escaping" select="no" />
597 </xsl:call-template>
598 </xsl:variable>
599 <xsl:value-of select="$subst8" />
600 </xsl:when>
601 <xsl:when test="(name(..)='address') or (name(../..)='address')">
602 <xsl:variable name="subst2">
603 <xsl:call-template name="str:subst">
604 <xsl:with-param name="text" select="$subst1" />
605 <xsl:with-param name="replace" select="'&#x0a;'" />
606 <xsl:with-param name="with" select="' \\'" />
607 <xsl:with-param name="disable-output-escaping" select="no" />
608 </xsl:call-template>
609 </xsl:variable>
610 <xsl:value-of select="$subst2" />
611 </xsl:when>
612 <xsl:otherwise>
613 <xsl:variable name="subst2">
614 <xsl:call-template name="str:subst">
615 <xsl:with-param name="text" select="$subst1" />
616 <xsl:with-param name="replace" select="'_'" />
617 <xsl:with-param name="with" select="'\_'" />
618 <xsl:with-param name="disable-output-escaping" select="no" />
619 </xsl:call-template>
620 </xsl:variable>
621 <xsl:variable name="subst3">
622 <xsl:call-template name="str:subst">
623 <xsl:with-param name="text" select="$subst2" />
624 <xsl:with-param name="replace" select="'$'" />
625 <xsl:with-param name="with" select="'\$'" />
626 <xsl:with-param name="disable-output-escaping" select="no" />
627 </xsl:call-template>
628 </xsl:variable>
629 <xsl:variable name="subst4">
630 <xsl:call-template name="str:subst">
631 <xsl:with-param name="text" select="$subst3" />
632 <xsl:with-param name="replace" select="'%'" />
633 <xsl:with-param name="with" select="'\%'" />
634 <xsl:with-param name="disable-output-escaping" select="no" />
635 </xsl:call-template>
636 </xsl:variable>
637 <xsl:variable name="subst5">
638 <xsl:call-template name="str:subst">
639 <xsl:with-param name="text" select="$subst4" />
640 <xsl:with-param name="replace" select="'#'" />
641 <xsl:with-param name="with" select="'\#'" />
642 <xsl:with-param name="disable-output-escaping" select="no" />
643 </xsl:call-template>
644 </xsl:variable>
645 <xsl:variable name="subst6">
646 <xsl:call-template name="str:subst">
647 <xsl:with-param name="text" select="$subst5" />
648 <xsl:with-param name="replace" select="'µ'" />
649 <xsl:with-param name="with" select="'$\mu$'" />
650 <xsl:with-param name="disable-output-escaping" select="no" />
651 </xsl:call-template>
652 </xsl:variable>
653 <xsl:variable name="subst7">
654 <xsl:call-template name="str:subst">
655 <xsl:with-param name="text" select="$subst6" />
656 <xsl:with-param name="replace" select="'®'" />
657 <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
658 <xsl:with-param name="disable-output-escaping" select="no" />
659 </xsl:call-template>
660 </xsl:variable>
661 <xsl:variable name="quote">"</xsl:variable>
662 <!-- preparation for pretty quotes: replace all double quotes _outside_ screen
663 sections with "\QUOTE{}" strings, which the makefile will then replace
664 with pretty quotes by invoking sed a few times. Unfortunately there are
665 no regular expressions in XSLT so there's no other way. -->
666 <xsl:variable name="subst8">
667 <xsl:call-template name="str:subst">
668 <xsl:with-param name="text" select="$subst7" />
669 <xsl:with-param name="replace" select="$quote" />
670 <xsl:with-param name="with" select="'\QUOTE{}'" />
671 <xsl:with-param name="disable-output-escaping" select="no" />
672 </xsl:call-template>
673 </xsl:variable>
674 <xsl:variable name="subst9">
675 <xsl:call-template name="str:subst">
676 <xsl:with-param name="text" select="$subst8" />
677 <xsl:with-param name="replace" select="'~'" />
678 <xsl:with-param name="with" select="'\~'" />
679 <xsl:with-param name="disable-output-escaping" select="no" />
680 </xsl:call-template>
681 </xsl:variable>
682 <xsl:variable name="subst10">
683 <xsl:call-template name="str:subst">
684 <xsl:with-param name="text" select="$subst9" />
685 <xsl:with-param name="replace" select="'&amp;'" />
686 <xsl:with-param name="with" select="'\&amp;'" />
687 <xsl:with-param name="disable-output-escaping" select="no" />
688 </xsl:call-template>
689 </xsl:variable>
690 <xsl:value-of select="$subst10" />
691 </xsl:otherwise>
692 </xsl:choose>
693 </xsl:template>
694</xsl:stylesheet>
695
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