VirtualBox

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

Last change on this file since 48297 was 46207, checked in by vboxsync, 12 years ago

doc/manual: Move all id=... attributes from the title tags up one level, as otherwise the DocBook converters create inconsistent HTML filesi with lots of dangling links. The LaTeX converter now acts as a guard dog against reintroducing such bugs, it will take those attributes only from the correct tag and incorrect attribute use will thus lead to "undefined references" when creating the PDF manual.

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