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 | <!--
|
---|
22 | Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
23 |
|
---|
24 | This file is part of VirtualBox base platform packages, as
|
---|
25 | available from https://www.virtualbox.org.
|
---|
26 |
|
---|
27 | This program is free software; you can redistribute it and/or
|
---|
28 | modify it under the terms of the GNU General Public License
|
---|
29 | as published by the Free Software Foundation, in version 3 of the
|
---|
30 | License.
|
---|
31 |
|
---|
32 | This program is distributed in the hope that it will be useful, but
|
---|
33 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
35 | General Public License for more details.
|
---|
36 |
|
---|
37 | You should have received a copy of the GNU General Public License
|
---|
38 | along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
39 |
|
---|
40 | SPDX-License-Identifier: GPL-3.0-only
|
---|
41 | -->
|
---|
42 |
|
---|
43 | <xsl:stylesheet
|
---|
44 | version="1.0"
|
---|
45 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
46 | xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
---|
47 | xmlns:str="http://xsltsl.org/string"
|
---|
48 | >
|
---|
49 |
|
---|
50 | <xsl:import href="string.xsl"/>
|
---|
51 | <xsl:import href="common-formatcfg.xsl"/>
|
---|
52 |
|
---|
53 | <xsl:variable name="g_nlsChapter">
|
---|
54 | <xsl:choose>
|
---|
55 | <xsl:when test="$TARGETLANG='de_DE'">Kapitel</xsl:when>
|
---|
56 | <xsl:when test="$TARGETLANG='fr_FR'">chapitre</xsl:when>
|
---|
57 | <xsl:when test="$TARGETLANG='en_US'">chapter</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_nlsPage">
|
---|
65 | <xsl:choose>
|
---|
66 | <xsl:when test="$TARGETLANG='de_DE'">auf Seite</xsl:when>
|
---|
67 | <xsl:when test="$TARGETLANG='fr_FR'">page</xsl:when>
|
---|
68 | <xsl:when test="$TARGETLANG='en_US'">page</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_nlsNote">
|
---|
76 | <xsl:choose>
|
---|
77 | <xsl:when test="$TARGETLANG='de_DE'">Hinweis</xsl:when>
|
---|
78 | <xsl:when test="$TARGETLANG='fr_FR'">Note</xsl:when>
|
---|
79 | <xsl:when test="$TARGETLANG='en_US'">Note</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:variable name="g_nlsWarning">
|
---|
87 | <xsl:choose>
|
---|
88 | <xsl:when test="$TARGETLANG='de_DE'">Warnung</xsl:when>
|
---|
89 | <xsl:when test="$TARGETLANG='fr_FR'">Avertissement</xsl:when>
|
---|
90 | <xsl:when test="$TARGETLANG='en_US'">Warning</xsl:when>
|
---|
91 | <xsl:otherwise>
|
---|
92 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
93 | </xsl:otherwise>
|
---|
94 | </xsl:choose>
|
---|
95 | </xsl:variable>
|
---|
96 |
|
---|
97 | <!-- command synopsis -->
|
---|
98 | <xsl:variable name="arg.rep.repeat.str.tex">\ldots{}</xsl:variable>
|
---|
99 | <xsl:variable name="arg.or.sep.tex"> |~</xsl:variable>
|
---|
100 |
|
---|
101 | <xsl:output method="text"/>
|
---|
102 |
|
---|
103 | <xsl:strip-space elements="*"/>
|
---|
104 | <xsl:preserve-space elements="para"/>
|
---|
105 |
|
---|
106 | <xsl:template match="/book">
|
---|
107 | <xsl:text>
|
---|
108 | \documentclass[oneside,a4paper,10pt,DIV10]{scrbook}
|
---|
109 | \usepackage{geometry}
|
---|
110 | \geometry{top=3cm,bottom=4cm}
|
---|
111 | \usepackage{ucs}
|
---|
112 | \usepackage[utf8x]{inputenc}
|
---|
113 | \usepackage[T1]{fontenc}
|
---|
114 | \usepackage{tabulary}
|
---|
115 | \usepackage[pdftex,
|
---|
116 | a4paper,
|
---|
117 | colorlinks=true,
|
---|
118 | linkcolor=blue,
|
---|
119 | urlcolor=darkgreen,
|
---|
120 | bookmarksnumbered,
|
---|
121 | bookmarksopen=true,
|
---|
122 | bookmarksopenlevel=0,
|
---|
123 | hyperfootnotes=false,
|
---|
124 | plainpages=false,
|
---|
125 | pdfpagelabels
|
---|
126 | ]{hyperref}
|
---|
127 |
|
---|
128 | \usepackage{nameref}
|
---|
129 | \usepackage{graphicx}
|
---|
130 | \usepackage{hyperref}
|
---|
131 | \usepackage{fancybox}
|
---|
132 | \usepackage{alltt}
|
---|
133 | \usepackage{color}
|
---|
134 | \usepackage{scrextend}
|
---|
135 | \definecolor{darkgreen}{rgb}{0,0.6,0}
|
---|
136 | \tymin=21pt
|
---|
137 |
|
---|
138 | </xsl:text>
|
---|
139 | <xsl:if test="$TARGETLANG='de_DE'">\usepackage[ngerman]{babel} \PrerenderUnicode{ü}</xsl:if>
|
---|
140 | <!-- <xsl:if test="$TARGETLANG='fr_FR'">\usepackage[french]{babel} \FrenchItemizeSpacingfalse \renewcommand{\FrenchLabelItem}{\textbullet}</xsl:if>
|
---|
141 | this command is no longer understood by TexLive2008
|
---|
142 | -->
|
---|
143 | <xsl:text>
|
---|
144 |
|
---|
145 | % use Palatino as serif font:
|
---|
146 | % \usepackage{mathpazo}
|
---|
147 | \usepackage{charter}
|
---|
148 | % use Helvetica as sans-serif font:
|
---|
149 | \usepackage{helvet}
|
---|
150 |
|
---|
151 | % use Bera Mono (a variant of Bitstream Vera Mono) as typewriter font
|
---|
152 | % (requires texlive-fontsextra)
|
---|
153 | \usepackage[scaled]{beramono}
|
---|
154 | % previously: use Courier as typewriter font:
|
---|
155 | % \usepackage{courier}
|
---|
156 |
|
---|
157 | \definecolor{colNote}{rgb}{0,0,0}
|
---|
158 | \definecolor{colWarning}{rgb}{0,0,0}
|
---|
159 | \definecolor{colScreenFrame}{rgb}{0,0,0}
|
---|
160 | \definecolor{colScreenText}{rgb}{0,0,0}
|
---|
161 |
|
---|
162 | % number headings down to this level
|
---|
163 | \setcounter{secnumdepth}{3}
|
---|
164 | % more space for the section numbers
|
---|
165 | \makeatletter
|
---|
166 | \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.9em}}
|
---|
167 | \renewcommand*\l@subsection{\@dottedtocline{2}{4.4em}{3.8em}}
|
---|
168 | \renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{3.8em}}
|
---|
169 | \renewcommand*\@pnumwidth{1.7em}
|
---|
170 | \renewcommand*\@tocrmarg{5.0em}
|
---|
171 | \makeatother
|
---|
172 |
|
---|
173 | % more tolerance at 2nd wrap stage:
|
---|
174 | \tolerance = 1000
|
---|
175 | % allow 3rd wrap stage:
|
---|
176 | \emergencystretch = 10pt
|
---|
177 | % no Schusterjungen:
|
---|
178 | \clubpenalty = 10000
|
---|
179 | % no Hurenkinder:
|
---|
180 | \widowpenalty = 10000
|
---|
181 | \displaywidowpenalty = 10000
|
---|
182 | % max pdf compression:
|
---|
183 | \pdfcompresslevel9
|
---|
184 |
|
---|
185 | % opening and closing quotes: the OQ and CQ macros define this (and the makefile employs some sed magic also)
|
---|
186 | </xsl:text>
|
---|
187 | <xsl:choose>
|
---|
188 | <xsl:when test="$TARGETLANG='de_DE'">
|
---|
189 | <xsl:text>\newcommand\OQ{\texorpdfstring{\glqq}{"}} \newcommand\CQ{\texorpdfstring{\grqq}{"}} </xsl:text>
|
---|
190 | </xsl:when>
|
---|
191 | <xsl:when test="$TARGETLANG='fr_FR'">
|
---|
192 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
193 | </xsl:when>
|
---|
194 | <xsl:when test="$TARGETLANG='en_US'">
|
---|
195 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
196 | </xsl:when>
|
---|
197 | <xsl:otherwise>
|
---|
198 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
199 | </xsl:otherwise>
|
---|
200 | </xsl:choose>
|
---|
201 |
|
---|
202 | <xsl:apply-templates />
|
---|
203 |
|
---|
204 | <xsl:text>
|
---|
205 | \end{sloppypar}
|
---|
206 | \end{document}
|
---|
207 | </xsl:text>
|
---|
208 |
|
---|
209 | </xsl:template>
|
---|
210 |
|
---|
211 | <xsl:template match="bookinfo">
|
---|
212 | <xsl:apply-templates />
|
---|
213 | <xsl:text>
\newcommand\docbookbookinfocopyright{Copyright \copyright{} \docbookbookinfocopyrightyear{} \docbookbookinfocopyrightholder{}}

|
---|
214 | \author{ \docbooktitleedition \\ %
|
---|
215 | \\ %
|
---|
216 | </xsl:text>
|
---|
217 | <xsl:if test="//bookinfo/address">
|
---|
218 | <xsl:text>\docbookbookinfoaddress \\ %
|
---|
219 | \\ %
|
---|
220 | </xsl:text>
|
---|
221 | </xsl:if>
|
---|
222 | <xsl:text>\docbookbookinfocopyright \\ %
|
---|
223 | }
|
---|
224 |
|
---|
225 | \title{\docbooktitle \\
|
---|
226 | \docbooksubtitle}
|
---|
227 | % \subtitle{\docbooksubtitle}
|
---|
228 | \hypersetup{pdfauthor=\docbookcorpauthor}
|
---|
229 | \hypersetup{pdftitle=\docbooktitle{} \docbooksubtitle{}}
|
---|
230 |
|
---|
231 | \hyphenation{da-ta-ba-ses}
|
---|
232 | \hyphenation{deb-conf}
|
---|
233 | \hyphenation{VirtualBox}
|
---|
234 |
|
---|
235 | \begin{document}
|
---|
236 | % bird/2018-05-14: Use sloppypar so we don't push path names and other long words
|
---|
237 | % thru the right margin. TODO: Find better solution? microtype?
|
---|
238 | \begin{sloppypar}
|
---|
239 | % \maketitle
|
---|
240 | %\begin{titlepage}
|
---|
241 | \thispagestyle{empty}
|
---|
242 | \begin{minipage}{\textwidth}
|
---|
243 | \begin{center}
|
---|
244 | \includegraphics[width=4cm]{images/vboxlogo.png}
|
---|
245 | \end{center}%
|
---|
246 | \vspace{10mm}
|
---|
247 |
|
---|
248 | {\fontsize{40pt}{40pt}\selectfont\rmfamily\bfseries%
|
---|
249 | \begin{center}
|
---|
250 | \docbooktitle
|
---|
251 | \end{center}%
|
---|
252 | \vspace{10mm}
|
---|
253 | }
|
---|
254 |
|
---|
255 | {\fontsize{30pt}{30pt}\selectfont\rmfamily\bfseries%
|
---|
256 | \begin{center}
|
---|
257 | \docbooksubtitle
|
---|
258 | \end{center}%
|
---|
259 | \vspace{10mm}
|
---|
260 | }
|
---|
261 |
|
---|
262 | {\fontsize{16pt}{20pt}\selectfont\rmfamily%
|
---|
263 | \begin{center}
|
---|
264 | </xsl:text>
|
---|
265 | <xsl:if test="//bookinfo/othercredit">
|
---|
266 | <xsl:text>\docbookbookinfoothercreditcontrib{}: \docbookbookinfoothercreditfirstname{} \docbookbookinfoothercreditsurname
|
---|
267 |
|
---|
268 | \vspace{8mm}
|
---|
269 | </xsl:text>
|
---|
270 | </xsl:if>
|
---|
271 | <xsl:text>\docbooktitleedition
|
---|
272 |
|
---|
273 | \vspace{2mm}
|
---|
274 |
|
---|
275 | \docbookbookinfocopyright
|
---|
276 |
|
---|
277 | \vspace{2mm}
|
---|
278 |
|
---|
279 | \docbookbookinfoaddress
|
---|
280 | \end{center}%
|
---|
281 | }
|
---|
282 |
|
---|
283 | %\end{titlepage}
|
---|
284 | \end{minipage}
|
---|
285 |
|
---|
286 | \tableofcontents
|
---|
287 | </xsl:text>
|
---|
288 | </xsl:template>
|
---|
289 |
|
---|
290 | <xsl:template match="subtitle">
|
---|
291 | <xsl:choose>
|
---|
292 | <xsl:when test="name(..)='bookinfo'">
|
---|
293 | <xsl:text>\newcommand\docbooksubtitle{</xsl:text>
|
---|
294 | <xsl:apply-templates />
|
---|
295 | <xsl:text>}</xsl:text>
|
---|
296 | </xsl:when>
|
---|
297 | </xsl:choose>
|
---|
298 | </xsl:template>
|
---|
299 |
|
---|
300 | <!-- Determins the section depth, returning a number 1,2,3,4,5,6,7,... -->
|
---|
301 | <xsl:template name="get-section-level">
|
---|
302 | <xsl:param name="a_Node" select=".."/>
|
---|
303 | <xsl:for-each select="$a_Node"> <!-- makes it current -->
|
---|
304 | <xsl:choose>
|
---|
305 | <xsl:when test="self::sect1"><xsl:text>1</xsl:text></xsl:when>
|
---|
306 | <xsl:when test="self::sect2"><xsl:text>2</xsl:text></xsl:when>
|
---|
307 | <xsl:when test="self::sect3"><xsl:text>3</xsl:text></xsl:when>
|
---|
308 | <xsl:when test="self::sect4"><xsl:text>4</xsl:text></xsl:when>
|
---|
309 | <xsl:when test="self::sect5"><xsl:text>5</xsl:text></xsl:when>
|
---|
310 | <xsl:when test="self::section">
|
---|
311 | <xsl:value-of select="count(ancestor::section) + 1"/>
|
---|
312 | </xsl:when>
|
---|
313 | <xsl:when test="self::simplesect">
|
---|
314 | <xsl:variable name="tmp">
|
---|
315 | <xsl:call-template name="get-section-level">
|
---|
316 | <xsl:with-param name="a_Node" select="parent::*"/>
|
---|
317 | </xsl:call-template>
|
---|
318 | </xsl:variable>
|
---|
319 | <xsl:value-of select="$tmp + 1"/>
|
---|
320 | </xsl:when>
|
---|
321 | <xsl:when test="self::preface"><xsl:text>0</xsl:text></xsl:when>
|
---|
322 | <xsl:when test="self::chapter"><xsl:text>0</xsl:text></xsl:when>
|
---|
323 | <xsl:when test="self::appendix"><xsl:text>0</xsl:text></xsl:when>
|
---|
324 | <xsl:when test="self::article"><xsl:text>0</xsl:text></xsl:when>
|
---|
325 | <xsl:otherwise>
|
---|
326 | <xsl:message terminate="yes">get-section-level was called on non-section element: <xsl:value-of select="."/> </xsl:message>
|
---|
327 | </xsl:otherwise>
|
---|
328 | </xsl:choose>
|
---|
329 | </xsl:for-each>
|
---|
330 | </xsl:template>
|
---|
331 |
|
---|
332 | <!--
|
---|
333 | Inserts \hypertarget{@id} that can be referenced via the /A "nameddest=@id"
|
---|
334 | command line or #nameddest=@id URL parameter.
|
---|
335 |
|
---|
336 | TODO: The placement of the target could be improved on. The raisebox
|
---|
337 | stuff is a crude hack to make it a little more acceptable. -->
|
---|
338 | <xsl:template name="title-wrapper">
|
---|
339 | <xsl:param name="texcmd" select="concat('\',name(..))"/>
|
---|
340 | <xsl:param name="refid" select="../@id"/>
|
---|
341 | <xsl:param name="role" select="../@role"/>
|
---|
342 |
|
---|
343 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
344 | <xsl:if test="$texcmd='\chapter' and $role='frontmatter'">
|
---|
345 | <xsl:text>\frontmatter
</xsl:text>
|
---|
346 | </xsl:if>
|
---|
347 | <xsl:if test="$texcmd='\chapter' and ../preceding-sibling::*[1][@role='frontmatter']">
|
---|
348 | <xsl:text>\mainmatter
</xsl:text>
|
---|
349 | </xsl:if>
|
---|
350 | <xsl:choose>
|
---|
351 | <xsl:when test="$refid">
|
---|
352 | <xsl:text>
</xsl:text>
|
---|
353 | <xsl:value-of select="$texcmd"/>
|
---|
354 | <xsl:if test="not(contains($texcmd, '*'))">
|
---|
355 | <xsl:text>[</xsl:text> <!-- for toc -->
|
---|
356 | <xsl:apply-templates />
|
---|
357 | <xsl:text>]</xsl:text>
|
---|
358 | </xsl:if>
|
---|
359 | <xsl:text>{</xsl:text> <!-- for doc -->
|
---|
360 | <xsl:text>\raisebox{\ht\strutbox}{\hypertarget{</xsl:text>
|
---|
361 | <xsl:value-of select="$refid"/>
|
---|
362 | <xsl:text>}{}}</xsl:text>
|
---|
363 | <xsl:apply-templates />
|
---|
364 | <xsl:text>}</xsl:text>
|
---|
365 | </xsl:when>
|
---|
366 | <xsl:otherwise>
|
---|
367 | <xsl:text>
</xsl:text><xsl:value-of select="$texcmd"/><xsl:text>{</xsl:text>
|
---|
368 | <xsl:apply-templates />
|
---|
369 | <xsl:text>}</xsl:text>
|
---|
370 | </xsl:otherwise>
|
---|
371 | </xsl:choose>
|
---|
372 | </xsl:template>
|
---|
373 |
|
---|
374 | <xsl:template match="title">
|
---|
375 | <xsl:variable name="refid" select="../@id" />
|
---|
376 | <xsl:choose>
|
---|
377 | <xsl:when test="name(..)='bookinfo'">
|
---|
378 | <xsl:text>\newcommand\docbooktitle{</xsl:text>
|
---|
379 | <xsl:apply-templates />
|
---|
380 | <xsl:text>}</xsl:text>
|
---|
381 | </xsl:when>
|
---|
382 | <xsl:when test="name(..)='chapter'">
|
---|
383 | <xsl:call-template name="title-wrapper"/>
|
---|
384 | </xsl:when>
|
---|
385 | <xsl:when test="name(..)='preface'">
|
---|
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(..)='sect1' and ../../@role='frontmatter'">
|
---|
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:when test="name(..)='sect1'">
|
---|
396 | <xsl:call-template name="title-wrapper">
|
---|
397 | <xsl:with-param name="texcmd">\section</xsl:with-param>
|
---|
398 | </xsl:call-template>
|
---|
399 | </xsl:when>
|
---|
400 | <xsl:when test="parent::sect2[@role='not-in-toc'] or parent::refsect1 or (parent::section and count(ancestor::section) = 2)">
|
---|
401 | <xsl:call-template name="title-wrapper">
|
---|
402 | <xsl:with-param name="texcmd">\subsection*</xsl:with-param>
|
---|
403 | </xsl:call-template>
|
---|
404 | </xsl:when>
|
---|
405 | <xsl:when test="name(..)='sect2'">
|
---|
406 | <xsl:call-template name="title-wrapper">
|
---|
407 | <xsl:with-param name="texcmd">\subsection</xsl:with-param>
|
---|
408 | </xsl:call-template>
|
---|
409 | </xsl:when>
|
---|
410 | <xsl:when test="parent::sect3[@role='not-in-toc'] or parent::refsect2 or (parent::section and count(ancestor::section) = 3)">
|
---|
411 | <xsl:call-template name="title-wrapper">
|
---|
412 | <xsl:with-param name="texcmd">\subsubsection*</xsl:with-param>
|
---|
413 | </xsl:call-template>
|
---|
414 | </xsl:when>
|
---|
415 | <xsl:when test="name(..)='sect3'">
|
---|
416 | <xsl:call-template name="title-wrapper">
|
---|
417 | <xsl:with-param name="texcmd">\subsubsection</xsl:with-param>
|
---|
418 | </xsl:call-template>
|
---|
419 | </xsl:when>
|
---|
420 | <xsl:when test="parent::sect4[@role='not-in-toc'] or parent::refsect3 or (parent::section and count(ancestor::section) = 4)">
|
---|
421 | <xsl:call-template name="title-wrapper">
|
---|
422 | <xsl:with-param name="texcmd">\paragraph*</xsl:with-param>
|
---|
423 | </xsl:call-template>
|
---|
424 | </xsl:when>
|
---|
425 | <xsl:when test="name(..)='sect4'">
|
---|
426 | <xsl:call-template name="title-wrapper">
|
---|
427 | <xsl:with-param name="texcmd">\paragraph</xsl:with-param>
|
---|
428 | </xsl:call-template>
|
---|
429 | </xsl:when>
|
---|
430 | <xsl:when test="parent::sect5[@role='not-in-toc'] or parent::refsect4 or (parent::section and count(ancestor::section) = 5)">
|
---|
431 | <xsl:call-template name="title-wrapper">
|
---|
432 | <xsl:with-param name="texcmd">\subparagraph*</xsl:with-param>
|
---|
433 | </xsl:call-template>
|
---|
434 | </xsl:when>
|
---|
435 | <xsl:when test="name(..)='sect5'">
|
---|
436 | <xsl:call-template name="title-wrapper">
|
---|
437 | <xsl:with-param name="texcmd">\subparagraph</xsl:with-param>
|
---|
438 | </xsl:call-template>
|
---|
439 | </xsl:when>
|
---|
440 | <xsl:when test="name(..)='appendix'">
|
---|
441 | <xsl:call-template name="title-wrapper">
|
---|
442 | <xsl:with-param name="texcmd">\chapter</xsl:with-param>
|
---|
443 | </xsl:call-template>
|
---|
444 | </xsl:when>
|
---|
445 | <xsl:when test="name(..)='glossdiv'">
|
---|
446 | <xsl:call-template name="title-wrapper">
|
---|
447 | <xsl:with-param name="texcmd">\section*</xsl:with-param>
|
---|
448 | </xsl:call-template>
|
---|
449 | </xsl:when>
|
---|
450 |
|
---|
451 | <xsl:when test="parent::simplesect">
|
---|
452 | <xsl:if test="../@role">
|
---|
453 | <xsl:message terminate="yes">Role not allowed with simplesect: <xsl:value-of select="../@role"/></xsl:message>
|
---|
454 | </xsl:if>
|
---|
455 | <xsl:variable name="level">
|
---|
456 | <xsl:call-template name="get-section-level">
|
---|
457 | <xsl:with-param name="a_Node" select=".."/>
|
---|
458 | </xsl:call-template>
|
---|
459 | </xsl:variable>
|
---|
460 | <xsl:choose>
|
---|
461 | <xsl:when test="$level = 1">
|
---|
462 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\section*</xsl:with-param></xsl:call-template>
|
---|
463 | </xsl:when>
|
---|
464 | <xsl:when test="$level = 2">
|
---|
465 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\subsection*</xsl:with-param></xsl:call-template>
|
---|
466 | </xsl:when>
|
---|
467 | <xsl:when test="$level = 3">
|
---|
468 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\subsubsection*</xsl:with-param></xsl:call-template>
|
---|
469 | </xsl:when>
|
---|
470 | <xsl:when test="$level = 4">
|
---|
471 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\paragraph*</xsl:with-param></xsl:call-template>
|
---|
472 | </xsl:when>
|
---|
473 | <xsl:when test="$level = 5">
|
---|
474 | <xsl:call-template name="title-wrapper"><xsl:with-param name="texcmd">\subparagraph*</xsl:with-param></xsl:call-template>
|
---|
475 | </xsl:when>
|
---|
476 | <xsl:otherwise>
|
---|
477 | <xsl:message terminate="yes">Unsupported simplesect/title depth: <xsl:value-of select="$level"/></xsl:message>
|
---|
478 | </xsl:otherwise>
|
---|
479 | </xsl:choose>
|
---|
480 | </xsl:when>
|
---|
481 |
|
---|
482 | </xsl:choose>
|
---|
483 | <xsl:if test="$refid">
|
---|
484 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
485 | </xsl:if>
|
---|
486 | <xsl:text>
</xsl:text>
|
---|
487 | </xsl:template>
|
---|
488 |
|
---|
489 | <xsl:template match="edition">
|
---|
490 | <xsl:choose>
|
---|
491 | <xsl:when test="name(..)='bookinfo'">
|
---|
492 | <xsl:text>\newcommand\docbooktitleedition{</xsl:text>
|
---|
493 | <xsl:apply-templates />
|
---|
494 | <xsl:text>}
</xsl:text>
|
---|
495 | </xsl:when>
|
---|
496 | </xsl:choose>
|
---|
497 | </xsl:template>
|
---|
498 |
|
---|
499 | <xsl:template match="corpauthor">
|
---|
500 | <xsl:choose>
|
---|
501 | <xsl:when test="name(..)='bookinfo'">
|
---|
502 | <xsl:text>\newcommand\docbookcorpauthor{</xsl:text>
|
---|
503 | <xsl:apply-templates />
|
---|
504 | <xsl:text>}
</xsl:text>
|
---|
505 | </xsl:when>
|
---|
506 | </xsl:choose>
|
---|
507 | </xsl:template>
|
---|
508 |
|
---|
509 | <xsl:template match="address">
|
---|
510 | <xsl:choose>
|
---|
511 | <xsl:when test="name(..)='bookinfo'">
|
---|
512 | <xsl:text>\newcommand\docbookbookinfoaddress{</xsl:text>
|
---|
513 | <xsl:apply-templates />
|
---|
514 | <xsl:text>}
</xsl:text>
|
---|
515 | </xsl:when>
|
---|
516 | </xsl:choose>
|
---|
517 | </xsl:template>
|
---|
518 |
|
---|
519 | <xsl:template match="year">
|
---|
520 | <xsl:choose>
|
---|
521 | <xsl:when test="name(..)='copyright'">
|
---|
522 | <xsl:text>\newcommand\docbookbookinfocopyrightyear{</xsl:text>
|
---|
523 | <xsl:apply-templates />
|
---|
524 | <xsl:text>}
</xsl:text>
|
---|
525 | </xsl:when>
|
---|
526 | </xsl:choose>
|
---|
527 | </xsl:template>
|
---|
528 |
|
---|
529 | <xsl:template match="holder">
|
---|
530 | <xsl:choose>
|
---|
531 | <xsl:when test="name(..)='copyright'">
|
---|
532 | <xsl:text>\newcommand\docbookbookinfocopyrightholder{</xsl:text>
|
---|
533 | <xsl:apply-templates />
|
---|
534 | <xsl:text>}
</xsl:text>
|
---|
535 | </xsl:when>
|
---|
536 | </xsl:choose>
|
---|
537 | </xsl:template>
|
---|
538 |
|
---|
539 | <xsl:template match="firstname">
|
---|
540 | <xsl:choose>
|
---|
541 | <xsl:when test="name(..)='othercredit'">
|
---|
542 | <xsl:text>\newcommand\docbookbookinfoothercreditfirstname{</xsl:text>
|
---|
543 | <xsl:apply-templates />
|
---|
544 | <xsl:text>}
</xsl:text>
|
---|
545 | </xsl:when>
|
---|
546 | </xsl:choose>
|
---|
547 | </xsl:template>
|
---|
548 |
|
---|
549 | <xsl:template match="surname">
|
---|
550 | <xsl:choose>
|
---|
551 | <xsl:when test="name(..)='othercredit'">
|
---|
552 | <xsl:text>\newcommand\docbookbookinfoothercreditsurname{</xsl:text>
|
---|
553 | <xsl:apply-templates />
|
---|
554 | <xsl:text>}
</xsl:text>
|
---|
555 | </xsl:when>
|
---|
556 | </xsl:choose>
|
---|
557 | </xsl:template>
|
---|
558 |
|
---|
559 | <xsl:template match="contrib">
|
---|
560 | <xsl:choose>
|
---|
561 | <xsl:when test="name(..)='othercredit'">
|
---|
562 | <xsl:text>\newcommand\docbookbookinfoothercreditcontrib{</xsl:text>
|
---|
563 | <xsl:apply-templates />
|
---|
564 | <xsl:text>}
</xsl:text>
|
---|
565 | </xsl:when>
|
---|
566 | </xsl:choose>
|
---|
567 | </xsl:template>
|
---|
568 |
|
---|
569 | <xsl:template match="glossary">
|
---|
570 | <xsl:text>

\backmatter
\chapter{Glossary}
</xsl:text>
|
---|
571 | <xsl:apply-templates />
|
---|
572 | </xsl:template>
|
---|
573 |
|
---|
574 | <xsl:template match="para">
|
---|
575 | <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or name(..)='entry' or (name(../..)='varlistentry' and position()=1))">
|
---|
576 | <xsl:text>

</xsl:text>
|
---|
577 | </xsl:if>
|
---|
578 | <xsl:apply-templates />
|
---|
579 | </xsl:template>
|
---|
580 |
|
---|
581 | <xsl:template match="note">
|
---|
582 | <xsl:value-of select="concat('

\vspace{.2cm}

\begin{center}\fbox{\begin{minipage}[c]{0.9\textwidth}\color{colNote}\textbf{', $g_nlsNote, ':} ')" />
|
---|
583 | <xsl:apply-templates />
|
---|
584 | <xsl:text>\end{minipage}}\end{center}

\vspace{.2cm}

</xsl:text>
|
---|
585 | </xsl:template>
|
---|
586 |
|
---|
587 | <xsl:template match="warning">
|
---|
588 | <xsl:value-of select="concat('

\vspace{.2cm}

\begin{center}\fbox{\begin{minipage}[c]{0.9\textwidth}\color{colWarning}\textbf{', $g_nlsWarning, ':} ')" />
|
---|
589 | <xsl:apply-templates />
|
---|
590 | <xsl:text>\end{minipage}}\end{center}

\vspace{.2cm}

</xsl:text>
|
---|
591 | </xsl:template>
|
---|
592 |
|
---|
593 | <xsl:template match="screen">
|
---|
594 | <xsl:text>

{\footnotesize\begin{alltt}
</xsl:text>
|
---|
595 | <xsl:apply-templates />
|
---|
596 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
597 | </xsl:template>
|
---|
598 |
|
---|
599 | <xsl:template match="programlisting">
|
---|
600 | <xsl:text>

{\small\begin{alltt}
</xsl:text>
|
---|
601 | <xsl:apply-templates />
|
---|
602 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
603 | </xsl:template>
|
---|
604 |
|
---|
605 | <xsl:template match="footnote">
|
---|
606 | <xsl:text>\footnote{</xsl:text>
|
---|
607 | <xsl:apply-templates />
|
---|
608 | <xsl:text>}</xsl:text>
|
---|
609 | </xsl:template>
|
---|
610 |
|
---|
611 | <xsl:template match="tgroup">
|
---|
612 | <xsl:choose>
|
---|
613 | <xsl:when test="@style='verywide'">
|
---|
614 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{1.1\textwidth}[]</xsl:text>
|
---|
615 | </xsl:when>
|
---|
616 | <xsl:otherwise>
|
---|
617 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{.9\textwidth}[]</xsl:text>
|
---|
618 | </xsl:otherwise>
|
---|
619 | </xsl:choose>
|
---|
620 | <xsl:text>{</xsl:text>
|
---|
621 | <xsl:choose>
|
---|
622 | <xsl:when test="@cols='1'">
|
---|
623 | <xsl:text>|L|</xsl:text>
|
---|
624 | </xsl:when>
|
---|
625 | <xsl:when test="@cols='2'">
|
---|
626 | <xsl:text>|L|L|</xsl:text>
|
---|
627 | </xsl:when>
|
---|
628 | <xsl:when test="@cols='3'">
|
---|
629 | <xsl:text>|L|L|L|</xsl:text>
|
---|
630 | </xsl:when>
|
---|
631 | <xsl:when test="@cols='4'">
|
---|
632 | <xsl:text>|L|L|L|L|</xsl:text>
|
---|
633 | </xsl:when>
|
---|
634 | <xsl:when test="@cols='5'">
|
---|
635 | <xsl:text>|L|L|L|L|L|</xsl:text>
|
---|
636 | </xsl:when>
|
---|
637 | <xsl:when test="@cols='6'">
|
---|
638 | <xsl:text>|L|L|L|L|L|L|</xsl:text>
|
---|
639 | </xsl:when>
|
---|
640 | <xsl:otherwise>
|
---|
641 | <xsl:message terminate="yes">Unsupported number of columns (<xsl:value-of select="@cols"/>), fix document or converter</xsl:message>
|
---|
642 | </xsl:otherwise>
|
---|
643 | </xsl:choose>
|
---|
644 | <xsl:text>}
\hline
</xsl:text>
|
---|
645 | <xsl:apply-templates />
|
---|
646 | <xsl:text>
\end{tabulary}
\end{center}}
</xsl:text>
|
---|
647 | </xsl:template>
|
---|
648 |
|
---|
649 | <xsl:template match="row">
|
---|
650 | <xsl:apply-templates />
|
---|
651 | <xsl:text>
\\ \hline
</xsl:text>
|
---|
652 | </xsl:template>
|
---|
653 |
|
---|
654 | <xsl:template match="entry">
|
---|
655 | <xsl:if test="not(position()=1)">
|
---|
656 | <xsl:text> & </xsl:text>
|
---|
657 | </xsl:if>
|
---|
658 | <xsl:apply-templates />
|
---|
659 | </xsl:template>
|
---|
660 |
|
---|
661 | <xsl:template match="itemizedlist">
|
---|
662 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
663 | <xsl:text>
\begin{itemize}
</xsl:text>
|
---|
664 | <xsl:if test="@spacing = 'compact'">
|
---|
665 | <xsl:text> \setlength{\parskip}{0pt}
</xsl:text>
|
---|
666 | <xsl:text> \setlength{\itemsep}{0pt}
</xsl:text>
|
---|
667 | <xsl:text> \setlength{\topsep}{0pt}
</xsl:text>
|
---|
668 | <xsl:text> \setlength{\parsep}{0pt}
</xsl:text>
|
---|
669 | <xsl:text> \setlength{\partopsep}{0pt}
</xsl:text>
|
---|
670 | </xsl:if>
|
---|
671 | <xsl:apply-templates />
|
---|
672 | <xsl:text>
\end{itemize}
</xsl:text>
|
---|
673 | </xsl:template>
|
---|
674 |
|
---|
675 | <xsl:template match="orderedlist">
|
---|
676 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
677 | <xsl:text>
\begin{enumerate}
</xsl:text>
|
---|
678 | <xsl:if test="@spacing = 'compact'">
|
---|
679 | <xsl:text> \setlength{\parskip}{0pt}
</xsl:text>
|
---|
680 | <xsl:text> \setlength{\itemsep}{0pt}
</xsl:text>
|
---|
681 | <xsl:text> \setlength{\topsep}{0pt}
</xsl:text>
|
---|
682 | <xsl:text> \setlength{\parsep}{0pt}
</xsl:text>
|
---|
683 | <xsl:text> \setlength{\partopsep}{0pt}
</xsl:text>
|
---|
684 | </xsl:if>
|
---|
685 | <xsl:apply-templates />
|
---|
686 | <xsl:text>
\end{enumerate}
</xsl:text>
|
---|
687 | </xsl:template>
|
---|
688 |
|
---|
689 | <xsl:template match="variablelist">
|
---|
690 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
691 | <xsl:text>
\begin{description}
</xsl:text>
|
---|
692 | <xsl:if test="@spacing = 'compact'">
|
---|
693 | <xsl:text> \setlength{\parskip}{0pt}
</xsl:text>
|
---|
694 | <xsl:text> \setlength{\itemsep}{0pt}
</xsl:text>
|
---|
695 | <xsl:text> \setlength{\topsep}{0pt}
</xsl:text>
|
---|
696 | <xsl:text> \setlength{\parsep}{0pt}
</xsl:text>
|
---|
697 | <xsl:text> \setlength{\partopsep}{0pt}
</xsl:text>
|
---|
698 | </xsl:if>
|
---|
699 | <xsl:apply-templates />
|
---|
700 | <xsl:text>
\end{description}
</xsl:text>
|
---|
701 | </xsl:template>
|
---|
702 |
|
---|
703 | <xsl:template match="varlistentry">
|
---|
704 | <xsl:if test="not(./term) or not(./listitem) or count(./listitem) != 1">
|
---|
705 | <xsl:message terminate="yes">Expected at least one term and one listitem element in the varlistentry.</xsl:message>
|
---|
706 | </xsl:if>
|
---|
707 | <xsl:text>

\item[{\parbox[t]{\linewidth}{\raggedright </xsl:text>
|
---|
708 | <xsl:apply-templates select="./term[1]"/>
|
---|
709 | <xsl:for-each select="./term[position() > 1]">
|
---|
710 | <xsl:text>\\
 </xsl:text>
|
---|
711 | <xsl:apply-templates select="."/>
|
---|
712 | </xsl:for-each>
|
---|
713 | <xsl:text>}}]\hfill\\</xsl:text>
|
---|
714 | <xsl:apply-templates select="listitem/*"/>
|
---|
715 | </xsl:template>
|
---|
716 |
|
---|
717 | <xsl:template match="listitem">
|
---|
718 | <xsl:text>

\item </xsl:text>
|
---|
719 | <xsl:apply-templates />
|
---|
720 | <xsl:text>
</xsl:text>
|
---|
721 | </xsl:template>
|
---|
722 |
|
---|
723 | <xsl:template match="glossterm">
|
---|
724 | <xsl:variable name="refid" select="(@id)" />
|
---|
725 | <xsl:if test="$refid">
|
---|
726 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
727 | </xsl:if>
|
---|
728 | <xsl:text>

\item[</xsl:text>
|
---|
729 | <xsl:apply-templates />
|
---|
730 | <xsl:text>]</xsl:text>
|
---|
731 | </xsl:template>
|
---|
732 |
|
---|
733 | <xsl:template match="glosslist | glossdiv">
|
---|
734 | <xsl:text>

\begin{description}
</xsl:text>
|
---|
735 | <xsl:apply-templates />
|
---|
736 | <xsl:text>
\end{description}
</xsl:text>
|
---|
737 | </xsl:template>
|
---|
738 |
|
---|
739 | <xsl:template match="superscript">
|
---|
740 | <xsl:variable name="contents">
|
---|
741 | <xsl:apply-templates />
|
---|
742 | </xsl:variable>
|
---|
743 | <xsl:value-of select="concat('\texorpdfstring{\textsuperscript{', $contents, '}}{', $contents, '}')" />
|
---|
744 | </xsl:template>
|
---|
745 |
|
---|
746 | <xsl:template match="emphasis">
|
---|
747 | <xsl:choose>
|
---|
748 | <xsl:when test="@role='bold'">
|
---|
749 | <xsl:text>\textbf{</xsl:text>
|
---|
750 | </xsl:when>
|
---|
751 | <xsl:otherwise>
|
---|
752 | <xsl:text>\textit{</xsl:text>
|
---|
753 | </xsl:otherwise>
|
---|
754 | </xsl:choose>
|
---|
755 | <xsl:apply-templates />
|
---|
756 | <xsl:text>}</xsl:text>
|
---|
757 | </xsl:template>
|
---|
758 |
|
---|
759 | <xsl:template match="computeroutput | code">
|
---|
760 | <xsl:text>\texttt{</xsl:text>
|
---|
761 | <xsl:apply-templates />
|
---|
762 | <xsl:text>}</xsl:text>
|
---|
763 | </xsl:template>
|
---|
764 |
|
---|
765 | <xsl:template match="literal | filename">
|
---|
766 | <xsl:text>\texttt{</xsl:text>
|
---|
767 | <xsl:apply-templates />
|
---|
768 | <xsl:text>}</xsl:text>
|
---|
769 | </xsl:template>
|
---|
770 |
|
---|
771 | <xsl:template match="citetitle">
|
---|
772 | <xsl:text>\textit{</xsl:text>
|
---|
773 | <xsl:apply-templates />
|
---|
774 | <xsl:text>}</xsl:text>
|
---|
775 | </xsl:template>
|
---|
776 |
|
---|
777 | <xsl:template match="lineannotation">
|
---|
778 | <xsl:text>\textit{</xsl:text>
|
---|
779 | <xsl:apply-templates />
|
---|
780 | <xsl:text>}</xsl:text>
|
---|
781 | </xsl:template>
|
---|
782 |
|
---|
783 | <xsl:template match="ulink[@url!='' and not(text())]">
|
---|
784 | <xsl:text>\url{</xsl:text>
|
---|
785 | <xsl:value-of select="@url"/>
|
---|
786 | <xsl:text>}</xsl:text>
|
---|
787 | </xsl:template>
|
---|
788 |
|
---|
789 | <xsl:template match="ulink[@url!='' and text()]">
|
---|
790 | <xsl:text>\href{</xsl:text>
|
---|
791 | <xsl:value-of select="@url"/>
|
---|
792 | <xsl:text>}{</xsl:text>
|
---|
793 | <xsl:apply-templates />
|
---|
794 | <xsl:text>}</xsl:text>
|
---|
795 | </xsl:template>
|
---|
796 |
|
---|
797 | <xsl:template match="ulink[(@url='' or not(@url)) and text()]">
|
---|
798 | <xsl:text>\url{</xsl:text>
|
---|
799 | <xsl:apply-templates />
|
---|
800 | <xsl:text>}</xsl:text>
|
---|
801 | </xsl:template>
|
---|
802 |
|
---|
803 | <xsl:template match="xref">
|
---|
804 | <xsl:choose>
|
---|
805 | <xsl:when test="@endterm">
|
---|
806 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
|
---|
807 | </xsl:when>
|
---|
808 | <xsl:otherwise>
|
---|
809 | <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
|
---|
810 | </xsl:otherwise>
|
---|
811 | </xsl:choose>
|
---|
812 | </xsl:template>
|
---|
813 |
|
---|
814 | <xsl:template match="link">
|
---|
815 | <xsl:choose>
|
---|
816 | <xsl:when test="@endterm">
|
---|
817 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
|
---|
818 | </xsl:when>
|
---|
819 | <xsl:when test="./text()">
|
---|
820 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{')" />
|
---|
821 | <xsl:apply-templates select="./text()"/>
|
---|
822 | <xsl:value-of select="'}}'" />
|
---|
823 | </xsl:when>
|
---|
824 | <xsl:otherwise>
|
---|
825 | <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
|
---|
826 | </xsl:otherwise>
|
---|
827 | </xsl:choose>
|
---|
828 | </xsl:template>
|
---|
829 |
|
---|
830 | <xsl:template match="trademark">
|
---|
831 | <xsl:apply-templates />
|
---|
832 | <xsl:text>\textsuperscript{\textregistered}</xsl:text>
|
---|
833 | </xsl:template>
|
---|
834 |
|
---|
835 | <!-- for some reason, DocBook insists of having image data nested this way always:
|
---|
836 | mediaobject -> imageobject -> imagedata
|
---|
837 | but only imagedata is interesting -->
|
---|
838 | <xsl:template match="imagedata">
|
---|
839 | <xsl:if test="@align='center'">
|
---|
840 | <xsl:text>\begin{center}</xsl:text>
|
---|
841 | </xsl:if>
|
---|
842 | <xsl:value-of select="concat('
\includegraphics[width=', @width, ']{', @fileref, '}
')" />
|
---|
843 | <xsl:apply-templates />
|
---|
844 | <xsl:if test="@align='center'">
|
---|
845 | <xsl:text>\end{center}</xsl:text>
|
---|
846 | </xsl:if>
|
---|
847 | </xsl:template>
|
---|
848 |
|
---|
849 | <!--
|
---|
850 | Turn the refsynopsisdiv part of a manpage into a named & indented paragraph.
|
---|
851 | -->
|
---|
852 | <xsl:template match="refsynopsisdiv">
|
---|
853 | <xsl:if test="name(*[1]) != 'cmdsynopsis'"><xsl:message terminate="yes">Expected refsynopsisdiv to start with cmdsynopsis</xsl:message></xsl:if>
|
---|
854 | <xsl:if test="title"><xsl:message terminate="yes">No title element supported in refsynopsisdiv</xsl:message></xsl:if>
|
---|
855 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
856 | <xsl:text>
\subsection*{Synopsis}
</xsl:text>
|
---|
857 | <xsl:apply-templates />
|
---|
858 | </xsl:template>
|
---|
859 |
|
---|
860 | <!--
|
---|
861 | The refsect1 is used for 'Description' and such. Do same as with refsynopsisdiv
|
---|
862 | and turn it into a named & indented paragraph.
|
---|
863 | -->
|
---|
864 | <xsl:template match="refsect1">
|
---|
865 | <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
|
---|
866 | <xsl:message terminate="yes">Expected exactly one title as the first refsect1 element (remarks goes after title!).</xsl:message>
|
---|
867 | </xsl:if>
|
---|
868 | <xsl:apply-templates/>
|
---|
869 | </xsl:template>
|
---|
870 |
|
---|
871 | <!--
|
---|
872 | The refsect2 element will be turned into a subparagraph if it has a title,
|
---|
873 | however, that didn't work out when it didn't have a title and started with
|
---|
874 | a cmdsynopsis instead (subcommand docs). So, we're doing some trickery
|
---|
875 | here (HACK ALERT) for the non-title case to feign a paragraph.
|
---|
876 | -->
|
---|
877 | <xsl:template match="refsect2">
|
---|
878 | <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
|
---|
879 | <xsl:message terminate="yes">Expected exactly one title as the first refsect2 element (remarks goes after title!).</xsl:message>
|
---|
880 | </xsl:if>
|
---|
881 | <xsl:apply-templates/>
|
---|
882 | <xsl:text>
</xsl:text>
|
---|
883 | </xsl:template>
|
---|
884 |
|
---|
885 |
|
---|
886 | <!--
|
---|
887 | Command Synopsis elements.
|
---|
888 |
|
---|
889 | We treat each command element inside a cmdsynopsis as the start of
|
---|
890 | a new paragraph. The DocBook HTML converter does so too, but the
|
---|
891 | manpage one doesn't.
|
---|
892 |
|
---|
893 | sbr and linebreaks made by latex should be indented from the base
|
---|
894 | command level. This is done by the \hangindent3em\hangafter1 bits.
|
---|
895 |
|
---|
896 | We exploit the default paragraph indentation to get each command
|
---|
897 | indented from the left margin. This, unfortunately, doesn't work
|
---|
898 | if we're the first paragraph in a (sub*)section. \noindent cannot
|
---|
899 | counter this due to when latex enforces first paragraph stuff. Since
|
---|
900 | it's tedious to figure out when we're in the first paragraph and when
|
---|
901 | not, we just do \noindent\hspace{1em} everywhere.
|
---|
902 | -->
|
---|
903 | <xsl:template match="sbr">
|
---|
904 | <xsl:if test="not(ancestor::cmdsynopsis)">
|
---|
905 | <xsl:message terminate="yes">sbr only supported inside cmdsynopsis (because of hangindent)</xsl:message>
|
---|
906 | </xsl:if>
|
---|
907 | <xsl:text>\newline</xsl:text>
|
---|
908 | </xsl:template>
|
---|
909 |
|
---|
910 | <xsl:template match="refentry|refnamediv|refentryinfo|refmeta|refsect3|refsect4|refsect5|synopfragment|synopfragmentref|cmdsynopsis/info">
|
---|
911 | <xsl:message terminate="yes"><xsl:value-of select="name()"/> is not supported</xsl:message>
|
---|
912 | </xsl:template>
|
---|
913 |
|
---|
914 | <xsl:template match="cmdsynopsis">
|
---|
915 | <xsl:if test="preceding-sibling::cmdsynopsis">
|
---|
916 | <xsl:text>%cmdsynopsis</xsl:text>
|
---|
917 | </xsl:if>
|
---|
918 | <xsl:text>
</xsl:text>
|
---|
919 | <xsl:text>\begin{flushleft}</xsl:text>
|
---|
920 | <xsl:if test="parent::remark[@role='VBoxManage-overview']">
|
---|
921 | <!-- Overview fontsize trick -->
|
---|
922 | <xsl:text>{\footnotesize</xsl:text>
|
---|
923 | </xsl:if>
|
---|
924 | <xsl:text>\noindent\hspace{1em}</xsl:text>
|
---|
925 | <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
|
---|
926 | <xsl:apply-templates />
|
---|
927 | <xsl:text>}</xsl:text>
|
---|
928 | <xsl:if test="following-sibling::*">
|
---|
929 | </xsl:if>
|
---|
930 |
|
---|
931 | <!-- For refsect2 subcommand descriptions. -->
|
---|
932 | <xsl:if test="not(following-sibling::cmdsynopsis) and position() != last()">
|
---|
933 | <xsl:text>\linebreak</xsl:text>
|
---|
934 | </xsl:if>
|
---|
935 | <!-- Special overview trick for the current VBoxManage command overview. -->
|
---|
936 | <xsl:if test="parent::remark[@role='VBoxManage-overview']">
|
---|
937 | <xsl:text>\par}</xsl:text>
|
---|
938 | </xsl:if>
|
---|
939 | <xsl:text>\end{flushleft}</xsl:text>
|
---|
940 | </xsl:template>
|
---|
941 |
|
---|
942 | <xsl:template match="command">
|
---|
943 | <xsl:choose>
|
---|
944 | <xsl:when test="ancestor::cmdsynopsis">
|
---|
945 | <!-- Trigger a line break if this isn't the first command in a synopsis -->
|
---|
946 | <xsl:if test="preceding-sibling::command">
|
---|
947 | <xsl:text>}\par%command
</xsl:text>
|
---|
948 | <xsl:text>\noindent\hspace{1em}</xsl:text>
|
---|
949 | <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
|
---|
950 | </xsl:if>
|
---|
951 | <xsl:apply-templates />
|
---|
952 | </xsl:when>
|
---|
953 | <xsl:otherwise>
|
---|
954 | <xsl:text>\texttt{</xsl:text>
|
---|
955 | <xsl:apply-templates />
|
---|
956 | <xsl:text>}</xsl:text>
|
---|
957 | </xsl:otherwise>
|
---|
958 | </xsl:choose>
|
---|
959 | </xsl:template>
|
---|
960 |
|
---|
961 | <xsl:template match="option">
|
---|
962 | <xsl:choose>
|
---|
963 | <xsl:when test="ancestor::cmdsynopsis">
|
---|
964 | <xsl:apply-templates />
|
---|
965 | </xsl:when>
|
---|
966 | <xsl:otherwise>
|
---|
967 | <xsl:text>\texttt{</xsl:text>
|
---|
968 | <xsl:apply-templates />
|
---|
969 | <xsl:text>}</xsl:text>
|
---|
970 | </xsl:otherwise>
|
---|
971 | </xsl:choose>
|
---|
972 | </xsl:template>
|
---|
973 |
|
---|
974 | <!-- duplicated in docbook-refentry-to-C-help.xsl -->
|
---|
975 | <xsl:template match="arg|group">
|
---|
976 | <!-- separator char if we're not the first child -->
|
---|
977 | <xsl:if test="position() > 1">
|
---|
978 | <xsl:choose>
|
---|
979 | <xsl:when test="parent::group"><xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.or.sep.tex"/><xsl:text>}</xsl:text></xsl:when>
|
---|
980 | <xsl:when test="ancestor-or-self::*/@sepchar"><xsl:value-of select="ancestor-or-self::*/@sepchar"/></xsl:when>
|
---|
981 | <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
|
---|
982 | </xsl:choose>
|
---|
983 | </xsl:if>
|
---|
984 |
|
---|
985 | <!-- open wrapping -->
|
---|
986 | <xsl:choose>
|
---|
987 | <xsl:when test="not(@choice) or @choice = ''"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.def.open.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
988 | <xsl:when test="@choice = 'opt'"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.opt.open.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
989 | <xsl:when test="@choice = 'req'"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.req.open.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
990 | <xsl:when test="@choice = 'plain'"/>
|
---|
991 | <xsl:otherwise><xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Invalid arg choice: "<xsl:value-of select="@choice"/>"</xsl:message></xsl:otherwise>
|
---|
992 | </xsl:choose>
|
---|
993 |
|
---|
994 | <xsl:apply-templates />
|
---|
995 |
|
---|
996 | <!-- repeat indication -->
|
---|
997 | <xsl:choose>
|
---|
998 | <xsl:when test="@rep = 'norepeat' or not(@rep) or @rep = ''"/>
|
---|
999 | <xsl:when test="@rep = 'repeat'">
|
---|
1000 | <!-- add space padding if we're in a repeating group -->
|
---|
1001 | <xsl:if test="self::group">
|
---|
1002 | <xsl:text> </xsl:text>
|
---|
1003 | </xsl:if>
|
---|
1004 | <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.rep.repeat.str.tex"/><xsl:text>}</xsl:text>
|
---|
1005 | </xsl:when>
|
---|
1006 | <xsl:otherwise><xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Invalid rep choice: "<xsl:value-of select="@rep"/>"</xsl:message></xsl:otherwise>
|
---|
1007 | </xsl:choose>
|
---|
1008 |
|
---|
1009 | <!-- close wrapping -->
|
---|
1010 | <xsl:choose>
|
---|
1011 | <xsl:when test="not(@choice) or @choice = ''"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.def.close.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
1012 | <xsl:when test="@choice = 'opt'"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.opt.close.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
1013 | <xsl:when test="@choice = 'req'"> <xsl:text>\textrm{</xsl:text><xsl:value-of select="$arg.choice.req.close.str"/><xsl:text>}</xsl:text></xsl:when>
|
---|
1014 | </xsl:choose>
|
---|
1015 |
|
---|
1016 | <!-- add space padding if we're the last element in a nested arg -->
|
---|
1017 | <xsl:if test="parent::arg and not(following-sibling)">
|
---|
1018 | <xsl:text> </xsl:text>
|
---|
1019 | </xsl:if>
|
---|
1020 | </xsl:template>
|
---|
1021 |
|
---|
1022 | <xsl:template match="replaceable">
|
---|
1023 | <xsl:choose>
|
---|
1024 | <xsl:when test="(not(ancestor::cmdsynopsis) and not(ancestor::option) and not(ancestor::screen)) or ancestor::arg">
|
---|
1025 | <xsl:text>\texttt{\textit{</xsl:text>
|
---|
1026 | <xsl:apply-templates />
|
---|
1027 | <xsl:text>}}</xsl:text>
|
---|
1028 | </xsl:when>
|
---|
1029 | <xsl:otherwise>
|
---|
1030 | <xsl:text>\textit{<</xsl:text>
|
---|
1031 | <xsl:apply-templates />
|
---|
1032 | <xsl:text>>}</xsl:text>
|
---|
1033 | </xsl:otherwise>
|
---|
1034 | </xsl:choose>
|
---|
1035 | </xsl:template>
|
---|
1036 |
|
---|
1037 |
|
---|
1038 | <!--
|
---|
1039 | Generic element text magic.
|
---|
1040 | -->
|
---|
1041 | <xsl:template match="//text()">
|
---|
1042 |
|
---|
1043 | <!-- Do the translation of \ into \textbackslash{} in two steps, to avoid
|
---|
1044 | running into replacing {} as well which would be very wrong. -->
|
---|
1045 | <xsl:variable name="subst1">
|
---|
1046 | <xsl:call-template name="str:subst">
|
---|
1047 | <xsl:with-param name="text" select="." />
|
---|
1048 | <xsl:with-param name="replace" select="'\'" />
|
---|
1049 | <xsl:with-param name="with" select="'\textbackslash'" />
|
---|
1050 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1051 | </xsl:call-template>
|
---|
1052 | </xsl:variable>
|
---|
1053 | <xsl:variable name="subst2">
|
---|
1054 | <xsl:call-template name="str:subst">
|
---|
1055 | <xsl:with-param name="text" select="$subst1" />
|
---|
1056 | <xsl:with-param name="replace" select="'{'" />
|
---|
1057 | <xsl:with-param name="with" select="'\{'" />
|
---|
1058 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1059 | </xsl:call-template>
|
---|
1060 | </xsl:variable>
|
---|
1061 | <xsl:variable name="subst3">
|
---|
1062 | <xsl:call-template name="str:subst">
|
---|
1063 | <xsl:with-param name="text" select="$subst2" />
|
---|
1064 | <xsl:with-param name="replace" select="'}'" />
|
---|
1065 | <xsl:with-param name="with" select="'\}'" />
|
---|
1066 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1067 | </xsl:call-template>
|
---|
1068 | </xsl:variable>
|
---|
1069 | <xsl:variable name="subst4">
|
---|
1070 | <xsl:call-template name="str:subst">
|
---|
1071 | <xsl:with-param name="text" select="$subst3" />
|
---|
1072 | <xsl:with-param name="replace" select="'\textbackslash'" />
|
---|
1073 | <xsl:with-param name="with" select="'\textbackslash{}'" />
|
---|
1074 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1075 | </xsl:call-template>
|
---|
1076 | </xsl:variable>
|
---|
1077 |
|
---|
1078 | <xsl:choose>
|
---|
1079 | <xsl:when test="(name(..) = 'computeroutput') or (name(../..) = 'computeroutput')
|
---|
1080 | or (name(..) = 'code') or (name(../..) = 'code')
|
---|
1081 | or (name(..) = 'arg') or (name(../..) = 'arg')
|
---|
1082 | or (name(..) = 'option') or (name(../..) = 'option')
|
---|
1083 | or (name(..) = 'command') or (name(../..) = 'command')
|
---|
1084 | or (name(..) = 'cmdsynopsis') or (name(../..) = 'cmdsynopsis')
|
---|
1085 | or (name(..) = 'replaceable') or (name(../..) = 'replaceable')
|
---|
1086 | or (name(..) = 'entry') or (name(../..) = 'entry')
|
---|
1087 | ">
|
---|
1088 | <xsl:variable name="subst5">
|
---|
1089 | <xsl:call-template name="str:subst">
|
---|
1090 | <xsl:with-param name="text" select="translate(normalize-space(concat('',$subst4,'')),'','')" />
|
---|
1091 | <xsl:with-param name="replace" select="'--'" />
|
---|
1092 | <xsl:with-param name="with" select="'-{}-'" />
|
---|
1093 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1094 | </xsl:call-template>
|
---|
1095 | </xsl:variable>
|
---|
1096 | <xsl:variable name="subst6">
|
---|
1097 | <xsl:call-template name="str:subst">
|
---|
1098 | <xsl:with-param name="text" select="$subst5" />
|
---|
1099 | <xsl:with-param name="replace" select="'_'" />
|
---|
1100 | <xsl:with-param name="with" select="'\_'" />
|
---|
1101 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1102 | </xsl:call-template>
|
---|
1103 | </xsl:variable>
|
---|
1104 | <xsl:variable name="subst7">
|
---|
1105 | <xsl:call-template name="str:subst">
|
---|
1106 | <xsl:with-param name="text" select="$subst6" />
|
---|
1107 | <xsl:with-param name="replace" select="'$'" />
|
---|
1108 | <xsl:with-param name="with" select="'\$'" />
|
---|
1109 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1110 | </xsl:call-template>
|
---|
1111 | </xsl:variable>
|
---|
1112 | <xsl:variable name="subst8">
|
---|
1113 | <xsl:call-template name="str:subst">
|
---|
1114 | <xsl:with-param name="text" select="$subst7" />
|
---|
1115 | <xsl:with-param name="replace" select="'%'" />
|
---|
1116 | <xsl:with-param name="with" select="'\%'" />
|
---|
1117 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1118 | </xsl:call-template>
|
---|
1119 | </xsl:variable>
|
---|
1120 | <xsl:variable name="subst9">
|
---|
1121 | <xsl:call-template name="str:subst">
|
---|
1122 | <xsl:with-param name="text" select="$subst8" />
|
---|
1123 | <xsl:with-param name="replace" select="'#'" />
|
---|
1124 | <xsl:with-param name="with" select="'\#'" />
|
---|
1125 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1126 | </xsl:call-template>
|
---|
1127 | </xsl:variable>
|
---|
1128 | <xsl:variable name="subst10">
|
---|
1129 | <xsl:call-template name="str:subst">
|
---|
1130 | <xsl:with-param name="text" select="$subst9" />
|
---|
1131 | <xsl:with-param name="replace" select="'~'" />
|
---|
1132 | <xsl:with-param name="with" select="'\textasciitilde{}'" />
|
---|
1133 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1134 | </xsl:call-template>
|
---|
1135 | </xsl:variable>
|
---|
1136 | <xsl:variable name="subst11">
|
---|
1137 | <xsl:call-template name="str:subst">
|
---|
1138 | <xsl:with-param name="text" select="$subst10" />
|
---|
1139 | <xsl:with-param name="replace" select="'&'" />
|
---|
1140 | <xsl:with-param name="with" select="'\&'" />
|
---|
1141 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1142 | </xsl:call-template>
|
---|
1143 | </xsl:variable>
|
---|
1144 | <xsl:choose>
|
---|
1145 | <xsl:when test="parent::arg or parent::command">
|
---|
1146 | <xsl:variable name="subst12">
|
---|
1147 | <xsl:call-template name="str:subst">
|
---|
1148 | <xsl:with-param name="text" select="$subst10" />
|
---|
1149 | <xsl:with-param name="replace" select="' '" />
|
---|
1150 | <xsl:with-param name="with" select="'~'" />
|
---|
1151 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1152 | </xsl:call-template>
|
---|
1153 | </xsl:variable>
|
---|
1154 | <xsl:value-of select="$subst12" />
|
---|
1155 | </xsl:when>
|
---|
1156 | <xsl:otherwise>
|
---|
1157 | <xsl:value-of select="$subst11" />
|
---|
1158 | </xsl:otherwise>
|
---|
1159 | </xsl:choose>
|
---|
1160 | </xsl:when>
|
---|
1161 |
|
---|
1162 | <xsl:when test="(name(..)='address') or (name(../..)='address')">
|
---|
1163 | <xsl:variable name="subst5">
|
---|
1164 | <xsl:call-template name="str:subst">
|
---|
1165 | <xsl:with-param name="text" select="$subst4" />
|
---|
1166 | <xsl:with-param name="replace" select="'
'" />
|
---|
1167 | <xsl:with-param name="with" select="' \\'" />
|
---|
1168 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1169 | </xsl:call-template>
|
---|
1170 | </xsl:variable>
|
---|
1171 | <xsl:value-of select="$subst5" />
|
---|
1172 | </xsl:when>
|
---|
1173 |
|
---|
1174 | <!-- <screen> and <programlisting>, which work with alltt environment. -->
|
---|
1175 | <xsl:otherwise>
|
---|
1176 | <xsl:variable name="subst5">
|
---|
1177 | <xsl:call-template name="str:subst">
|
---|
1178 | <xsl:with-param name="text" select="$subst4" />
|
---|
1179 | <xsl:with-param name="replace" select="'_'" />
|
---|
1180 | <xsl:with-param name="with" select="'\_'" />
|
---|
1181 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1182 | </xsl:call-template>
|
---|
1183 | </xsl:variable>
|
---|
1184 | <xsl:variable name="subst6">
|
---|
1185 | <xsl:call-template name="str:subst">
|
---|
1186 | <xsl:with-param name="text" select="$subst5" />
|
---|
1187 | <xsl:with-param name="replace" select="'$'" />
|
---|
1188 | <xsl:with-param name="with" select="'\$'" />
|
---|
1189 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1190 | </xsl:call-template>
|
---|
1191 | </xsl:variable>
|
---|
1192 | <xsl:variable name="subst7">
|
---|
1193 | <xsl:call-template name="str:subst">
|
---|
1194 | <xsl:with-param name="text" select="$subst6" />
|
---|
1195 | <xsl:with-param name="replace" select="'%'" />
|
---|
1196 | <xsl:with-param name="with" select="'\%'" />
|
---|
1197 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1198 | </xsl:call-template>
|
---|
1199 | </xsl:variable>
|
---|
1200 | <xsl:variable name="subst8">
|
---|
1201 | <xsl:call-template name="str:subst">
|
---|
1202 | <xsl:with-param name="text" select="$subst7" />
|
---|
1203 | <xsl:with-param name="replace" select="'#'" />
|
---|
1204 | <xsl:with-param name="with" select="'\#'" />
|
---|
1205 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1206 | </xsl:call-template>
|
---|
1207 | </xsl:variable>
|
---|
1208 | <xsl:variable name="subst9">
|
---|
1209 | <xsl:call-template name="str:subst">
|
---|
1210 | <xsl:with-param name="text" select="$subst8" />
|
---|
1211 | <xsl:with-param name="replace" select="'µ'" />
|
---|
1212 | <xsl:with-param name="with" select="'$\mu$'" />
|
---|
1213 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1214 | </xsl:call-template>
|
---|
1215 | </xsl:variable>
|
---|
1216 | <xsl:variable name="subst10">
|
---|
1217 | <xsl:call-template name="str:subst">
|
---|
1218 | <xsl:with-param name="text" select="$subst9" />
|
---|
1219 | <xsl:with-param name="replace" select="'®'" />
|
---|
1220 | <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
|
---|
1221 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1222 | </xsl:call-template>
|
---|
1223 | </xsl:variable>
|
---|
1224 | <xsl:variable name="quote">"</xsl:variable>
|
---|
1225 | <!-- preparation for pretty quotes: replace all double quotes _outside_ screen
|
---|
1226 | sections with "\QUOTE{}" strings, which the makefile will then replace
|
---|
1227 | with pretty quotes by invoking sed a few times. Unfortunately there are
|
---|
1228 | no regular expressions in XSLT so there's no other way. -->
|
---|
1229 | <xsl:variable name="subst11">
|
---|
1230 | <xsl:choose>
|
---|
1231 | <xsl:when test="(name(..)='screen') or (name(../..)='screen')
|
---|
1232 | or (name(..)='programlisting') or (name(../..)='programlisting')
|
---|
1233 | or (name(..)='literal') or (name(../..)='literal')
|
---|
1234 | ">
|
---|
1235 | <xsl:value-of select="$subst10" />
|
---|
1236 | </xsl:when>
|
---|
1237 | <xsl:otherwise>
|
---|
1238 | <xsl:call-template name="str:subst">
|
---|
1239 | <xsl:with-param name="text" select="$subst10" />
|
---|
1240 | <xsl:with-param name="replace" select="$quote" />
|
---|
1241 | <xsl:with-param name="with" select="'\QUOTE{}'" />
|
---|
1242 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1243 | </xsl:call-template>
|
---|
1244 | </xsl:otherwise>
|
---|
1245 | </xsl:choose>
|
---|
1246 | </xsl:variable>
|
---|
1247 | <xsl:variable name="subst12">
|
---|
1248 | <xsl:call-template name="str:subst">
|
---|
1249 | <xsl:with-param name="text" select="$subst11" />
|
---|
1250 | <xsl:with-param name="replace" select="'~'" />
|
---|
1251 | <xsl:with-param name="with" select="'\textasciitilde{}'" />
|
---|
1252 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1253 | </xsl:call-template>
|
---|
1254 | </xsl:variable>
|
---|
1255 | <xsl:variable name="subst13">
|
---|
1256 | <xsl:call-template name="str:subst">
|
---|
1257 | <xsl:with-param name="text" select="$subst12" />
|
---|
1258 | <xsl:with-param name="replace" select="'&'" />
|
---|
1259 | <xsl:with-param name="with" select="'\&'" />
|
---|
1260 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1261 | </xsl:call-template>
|
---|
1262 | </xsl:variable>
|
---|
1263 | <xsl:value-of select="$subst13" />
|
---|
1264 | </xsl:otherwise>
|
---|
1265 | </xsl:choose>
|
---|
1266 | </xsl:template>
|
---|
1267 |
|
---|
1268 | <!--
|
---|
1269 | xsltprocNewlineOutputHack - emits a single new line.
|
---|
1270 |
|
---|
1271 | Hack Alert! This template helps xsltproc split up the output text elements
|
---|
1272 | and avoid reallocating them into the MB range. Calls to this
|
---|
1273 | template is made occationally while generating larger output
|
---|
1274 | file. It's not necessary for small stuff like header.
|
---|
1275 |
|
---|
1276 | The trick we're playing on xsltproc has to do with CDATA
|
---|
1277 | and/or the escape setting of the xsl:text element. It forces
|
---|
1278 | xsltproc to allocate a new output element, thus preventing
|
---|
1279 | things from growing out of proportions and slowing us down.
|
---|
1280 |
|
---|
1281 | This was successfully employed to reduce a 18+ seconds run to
|
---|
1282 | around one second (possibly less due to kmk overhead).
|
---|
1283 | -->
|
---|
1284 | <xsl:template name="xsltprocNewlineOutputHack">
|
---|
1285 | <xsl:text disable-output-escaping="yes"><![CDATA[
|
---|
1286 | ]]></xsl:text>
|
---|
1287 | </xsl:template>
|
---|
1288 |
|
---|
1289 | </xsl:stylesheet>
|
---|
1290 |
|
---|