1 | <?xml version="1.0"?>
|
---|
2 |
|
---|
3 | <!--
|
---|
4 | docbook2latex.xslt:
|
---|
5 | translates a DocBook XML source into a LaTeX source file,
|
---|
6 | which can be processed with pdflatex to produce a
|
---|
7 | pretty PDF file.
|
---|
8 |
|
---|
9 | Note: In the LaTeX output, this XSLT encodes all quotes
|
---|
10 | with \QUOTE{} commands, which are not defined in this
|
---|
11 | file. This is because XSLT does not support regular
|
---|
12 | expressions natively and therefore it is rather difficult
|
---|
13 | to implement proper "pretty quotes" (different glyphs for
|
---|
14 | opening and closing quotes) in XSLT. The doc/manual/
|
---|
15 | makefile solves this by running sed over the LaTeX source
|
---|
16 | once more, replacing all \QUOTE{} commands with
|
---|
17 | \OQ{} and \CQ{} commands, which _are_ defined to the
|
---|
18 | pretty quotes for English in the LaTeX output generated
|
---|
19 | by this XSLT (see below).
|
---|
20 |
|
---|
21 | Copyright (C) 2006-2012 Oracle Corporation
|
---|
22 |
|
---|
23 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
24 | available from http://www.virtualbox.org. This file is free software;
|
---|
25 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
26 | General Public License (GPL) as published by the Free Software
|
---|
27 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
28 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
29 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
30 | -->
|
---|
31 |
|
---|
32 | <xsl:stylesheet
|
---|
33 | version="1.0"
|
---|
34 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
35 | xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
---|
36 | xmlns:str="http://xsltsl.org/string"
|
---|
37 | >
|
---|
38 |
|
---|
39 | <xsl:import href="string.xsl"/>
|
---|
40 | <xsl:import href="common-formatcfg.xsl"/>
|
---|
41 |
|
---|
42 | <xsl:variable name="g_nlsChapter">
|
---|
43 | <xsl:choose>
|
---|
44 | <xsl:when test="$TARGETLANG='de_DE'">Kapitel</xsl:when>
|
---|
45 | <xsl:when test="$TARGETLANG='fr_FR'">chapitre</xsl:when>
|
---|
46 | <xsl:when test="$TARGETLANG='en_US'">chapter</xsl:when>
|
---|
47 | <xsl:otherwise>
|
---|
48 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
49 | </xsl:otherwise>
|
---|
50 | </xsl:choose>
|
---|
51 | </xsl:variable>
|
---|
52 |
|
---|
53 | <xsl:variable name="g_nlsPage">
|
---|
54 | <xsl:choose>
|
---|
55 | <xsl:when test="$TARGETLANG='de_DE'">auf Seite</xsl:when>
|
---|
56 | <xsl:when test="$TARGETLANG='fr_FR'">page</xsl:when>
|
---|
57 | <xsl:when test="$TARGETLANG='en_US'">page</xsl:when>
|
---|
58 | <xsl:otherwise>
|
---|
59 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
60 | </xsl:otherwise>
|
---|
61 | </xsl:choose>
|
---|
62 | </xsl:variable>
|
---|
63 |
|
---|
64 | <xsl:variable name="g_nlsNote">
|
---|
65 | <xsl:choose>
|
---|
66 | <xsl:when test="$TARGETLANG='de_DE'">Hinweis</xsl:when>
|
---|
67 | <xsl:when test="$TARGETLANG='fr_FR'">Note</xsl:when>
|
---|
68 | <xsl:when test="$TARGETLANG='en_US'">Note</xsl:when>
|
---|
69 | <xsl:otherwise>
|
---|
70 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
71 | </xsl:otherwise>
|
---|
72 | </xsl:choose>
|
---|
73 | </xsl:variable>
|
---|
74 |
|
---|
75 | <xsl:variable name="g_nlsWarning">
|
---|
76 | <xsl:choose>
|
---|
77 | <xsl:when test="$TARGETLANG='de_DE'">Warnung</xsl:when>
|
---|
78 | <xsl:when test="$TARGETLANG='fr_FR'">Avertissement</xsl:when>
|
---|
79 | <xsl:when test="$TARGETLANG='en_US'">Warning</xsl:when>
|
---|
80 | <xsl:otherwise>
|
---|
81 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
82 | </xsl:otherwise>
|
---|
83 | </xsl:choose>
|
---|
84 | </xsl:variable>
|
---|
85 |
|
---|
86 | <xsl:output method="text"/>
|
---|
87 |
|
---|
88 | <xsl:strip-space elements="*"/>
|
---|
89 | <xsl:preserve-space elements="para"/>
|
---|
90 |
|
---|
91 | <xsl:template match="/book">
|
---|
92 | <xsl:text>
|
---|
93 | \documentclass[oneside,a4paper,10pt,DIV10]{scrbook}
|
---|
94 | \usepackage{geometry}
|
---|
95 | \geometry{top=3cm,bottom=4cm}
|
---|
96 | \usepackage{ucs}
|
---|
97 | \usepackage[utf8x]{inputenc}
|
---|
98 | \usepackage[T1]{fontenc}
|
---|
99 | \usepackage{tabulary}
|
---|
100 | \usepackage[pdftex,
|
---|
101 | a4paper,
|
---|
102 | colorlinks=true,
|
---|
103 | linkcolor=blue,
|
---|
104 | urlcolor=darkgreen,
|
---|
105 | bookmarksnumbered,
|
---|
106 | bookmarksopen=true,
|
---|
107 | bookmarksopenlevel=0,
|
---|
108 | hyperfootnotes=false,
|
---|
109 | plainpages=false,
|
---|
110 | pdfpagelabels
|
---|
111 | ]{hyperref}
|
---|
112 |
|
---|
113 | \usepackage{nameref}
|
---|
114 | \usepackage{graphicx}
|
---|
115 | \usepackage{hyperref}
|
---|
116 | \usepackage{fancybox}
|
---|
117 | \usepackage{alltt}
|
---|
118 | \usepackage{color}
|
---|
119 | \usepackage{scrextend}
|
---|
120 | \definecolor{darkgreen}{rgb}{0,0.6,0}
|
---|
121 | \tymin=21pt
|
---|
122 |
|
---|
123 | </xsl:text>
|
---|
124 | <xsl:if test="$TARGETLANG='de_DE'">\usepackage[ngerman]{babel} \PrerenderUnicode{ü}</xsl:if>
|
---|
125 | <!-- <xsl:if test="$TARGETLANG='fr_FR'">\usepackage[french]{babel} \FrenchItemizeSpacingfalse \renewcommand{\FrenchLabelItem}{\textbullet}</xsl:if>
|
---|
126 | this command is no longer understood by TexLive2008
|
---|
127 | -->
|
---|
128 | <xsl:text>
|
---|
129 |
|
---|
130 | % use Palatino as serif font:
|
---|
131 | % \usepackage{mathpazo}
|
---|
132 | \usepackage{charter}
|
---|
133 | % use Helvetica as sans-serif font:
|
---|
134 | \usepackage{helvet}
|
---|
135 |
|
---|
136 | % use Bera Mono (a variant of Bitstream Vera Mono) as typewriter font
|
---|
137 | % (requires texlive-fontsextra)
|
---|
138 | \usepackage[scaled]{beramono}
|
---|
139 | % previously: use Courier as typewriter font:
|
---|
140 | % \usepackage{courier}
|
---|
141 |
|
---|
142 | \definecolor{colNote}{rgb}{0,0,0}
|
---|
143 | \definecolor{colWarning}{rgb}{0,0,0}
|
---|
144 | \definecolor{colScreenFrame}{rgb}{0,0,0}
|
---|
145 | \definecolor{colScreenText}{rgb}{0,0,0}
|
---|
146 |
|
---|
147 | % number headings down to this level
|
---|
148 | \setcounter{secnumdepth}{3}
|
---|
149 | % more space for the section numbers
|
---|
150 | \makeatletter
|
---|
151 | \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.9em}}
|
---|
152 | \renewcommand*\l@subsection{\@dottedtocline{2}{4.4em}{3.8em}}
|
---|
153 | \renewcommand*\l@subsubsection{\@dottedtocline{3}{8.2em}{3.8em}}
|
---|
154 | \renewcommand*\@pnumwidth{1.7em}
|
---|
155 | \renewcommand*\@tocrmarg{5.0em}
|
---|
156 | \makeatother
|
---|
157 |
|
---|
158 | % more tolerance at 2nd wrap stage:
|
---|
159 | \tolerance = 1000
|
---|
160 | % allow 3rd wrap stage:
|
---|
161 | \emergencystretch = 10pt
|
---|
162 | % no Schusterjungen:
|
---|
163 | \clubpenalty = 10000
|
---|
164 | % no Hurenkinder:
|
---|
165 | \widowpenalty = 10000
|
---|
166 | \displaywidowpenalty = 10000
|
---|
167 | % max pdf compression:
|
---|
168 | \pdfcompresslevel9
|
---|
169 |
|
---|
170 | % opening and closing quotes: the OQ and CQ macros define this (and the makefile employs some sed magic also)
|
---|
171 | </xsl:text>
|
---|
172 | <xsl:choose>
|
---|
173 | <xsl:when test="$TARGETLANG='de_DE'">
|
---|
174 | <xsl:text>\newcommand\OQ{\texorpdfstring{\glqq}{"}} \newcommand\CQ{\texorpdfstring{\grqq}{"}} </xsl:text>
|
---|
175 | </xsl:when>
|
---|
176 | <xsl:when test="$TARGETLANG='fr_FR'">
|
---|
177 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
178 | </xsl:when>
|
---|
179 | <xsl:when test="$TARGETLANG='en_US'">
|
---|
180 | <xsl:text>\newcommand\OQ{\texorpdfstring{``}{"}} \newcommand\CQ{\texorpdfstring{''}{"}} </xsl:text>
|
---|
181 | </xsl:when>
|
---|
182 | <xsl:otherwise>
|
---|
183 | <xsl:message terminate="yes"><xsl:value-of select="concat('Invalid language ', $TARGETLANG)" /></xsl:message>
|
---|
184 | </xsl:otherwise>
|
---|
185 | </xsl:choose>
|
---|
186 |
|
---|
187 | <xsl:apply-templates />
|
---|
188 |
|
---|
189 | <xsl:text>
|
---|
190 | \end{document}
|
---|
191 | </xsl:text>
|
---|
192 |
|
---|
193 | </xsl:template>
|
---|
194 |
|
---|
195 | <xsl:template match="bookinfo">
|
---|
196 | <xsl:apply-templates />
|
---|
197 | <xsl:text>
\newcommand\docbookbookinfocopyright{\copyright{} \docbookbookinfocopyrightyear{} \docbookbookinfocopyrightholder{}}

|
---|
198 | \author{ \docbooktitleedition \\ %
|
---|
199 | \\ %
|
---|
200 | </xsl:text>
|
---|
201 | <xsl:if test="//bookinfo/address">
|
---|
202 | <xsl:text>\docbookbookinfoaddress \\ %
|
---|
203 | \\ %
|
---|
204 | </xsl:text>
|
---|
205 | </xsl:if>
|
---|
206 | <xsl:text>\docbookbookinfocopyright \\ %
|
---|
207 | }
|
---|
208 |
|
---|
209 | \title{\docbooktitle \\
|
---|
210 | \docbooksubtitle}
|
---|
211 | % \subtitle{\docbooksubtitle}
|
---|
212 | \hypersetup{pdfauthor=\docbookcorpauthor}
|
---|
213 | \hypersetup{pdftitle=\docbooktitle{} \docbooksubtitle{}}
|
---|
214 |
|
---|
215 | \hyphenation{da-ta-ba-ses}
|
---|
216 | \hyphenation{deb-conf}
|
---|
217 | \hyphenation{VirtualBox}
|
---|
218 |
|
---|
219 | \begin{document}
|
---|
220 | % \maketitle
|
---|
221 | %\begin{titlepage}
|
---|
222 | \thispagestyle{empty}
|
---|
223 | \begin{minipage}{\textwidth}
|
---|
224 | \begin{center}
|
---|
225 | \includegraphics[width=4cm]{images/vboxlogo.png}
|
---|
226 | \end{center}%
|
---|
227 | \vspace{10mm}
|
---|
228 |
|
---|
229 | {\fontsize{40pt}{40pt}\selectfont\rmfamily\bfseries%
|
---|
230 | \begin{center}
|
---|
231 | \docbooktitle
|
---|
232 | \end{center}%
|
---|
233 | \vspace{10mm}
|
---|
234 | }
|
---|
235 |
|
---|
236 | {\fontsize{30pt}{30pt}\selectfont\rmfamily\bfseries%
|
---|
237 | \begin{center}
|
---|
238 | \docbooksubtitle
|
---|
239 | \end{center}%
|
---|
240 | \vspace{10mm}
|
---|
241 | }
|
---|
242 |
|
---|
243 | {\fontsize{16pt}{20pt}\selectfont\rmfamily%
|
---|
244 | \begin{center}
|
---|
245 | </xsl:text>
|
---|
246 | <xsl:if test="//bookinfo/othercredit">
|
---|
247 | <xsl:text>\docbookbookinfoothercreditcontrib{}: \docbookbookinfoothercreditfirstname{} \docbookbookinfoothercreditsurname
|
---|
248 |
|
---|
249 | \vspace{8mm}
|
---|
250 | </xsl:text>
|
---|
251 | </xsl:if>
|
---|
252 | <xsl:text>\docbooktitleedition
|
---|
253 |
|
---|
254 | \vspace{2mm}
|
---|
255 |
|
---|
256 | \docbookbookinfocopyright
|
---|
257 |
|
---|
258 | \vspace{2mm}
|
---|
259 |
|
---|
260 | \docbookbookinfoaddress
|
---|
261 | \end{center}%
|
---|
262 | }
|
---|
263 |
|
---|
264 | %\end{titlepage}
|
---|
265 | \end{minipage}
|
---|
266 |
|
---|
267 | \tableofcontents
|
---|
268 | </xsl:text>
|
---|
269 | </xsl:template>
|
---|
270 |
|
---|
271 | <xsl:template match="subtitle">
|
---|
272 | <xsl:choose>
|
---|
273 | <xsl:when test="name(..)='bookinfo'">
|
---|
274 | <xsl:text>\newcommand\docbooksubtitle{</xsl:text>
|
---|
275 | <xsl:apply-templates />
|
---|
276 | <xsl:text>}</xsl:text>
|
---|
277 | </xsl:when>
|
---|
278 | </xsl:choose>
|
---|
279 | </xsl:template>
|
---|
280 |
|
---|
281 | <!--
|
---|
282 | Inserts \hypertarget{@id} that can be referenced via the /A "nameddest=@id"
|
---|
283 | command line or #nameddest=@id URL parameter.
|
---|
284 |
|
---|
285 | TODO: The placement of the target could be improved on. The raisebox
|
---|
286 | stuff is a crude hack to make it a little more acceptable. -->
|
---|
287 | <xsl:template name="title-wrapper">
|
---|
288 | <xsl:param name="texcmd" select="concat('\',name(..))"/>
|
---|
289 | <xsl:param name="refid" select="../@id"/>
|
---|
290 | <xsl:param name="role" select="../@role"/>
|
---|
291 |
|
---|
292 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
293 | <xsl:if test="$texcmd='\chapter' and $role='frontmatter'">
|
---|
294 | <xsl:text>\frontmatter
</xsl:text>
|
---|
295 | </xsl:if>
|
---|
296 | <xsl:if test="$texcmd='\chapter' and ../preceding-sibling::*[1][@role='frontmatter']">
|
---|
297 | <xsl:text>\mainmatter
</xsl:text>
|
---|
298 | </xsl:if>
|
---|
299 | <xsl:choose>
|
---|
300 | <xsl:when test="$refid">
|
---|
301 | <xsl:text>
</xsl:text>
|
---|
302 | <xsl:value-of select="$texcmd"/>
|
---|
303 | <xsl:if test="not(contains($texcmd, '*'))">
|
---|
304 | <xsl:text>[</xsl:text> <!-- for toc -->
|
---|
305 | <xsl:apply-templates />
|
---|
306 | <xsl:text>]</xsl:text>
|
---|
307 | </xsl:if>
|
---|
308 | <xsl:text>{</xsl:text> <!-- for doc -->
|
---|
309 | <xsl:text>\raisebox{\ht\strutbox}{\hypertarget{</xsl:text>
|
---|
310 | <xsl:value-of select="$refid"/>
|
---|
311 | <xsl:text>}{}}</xsl:text>
|
---|
312 | <xsl:apply-templates />
|
---|
313 | <xsl:text>}</xsl:text>
|
---|
314 | </xsl:when>
|
---|
315 | <xsl:otherwise>
|
---|
316 | <xsl:text>
</xsl:text><xsl:value-of select="$texcmd"/><xsl:text>{</xsl:text>
|
---|
317 | <xsl:apply-templates />
|
---|
318 | <xsl:text>}</xsl:text>
|
---|
319 | </xsl:otherwise>
|
---|
320 | </xsl:choose>
|
---|
321 | </xsl:template>
|
---|
322 |
|
---|
323 | <xsl:template match="title">
|
---|
324 | <xsl:variable name="refid" select="../@id" />
|
---|
325 | <xsl:choose>
|
---|
326 | <xsl:when test="name(..)='bookinfo'">
|
---|
327 | <xsl:text>\newcommand\docbooktitle{</xsl:text>
|
---|
328 | <xsl:apply-templates />
|
---|
329 | <xsl:text>}</xsl:text>
|
---|
330 | </xsl:when>
|
---|
331 | <xsl:when test="name(..)='chapter'">
|
---|
332 | <xsl:call-template name="title-wrapper"/>
|
---|
333 | </xsl:when>
|
---|
334 | <xsl:when test="name(..)='sect1' and ../../@role='frontmatter'">
|
---|
335 | <xsl:call-template name="title-wrapper">
|
---|
336 | <xsl:with-param name="texcmd">\section*</xsl:with-param>
|
---|
337 | </xsl:call-template>
|
---|
338 | </xsl:when>
|
---|
339 | <xsl:when test="name(..)='sect1'">
|
---|
340 | <xsl:call-template name="title-wrapper">
|
---|
341 | <xsl:with-param name="texcmd">\section</xsl:with-param>
|
---|
342 | </xsl:call-template>
|
---|
343 | </xsl:when>
|
---|
344 | <xsl:when test="parent::sect2[@role='not-in-toc'] or parent::refsect1 or (parent::section and count(ancestor::section) = 2)">
|
---|
345 | <xsl:call-template name="title-wrapper">
|
---|
346 | <xsl:with-param name="texcmd">\subsection*</xsl:with-param>
|
---|
347 | </xsl:call-template>
|
---|
348 | </xsl:when>
|
---|
349 | <xsl:when test="name(..)='sect2'">
|
---|
350 | <xsl:call-template name="title-wrapper">
|
---|
351 | <xsl:with-param name="texcmd">\subsection</xsl:with-param>
|
---|
352 | </xsl:call-template>
|
---|
353 | </xsl:when>
|
---|
354 | <xsl:when test="parent::sect3[@role='not-in-toc'] or parent::refsect2 or (parent::section and count(ancestor::section) = 3)">
|
---|
355 | <xsl:call-template name="title-wrapper">
|
---|
356 | <xsl:with-param name="texcmd">\subsubsection*</xsl:with-param>
|
---|
357 | </xsl:call-template>
|
---|
358 | </xsl:when>
|
---|
359 | <xsl:when test="name(..)='sect3'">
|
---|
360 | <xsl:call-template name="title-wrapper">
|
---|
361 | <xsl:with-param name="texcmd">\subsubsection</xsl:with-param>
|
---|
362 | </xsl:call-template>
|
---|
363 | </xsl:when>
|
---|
364 | <xsl:when test="parent::sect4[@role='not-in-toc'] or parent::refsect3 or (parent::section and count(ancestor::section) = 4)">
|
---|
365 | <xsl:call-template name="title-wrapper">
|
---|
366 | <xsl:with-param name="texcmd">\paragraph*</xsl:with-param>
|
---|
367 | </xsl:call-template>
|
---|
368 | </xsl:when>
|
---|
369 | <xsl:when test="name(..)='sect4'">
|
---|
370 | <xsl:call-template name="title-wrapper">
|
---|
371 | <xsl:with-param name="texcmd">\paragraph</xsl:with-param>
|
---|
372 | </xsl:call-template>
|
---|
373 | </xsl:when>
|
---|
374 | <xsl:when test="parent::sect5[@role='not-in-toc'] or parent::refsect4 or (parent::section and count(ancestor::section) = 5)">
|
---|
375 | <xsl:call-template name="title-wrapper">
|
---|
376 | <xsl:with-param name="texcmd">\subparagraph*</xsl:with-param>
|
---|
377 | </xsl:call-template>
|
---|
378 | </xsl:when>
|
---|
379 | <xsl:when test="name(..)='sect5'">
|
---|
380 | <xsl:call-template name="title-wrapper">
|
---|
381 | <xsl:with-param name="texcmd">\subparagraph</xsl:with-param>
|
---|
382 | </xsl:call-template>
|
---|
383 | </xsl:when>
|
---|
384 | <xsl:when test="name(..)='appendix'">
|
---|
385 | <xsl:call-template name="title-wrapper">
|
---|
386 | <xsl:with-param name="texcmd">\chapter</xsl:with-param>
|
---|
387 | </xsl:call-template>
|
---|
388 | </xsl:when>
|
---|
389 | <xsl:when test="name(..)='glossdiv'">
|
---|
390 | <xsl:call-template name="title-wrapper">
|
---|
391 | <xsl:with-param name="texcmd">\section*</xsl:with-param>
|
---|
392 | </xsl:call-template>
|
---|
393 | </xsl:when>
|
---|
394 | </xsl:choose>
|
---|
395 | <xsl:if test="$refid">
|
---|
396 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
397 | </xsl:if>
|
---|
398 | <xsl:text>
</xsl:text>
|
---|
399 | </xsl:template>
|
---|
400 |
|
---|
401 | <xsl:template match="edition">
|
---|
402 | <xsl:choose>
|
---|
403 | <xsl:when test="name(..)='bookinfo'">
|
---|
404 | <xsl:text>\newcommand\docbooktitleedition{</xsl:text>
|
---|
405 | <xsl:apply-templates />
|
---|
406 | <xsl:text>}
</xsl:text>
|
---|
407 | </xsl:when>
|
---|
408 | </xsl:choose>
|
---|
409 | </xsl:template>
|
---|
410 |
|
---|
411 | <xsl:template match="corpauthor">
|
---|
412 | <xsl:choose>
|
---|
413 | <xsl:when test="name(..)='bookinfo'">
|
---|
414 | <xsl:text>\newcommand\docbookcorpauthor{</xsl:text>
|
---|
415 | <xsl:apply-templates />
|
---|
416 | <xsl:text>}
</xsl:text>
|
---|
417 | </xsl:when>
|
---|
418 | </xsl:choose>
|
---|
419 | </xsl:template>
|
---|
420 |
|
---|
421 | <xsl:template match="address">
|
---|
422 | <xsl:choose>
|
---|
423 | <xsl:when test="name(..)='bookinfo'">
|
---|
424 | <xsl:text>\newcommand\docbookbookinfoaddress{</xsl:text>
|
---|
425 | <xsl:apply-templates />
|
---|
426 | <xsl:text>}
</xsl:text>
|
---|
427 | </xsl:when>
|
---|
428 | </xsl:choose>
|
---|
429 | </xsl:template>
|
---|
430 |
|
---|
431 | <xsl:template match="year">
|
---|
432 | <xsl:choose>
|
---|
433 | <xsl:when test="name(..)='copyright'">
|
---|
434 | <xsl:text>\newcommand\docbookbookinfocopyrightyear{</xsl:text>
|
---|
435 | <xsl:apply-templates />
|
---|
436 | <xsl:text>}
</xsl:text>
|
---|
437 | </xsl:when>
|
---|
438 | </xsl:choose>
|
---|
439 | </xsl:template>
|
---|
440 |
|
---|
441 | <xsl:template match="holder">
|
---|
442 | <xsl:choose>
|
---|
443 | <xsl:when test="name(..)='copyright'">
|
---|
444 | <xsl:text>\newcommand\docbookbookinfocopyrightholder{</xsl:text>
|
---|
445 | <xsl:apply-templates />
|
---|
446 | <xsl:text>}
</xsl:text>
|
---|
447 | </xsl:when>
|
---|
448 | </xsl:choose>
|
---|
449 | </xsl:template>
|
---|
450 |
|
---|
451 | <xsl:template match="firstname">
|
---|
452 | <xsl:choose>
|
---|
453 | <xsl:when test="name(..)='othercredit'">
|
---|
454 | <xsl:text>\newcommand\docbookbookinfoothercreditfirstname{</xsl:text>
|
---|
455 | <xsl:apply-templates />
|
---|
456 | <xsl:text>}
</xsl:text>
|
---|
457 | </xsl:when>
|
---|
458 | </xsl:choose>
|
---|
459 | </xsl:template>
|
---|
460 |
|
---|
461 | <xsl:template match="surname">
|
---|
462 | <xsl:choose>
|
---|
463 | <xsl:when test="name(..)='othercredit'">
|
---|
464 | <xsl:text>\newcommand\docbookbookinfoothercreditsurname{</xsl:text>
|
---|
465 | <xsl:apply-templates />
|
---|
466 | <xsl:text>}
</xsl:text>
|
---|
467 | </xsl:when>
|
---|
468 | </xsl:choose>
|
---|
469 | </xsl:template>
|
---|
470 |
|
---|
471 | <xsl:template match="contrib">
|
---|
472 | <xsl:choose>
|
---|
473 | <xsl:when test="name(..)='othercredit'">
|
---|
474 | <xsl:text>\newcommand\docbookbookinfoothercreditcontrib{</xsl:text>
|
---|
475 | <xsl:apply-templates />
|
---|
476 | <xsl:text>}
</xsl:text>
|
---|
477 | </xsl:when>
|
---|
478 | </xsl:choose>
|
---|
479 | </xsl:template>
|
---|
480 |
|
---|
481 | <xsl:template match="glossary">
|
---|
482 | <xsl:text>

\backmatter
\chapter{Glossary}
</xsl:text>
|
---|
483 | <xsl:apply-templates />
|
---|
484 | </xsl:template>
|
---|
485 |
|
---|
486 | <xsl:template match="para">
|
---|
487 | <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or (name(../..)='varlistentry' and position()=1))">
|
---|
488 | <xsl:text>

</xsl:text>
|
---|
489 | </xsl:if>
|
---|
490 | <xsl:apply-templates />
|
---|
491 | </xsl:template>
|
---|
492 |
|
---|
493 | <xsl:template match="note">
|
---|
494 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
497 | </xsl:template>
|
---|
498 |
|
---|
499 | <xsl:template match="warning">
|
---|
500 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
503 | </xsl:template>
|
---|
504 |
|
---|
505 | <xsl:template match="screen">
|
---|
506 | <xsl:text>

{\footnotesize\begin{alltt}
</xsl:text>
|
---|
507 | <xsl:apply-templates />
|
---|
508 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
509 | </xsl:template>
|
---|
510 |
|
---|
511 | <xsl:template match="programlisting">
|
---|
512 | <xsl:text>

{\small\begin{alltt}
</xsl:text>
|
---|
513 | <xsl:apply-templates />
|
---|
514 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
515 | </xsl:template>
|
---|
516 |
|
---|
517 | <xsl:template match="footnote">
|
---|
518 | <xsl:text>\footnote{</xsl:text>
|
---|
519 | <xsl:apply-templates />
|
---|
520 | <xsl:text>}</xsl:text>
|
---|
521 | </xsl:template>
|
---|
522 |
|
---|
523 | <xsl:template match="tgroup">
|
---|
524 | <xsl:choose>
|
---|
525 | <xsl:when test="@style='verywide'">
|
---|
526 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{1.1\textwidth}[]</xsl:text>
|
---|
527 | </xsl:when>
|
---|
528 | <xsl:otherwise>
|
---|
529 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{.9\textwidth}[]</xsl:text>
|
---|
530 | </xsl:otherwise>
|
---|
531 | </xsl:choose>
|
---|
532 | <xsl:text>{</xsl:text>
|
---|
533 | <xsl:choose>
|
---|
534 | <xsl:when test="@cols='1'">
|
---|
535 | <xsl:text>|L|</xsl:text>
|
---|
536 | </xsl:when>
|
---|
537 | <xsl:when test="@cols='2'">
|
---|
538 | <xsl:text>|L|L|</xsl:text>
|
---|
539 | </xsl:when>
|
---|
540 | <xsl:when test="@cols='3'">
|
---|
541 | <xsl:text>|L|L|L|</xsl:text>
|
---|
542 | </xsl:when>
|
---|
543 | <xsl:when test="@cols='4'">
|
---|
544 | <xsl:text>|L|L|L|L|</xsl:text>
|
---|
545 | </xsl:when>
|
---|
546 | <xsl:when test="@cols='5'">
|
---|
547 | <xsl:text>|L|L|L|L|L|</xsl:text>
|
---|
548 | </xsl:when>
|
---|
549 | <xsl:when test="@cols='6'">
|
---|
550 | <xsl:text>|L|L|L|L|L|L|</xsl:text>
|
---|
551 | </xsl:when>
|
---|
552 | <xsl:otherwise>
|
---|
553 | <xsl:message terminate="yes">Unsupported number of columns (<xsl:value-of select="@cols"/>), fix document or converter</xsl:message>
|
---|
554 | </xsl:otherwise>
|
---|
555 | </xsl:choose>
|
---|
556 | <xsl:text>}
\hline
</xsl:text>
|
---|
557 | <xsl:apply-templates />
|
---|
558 | <xsl:text>
\end{tabulary}
\end{center}}
</xsl:text>
|
---|
559 | </xsl:template>
|
---|
560 |
|
---|
561 | <xsl:template match="row">
|
---|
562 | <xsl:apply-templates />
|
---|
563 | <xsl:text>
\\ \hline
</xsl:text>
|
---|
564 | </xsl:template>
|
---|
565 |
|
---|
566 | <xsl:template match="entry">
|
---|
567 | <xsl:if test="not(position()=1)">
|
---|
568 | <xsl:text> & </xsl:text>
|
---|
569 | </xsl:if>
|
---|
570 | <xsl:apply-templates />
|
---|
571 | </xsl:template>
|
---|
572 |
|
---|
573 | <xsl:template match="itemizedlist">
|
---|
574 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
575 | <xsl:text>
\begin{itemize}
</xsl:text>
|
---|
576 | <xsl:if test="@spacing = 'compact'">
|
---|
577 | <xsl:text> \setlength{\parskip}{0pt}
</xsl:text>
|
---|
578 | <xsl:text> \setlength{\itemsep}{0pt}
</xsl:text>
|
---|
579 | <xsl:text> \setlength{\topsep}{0pt}
</xsl:text>
|
---|
580 | <xsl:text> \setlength{\parsep}{0pt}
</xsl:text>
|
---|
581 | <xsl:text> \setlength{\partopsep}{0pt}
</xsl:text>
|
---|
582 | </xsl:if>
|
---|
583 | <xsl:apply-templates />
|
---|
584 | <xsl:text>
\end{itemize}
</xsl:text>
|
---|
585 | </xsl:template>
|
---|
586 |
|
---|
587 | <xsl:template match="orderedlist">
|
---|
588 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
589 | <xsl:text>
\begin{enumerate}
</xsl:text>
|
---|
590 | <xsl:if test="@spacing = 'compact'">
|
---|
591 | <xsl:text> \setlength{\parskip}{0pt}
</xsl:text>
|
---|
592 | <xsl:text> \setlength{\itemsep}{0pt}
</xsl:text>
|
---|
593 | <xsl:text> \setlength{\topsep}{0pt}
</xsl:text>
|
---|
594 | <xsl:text> \setlength{\parsep}{0pt}
</xsl:text>
|
---|
595 | <xsl:text> \setlength{\partopsep}{0pt}
</xsl:text>
|
---|
596 | </xsl:if>
|
---|
597 | <xsl:apply-templates />
|
---|
598 | <xsl:text>
\end{enumerate}
</xsl:text>
|
---|
599 | </xsl:template>
|
---|
600 |
|
---|
601 | <xsl:template match="variablelist">
|
---|
602 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
603 | <xsl:text>
\begin{description}
</xsl:text>
|
---|
604 | <xsl:if test="@spacing = 'compact'">
|
---|
605 | <xsl:text> \setlength{\parskip}{0pt}
</xsl:text>
|
---|
606 | <xsl:text> \setlength{\itemsep}{0pt}
</xsl:text>
|
---|
607 | <xsl:text> \setlength{\topsep}{0pt}
</xsl:text>
|
---|
608 | <xsl:text> \setlength{\parsep}{0pt}
</xsl:text>
|
---|
609 | <xsl:text> \setlength{\partopsep}{0pt}
</xsl:text>
|
---|
610 | </xsl:if>
|
---|
611 | <xsl:apply-templates />
|
---|
612 | <xsl:text>
\end{description}
</xsl:text>
|
---|
613 | </xsl:template>
|
---|
614 |
|
---|
615 | <xsl:template match="varlistentry">
|
---|
616 | <xsl:if test="not(./term) or not(./listitem) or count(./listitem) != 1">
|
---|
617 | <xsl:message terminate="yes">Expected at least one term and one listitem element in the varlistentry.</xsl:message>
|
---|
618 | </xsl:if>
|
---|
619 | <xsl:text>

\item[{\parbox[t]{\linewidth}{\raggedright </xsl:text>
|
---|
620 | <xsl:apply-templates select="./term[1]"/>
|
---|
621 | <xsl:for-each select="./term[position() > 1]">
|
---|
622 | <xsl:text>\\
 </xsl:text>
|
---|
623 | <xsl:apply-templates select="."/>
|
---|
624 | </xsl:for-each>
|
---|
625 | <xsl:text>}}] \hfill \\
</xsl:text>
|
---|
626 | <xsl:apply-templates select="listitem/*"/>
|
---|
627 | </xsl:template>
|
---|
628 |
|
---|
629 | <xsl:template match="listitem">
|
---|
630 | <xsl:text>

\item </xsl:text>
|
---|
631 | <xsl:apply-templates />
|
---|
632 | <xsl:text>
</xsl:text>
|
---|
633 | </xsl:template>
|
---|
634 |
|
---|
635 | <xsl:template match="glossterm">
|
---|
636 | <xsl:variable name="refid" select="(@id)" />
|
---|
637 | <xsl:if test="$refid">
|
---|
638 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
639 | </xsl:if>
|
---|
640 | <xsl:text>

\item[</xsl:text>
|
---|
641 | <xsl:apply-templates />
|
---|
642 | <xsl:text>]</xsl:text>
|
---|
643 | </xsl:template>
|
---|
644 |
|
---|
645 | <xsl:template match="glosslist | glossdiv">
|
---|
646 | <xsl:text>

\begin{description}
</xsl:text>
|
---|
647 | <xsl:apply-templates />
|
---|
648 | <xsl:text>
\end{description}
</xsl:text>
|
---|
649 | </xsl:template>
|
---|
650 |
|
---|
651 | <xsl:template match="superscript">
|
---|
652 | <xsl:variable name="contents">
|
---|
653 | <xsl:apply-templates />
|
---|
654 | </xsl:variable>
|
---|
655 | <xsl:value-of select="concat('\texorpdfstring{\textsuperscript{', $contents, '}}{', $contents, '}')" />
|
---|
656 | </xsl:template>
|
---|
657 |
|
---|
658 | <xsl:template match="emphasis">
|
---|
659 | <xsl:choose>
|
---|
660 | <xsl:when test="@role='bold'">
|
---|
661 | <xsl:text>\textbf{</xsl:text>
|
---|
662 | </xsl:when>
|
---|
663 | <xsl:otherwise>
|
---|
664 | <xsl:text>\textit{</xsl:text>
|
---|
665 | </xsl:otherwise>
|
---|
666 | </xsl:choose>
|
---|
667 | <xsl:apply-templates />
|
---|
668 | <xsl:text>}</xsl:text>
|
---|
669 | </xsl:template>
|
---|
670 |
|
---|
671 | <xsl:template match="computeroutput | code">
|
---|
672 | <xsl:text>\texttt{</xsl:text>
|
---|
673 | <xsl:apply-templates />
|
---|
674 | <xsl:text>}</xsl:text>
|
---|
675 | </xsl:template>
|
---|
676 |
|
---|
677 | <xsl:template match="ulink">
|
---|
678 | <xsl:text>\url{</xsl:text>
|
---|
679 | <xsl:apply-templates />
|
---|
680 | <xsl:text>}</xsl:text>
|
---|
681 | </xsl:template>
|
---|
682 |
|
---|
683 | <xsl:template match="xref">
|
---|
684 | <xsl:choose>
|
---|
685 | <xsl:when test="@endterm">
|
---|
686 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
|
---|
687 | </xsl:when>
|
---|
688 | <xsl:otherwise>
|
---|
689 | <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
|
---|
690 | </xsl:otherwise>
|
---|
691 | </xsl:choose>
|
---|
692 | </xsl:template>
|
---|
693 |
|
---|
694 | <xsl:template match="link">
|
---|
695 | <xsl:choose>
|
---|
696 | <xsl:when test="@endterm">
|
---|
697 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{', @endterm, '}}')" />
|
---|
698 | </xsl:when>
|
---|
699 | <xsl:when test="./text()">
|
---|
700 | <xsl:value-of select="concat('\hyperref[', @linkend, ']{\mbox{')" />
|
---|
701 | <xsl:apply-templates select="./text()"/>
|
---|
702 | <xsl:value-of select="'}}'" />
|
---|
703 | </xsl:when>
|
---|
704 | <xsl:otherwise>
|
---|
705 | <xsl:value-of select="concat($g_nlsChapter, ' \ref{', @linkend, '}, \textit{\nameref{', @linkend, '}}, ', $g_nlsPage, ' \pageref{', @linkend, '}')" />
|
---|
706 | </xsl:otherwise>
|
---|
707 | </xsl:choose>
|
---|
708 | </xsl:template>
|
---|
709 |
|
---|
710 | <xsl:template match="trademark">
|
---|
711 | <xsl:apply-templates />
|
---|
712 | <xsl:text>\textsuperscript{\textregistered}</xsl:text>
|
---|
713 | </xsl:template>
|
---|
714 |
|
---|
715 | <!-- for some reason, DocBook insists of having image data nested this way always:
|
---|
716 | mediaobject -> imageobject -> imagedata
|
---|
717 | but only imagedata is interesting -->
|
---|
718 | <xsl:template match="imagedata">
|
---|
719 | <xsl:if test="@align='center'">
|
---|
720 | <xsl:text>\begin{center}</xsl:text>
|
---|
721 | </xsl:if>
|
---|
722 | <xsl:value-of select="concat('
\includegraphics[width=', @width, ']{', @fileref, '}
')" />
|
---|
723 | <xsl:apply-templates />
|
---|
724 | <xsl:if test="@align='center'">
|
---|
725 | <xsl:text>\end{center}</xsl:text>
|
---|
726 | </xsl:if>
|
---|
727 | </xsl:template>
|
---|
728 |
|
---|
729 | <!--
|
---|
730 | Turn the refsynopsisdiv part of a manpage into a named & indented paragraph.
|
---|
731 | -->
|
---|
732 | <xsl:template match="refsynopsisdiv">
|
---|
733 | <xsl:if test="name(*[1]) != 'cmdsynopsis'"><xsl:message terminate="yes">Expected refsynopsisdiv to start with cmdsynopsis</xsl:message></xsl:if>
|
---|
734 | <xsl:if test="title"><xsl:message terminate="yes">No title element supported in refsynopsisdiv</xsl:message></xsl:if>
|
---|
735 | <xsl:call-template name="xsltprocNewlineOutputHack"/>
|
---|
736 | <xsl:text>
\subsection*{Synopsis}</xsl:text>
|
---|
737 | <xsl:if test="name(*[1]) != 'cmdsynopsis'"> <!-- just in case -->
|
---|
738 | <xsl:text>\hfill \\
</xsl:text>
|
---|
739 | </xsl:if>
|
---|
740 | <xsl:text>
</xsl:text>
|
---|
741 | <xsl:apply-templates />
|
---|
742 | </xsl:template>
|
---|
743 |
|
---|
744 | <!--
|
---|
745 | The refsect1 is used for 'Description' and such. Do same as with refsynopsisdiv
|
---|
746 | and turn it into a named & indented paragraph.
|
---|
747 | -->
|
---|
748 | <xsl:template match="refsect1">
|
---|
749 | <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
|
---|
750 | <xsl:message terminate="yes">Expected exactly one title as the first refsect1 element (remarks goes after title!).</xsl:message>
|
---|
751 | </xsl:if>
|
---|
752 | <xsl:apply-templates/>
|
---|
753 | </xsl:template>
|
---|
754 |
|
---|
755 | <!--
|
---|
756 | The refsect2 element will be turned into a subparagraph if it has a title,
|
---|
757 | however, that didn't work out when it didn't have a title and started with
|
---|
758 | a cmdsynopsis instead (subcommand docs). So, we're doing some trickery
|
---|
759 | here (HACK ALERT) for the non-title case to feign a paragraph.
|
---|
760 | -->
|
---|
761 | <xsl:template match="refsect2">
|
---|
762 | <xsl:if test="name(*[1]) != 'title' or count(title) != 1">
|
---|
763 | <xsl:message terminate="yes">Expected exactly one title as the first refsect2 element (remarks goes after title!).</xsl:message>
|
---|
764 | </xsl:if>
|
---|
765 | <xsl:apply-templates/>
|
---|
766 | <xsl:text>
</xsl:text>
|
---|
767 | </xsl:template>
|
---|
768 |
|
---|
769 |
|
---|
770 | <!--
|
---|
771 | Command Synopsis elements.
|
---|
772 |
|
---|
773 | We treat each command element inside a cmdsynopsis as the start of
|
---|
774 | a new paragraph. The DocBook HTML converter does so too, but the
|
---|
775 | manpage one doesn't.
|
---|
776 |
|
---|
777 | sbr and linebreaks made by latex should be indented from the base
|
---|
778 | command level. This is done by the \hangindent3em\hangafter1 bits.
|
---|
779 |
|
---|
780 | We exploit the default paragraph indentation to get each command
|
---|
781 | indented from the left margin. This, unfortunately, doesn't work
|
---|
782 | if we're the first paragraph in a (sub*)section. \noindent cannot
|
---|
783 | counter this due to when latex enforces first paragraph stuff. Since
|
---|
784 | it's tedious to figure out when we're in the first paragraph and when
|
---|
785 | not, we just do \noindent\hspace{1em} everywhere.
|
---|
786 | -->
|
---|
787 | <xsl:template match="sbr">
|
---|
788 | <xsl:if test="not(ancestor::cmdsynopsis)">
|
---|
789 | <xsl:message terminate="yes">sbr only supported inside cmdsynopsis (because of hangindent)</xsl:message>
|
---|
790 | </xsl:if>
|
---|
791 | <xsl:text>\linebreak</xsl:text>
|
---|
792 | </xsl:template>
|
---|
793 |
|
---|
794 | <xsl:template match="refentry|refnamediv|refentryinfo|refmeta|refsect3|refsect4|refsect5|synopfragment|synopfragmentref|cmdsynopsis/info">
|
---|
795 | <xsl:message terminate="yes"><xsl:value-of select="name()"/> is not supported</xsl:message>
|
---|
796 | </xsl:template>
|
---|
797 |
|
---|
798 | <xsl:template match="cmdsynopsis">
|
---|
799 | <xsl:if test="preceding-sibling::cmdsynopsis">
|
---|
800 | <xsl:text>\par%cmdsynopsis</xsl:text>
|
---|
801 | </xsl:if>
|
---|
802 | <xsl:text>
</xsl:text>
|
---|
803 | <xsl:if test="parent::remark[@role='VBoxManage-overview']">
|
---|
804 | <!-- Overview fontsize trick -->
|
---|
805 | <xsl:text>{\footnotesize</xsl:text>
|
---|
806 | </xsl:if>
|
---|
807 | <xsl:text>\noindent\hspace{1em}</xsl:text>
|
---|
808 | <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
|
---|
809 | <xsl:apply-templates />
|
---|
810 | <xsl:text>}</xsl:text>
|
---|
811 | <xsl:if test="following-sibling::*">
|
---|
812 | </xsl:if>
|
---|
813 |
|
---|
814 | <!-- For refsect2 subcommand descriptions. -->
|
---|
815 | <xsl:if test="not(following-sibling::cmdsynopsis) and position() != last()">
|
---|
816 | <xsl:text>\linebreak</xsl:text>
|
---|
817 | </xsl:if>
|
---|
818 | <!-- Special overview trick for the current VBoxManage command overview. -->
|
---|
819 | <xsl:if test="parent::remark[@role='VBoxManage-overview']">
|
---|
820 | <xsl:text>}\vspace{1em}</xsl:text>
|
---|
821 | </xsl:if>
|
---|
822 | </xsl:template>
|
---|
823 |
|
---|
824 | <xsl:template match="command">
|
---|
825 | <xsl:choose>
|
---|
826 | <xsl:when test="ancestor::cmdsynopsis">
|
---|
827 | <!-- Trigger a line break if this isn't the first command in a the synopsis -->
|
---|
828 | <xsl:if test="preceding-sibling::command">
|
---|
829 | <xsl:text>}\par%command
</xsl:text>
|
---|
830 | <xsl:text>\noindent\hspace{1em}</xsl:text>
|
---|
831 | <xsl:text>\hangindent3em\hangafter1\texttt{</xsl:text>
|
---|
832 | </xsl:if>
|
---|
833 | <xsl:apply-templates />
|
---|
834 | </xsl:when>
|
---|
835 | <xsl:otherwise>
|
---|
836 | <xsl:text>\texttt{</xsl:text>
|
---|
837 | <xsl:apply-templates />
|
---|
838 | <xsl:text>}</xsl:text>
|
---|
839 | </xsl:otherwise>
|
---|
840 | </xsl:choose>
|
---|
841 | </xsl:template>
|
---|
842 |
|
---|
843 | <xsl:template match="option">
|
---|
844 | <xsl:choose>
|
---|
845 | <xsl:when test="ancestor::cmdsynopsis">
|
---|
846 | <xsl:apply-templates />
|
---|
847 | </xsl:when>
|
---|
848 | <xsl:otherwise>
|
---|
849 | <xsl:text>\texttt{</xsl:text>
|
---|
850 | <xsl:apply-templates />
|
---|
851 | <xsl:text>}</xsl:text>
|
---|
852 | </xsl:otherwise>
|
---|
853 | </xsl:choose>
|
---|
854 | </xsl:template>
|
---|
855 |
|
---|
856 | <!-- duplicated in docbook2latex.xsl -->
|
---|
857 | <xsl:template match="arg|group">
|
---|
858 | <!-- separator char if we're not the first child -->
|
---|
859 | <xsl:if test="position() > 1">
|
---|
860 | <xsl:choose>
|
---|
861 | <xsl:when test="parent::group"><xsl:value-of select="$arg.or.sep"/></xsl:when>
|
---|
862 | <xsl:when test="ancestor-or-self::*/@sepchar"><xsl:value-of select="ancestor-or-self::*/@sepchar"/></xsl:when>
|
---|
863 | <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
|
---|
864 | </xsl:choose>
|
---|
865 | </xsl:if>
|
---|
866 | <!-- open wrapping -->
|
---|
867 | <xsl:choose>
|
---|
868 | <xsl:when test="not(@choice) or @choice = ''"> <xsl:value-of select="$arg.choice.def.open.str"/></xsl:when>
|
---|
869 | <xsl:when test="@choice = 'opt'"> <xsl:value-of select="$arg.choice.opt.open.str"/></xsl:when>
|
---|
870 | <xsl:when test="@choice = 'req'"> <xsl:value-of select="$arg.choice.req.open.str"/></xsl:when>
|
---|
871 | <xsl:when test="@choice = 'plain'"/>
|
---|
872 | <xsl:otherwise><xsl:message terminate="yes">Invalid arg choice: "<xsl:value-of select="@choice"/>"</xsl:message></xsl:otherwise>
|
---|
873 | </xsl:choose>
|
---|
874 |
|
---|
875 | <!-- render the arg (TODO: may need to do more work here) -->
|
---|
876 | <xsl:apply-templates />
|
---|
877 |
|
---|
878 | <!-- repeat wrapping -->
|
---|
879 | <xsl:choose>
|
---|
880 | <xsl:when test="@rep = 'norepeat' or not(@rep) or @rep = ''"/>
|
---|
881 | <xsl:when test="@rep = 'repeat'"> <xsl:value-of select="$arg.rep.repeat.str"/></xsl:when>
|
---|
882 | <xsl:otherwise><xsl:message terminate="yes">Invalid rep choice: "<xsl:value-of select="@rep"/>"</xsl:message></xsl:otherwise>
|
---|
883 | </xsl:choose>
|
---|
884 | <!-- close wrapping -->
|
---|
885 | <xsl:choose>
|
---|
886 | <xsl:when test="not(@choice) or @choice = ''"> <xsl:value-of select="$arg.choice.def.close.str"/></xsl:when>
|
---|
887 | <xsl:when test="@choice = 'opt'"> <xsl:value-of select="$arg.choice.opt.close.str"/></xsl:when>
|
---|
888 | <xsl:when test="@choice = 'req'"> <xsl:value-of select="$arg.choice.req.close.str"/></xsl:when>
|
---|
889 | </xsl:choose>
|
---|
890 | </xsl:template>
|
---|
891 |
|
---|
892 | <xsl:template match="replaceable">
|
---|
893 | <xsl:choose>
|
---|
894 | <xsl:when test="(not(ancestor::cmdsynopsis) and not(ancestor::option) and not(ancestor::screen)) or ancestor::arg">
|
---|
895 | <xsl:text>\texttt{\textit{</xsl:text>
|
---|
896 | <xsl:apply-templates />
|
---|
897 | <xsl:text>}}</xsl:text>
|
---|
898 | </xsl:when>
|
---|
899 | <xsl:otherwise>
|
---|
900 | <xsl:text>\textit{<</xsl:text>
|
---|
901 | <xsl:apply-templates />
|
---|
902 | <xsl:text>>}</xsl:text>
|
---|
903 | </xsl:otherwise>
|
---|
904 | </xsl:choose>
|
---|
905 | </xsl:template>
|
---|
906 |
|
---|
907 |
|
---|
908 | <!--
|
---|
909 | Generic element text magic.
|
---|
910 | -->
|
---|
911 | <xsl:template match="//text()">
|
---|
912 |
|
---|
913 | <!-- Do the translation of \ into \textbackslash{} in two steps, to avoid
|
---|
914 | running into replacing {} as well which would be very wrong. -->
|
---|
915 | <xsl:variable name="subst1">
|
---|
916 | <xsl:call-template name="str:subst">
|
---|
917 | <xsl:with-param name="text" select="." />
|
---|
918 | <xsl:with-param name="replace" select="'\'" />
|
---|
919 | <xsl:with-param name="with" select="'\textbackslash'" />
|
---|
920 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
921 | </xsl:call-template>
|
---|
922 | </xsl:variable>
|
---|
923 | <xsl:variable name="subst2">
|
---|
924 | <xsl:call-template name="str:subst">
|
---|
925 | <xsl:with-param name="text" select="$subst1" />
|
---|
926 | <xsl:with-param name="replace" select="'{'" />
|
---|
927 | <xsl:with-param name="with" select="'\{'" />
|
---|
928 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
929 | </xsl:call-template>
|
---|
930 | </xsl:variable>
|
---|
931 | <xsl:variable name="subst3">
|
---|
932 | <xsl:call-template name="str:subst">
|
---|
933 | <xsl:with-param name="text" select="$subst2" />
|
---|
934 | <xsl:with-param name="replace" select="'}'" />
|
---|
935 | <xsl:with-param name="with" select="'\}'" />
|
---|
936 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
937 | </xsl:call-template>
|
---|
938 | </xsl:variable>
|
---|
939 | <xsl:variable name="subst4">
|
---|
940 | <xsl:call-template name="str:subst">
|
---|
941 | <xsl:with-param name="text" select="$subst3" />
|
---|
942 | <xsl:with-param name="replace" select="'\textbackslash'" />
|
---|
943 | <xsl:with-param name="with" select="'\textbackslash{}'" />
|
---|
944 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
945 | </xsl:call-template>
|
---|
946 | </xsl:variable>
|
---|
947 |
|
---|
948 | <xsl:choose>
|
---|
949 | <xsl:when test="(name(..) = 'computeroutput') or (name(../..) = 'computeroutput')
|
---|
950 | or (name(..) = 'code') or (name(../..) = 'code')
|
---|
951 | or (name(..) = 'arg') or (name(../..) = 'arg')
|
---|
952 | or (name(..) = 'option') or (name(../..) = 'option')
|
---|
953 | or (name(..) = 'command') or (name(../..) = 'command')
|
---|
954 | or (name(..) = 'cmdsynopsis') or (name(../..) = 'cmdsynopsis')
|
---|
955 | or (name(..) = 'replaceable') or (name(../..) = 'replaceable')
|
---|
956 | ">
|
---|
957 | <xsl:variable name="subst5">
|
---|
958 | <xsl:call-template name="str:subst">
|
---|
959 | <xsl:with-param name="text" select="translate(normalize-space(concat('',$subst4,'')),'','')" />
|
---|
960 | <xsl:with-param name="replace" select="'--'" />
|
---|
961 | <xsl:with-param name="with" select="'-{}-'" />
|
---|
962 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
963 | </xsl:call-template>
|
---|
964 | </xsl:variable>
|
---|
965 | <xsl:variable name="subst6">
|
---|
966 | <xsl:call-template name="str:subst">
|
---|
967 | <xsl:with-param name="text" select="$subst5" />
|
---|
968 | <xsl:with-param name="replace" select="'_'" />
|
---|
969 | <xsl:with-param name="with" select="'\_'" />
|
---|
970 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
971 | </xsl:call-template>
|
---|
972 | </xsl:variable>
|
---|
973 | <xsl:variable name="subst7">
|
---|
974 | <xsl:call-template name="str:subst">
|
---|
975 | <xsl:with-param name="text" select="$subst6" />
|
---|
976 | <xsl:with-param name="replace" select="'$'" />
|
---|
977 | <xsl:with-param name="with" select="'\$'" />
|
---|
978 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
979 | </xsl:call-template>
|
---|
980 | </xsl:variable>
|
---|
981 | <xsl:variable name="subst8">
|
---|
982 | <xsl:call-template name="str:subst">
|
---|
983 | <xsl:with-param name="text" select="$subst7" />
|
---|
984 | <xsl:with-param name="replace" select="'%'" />
|
---|
985 | <xsl:with-param name="with" select="'\%'" />
|
---|
986 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
987 | </xsl:call-template>
|
---|
988 | </xsl:variable>
|
---|
989 | <xsl:variable name="subst9">
|
---|
990 | <xsl:call-template name="str:subst">
|
---|
991 | <xsl:with-param name="text" select="$subst8" />
|
---|
992 | <xsl:with-param name="replace" select="'#'" />
|
---|
993 | <xsl:with-param name="with" select="'\#'" />
|
---|
994 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
995 | </xsl:call-template>
|
---|
996 | </xsl:variable>
|
---|
997 | <xsl:variable name="subst10">
|
---|
998 | <xsl:call-template name="str:subst">
|
---|
999 | <xsl:with-param name="text" select="$subst9" />
|
---|
1000 | <xsl:with-param name="replace" select="'~'" />
|
---|
1001 | <xsl:with-param name="with" select="'\textasciitilde{}'" />
|
---|
1002 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1003 | </xsl:call-template>
|
---|
1004 | </xsl:variable>
|
---|
1005 | <xsl:variable name="subst11">
|
---|
1006 | <xsl:call-template name="str:subst">
|
---|
1007 | <xsl:with-param name="text" select="$subst10" />
|
---|
1008 | <xsl:with-param name="replace" select="'&'" />
|
---|
1009 | <xsl:with-param name="with" select="'\&'" />
|
---|
1010 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1011 | </xsl:call-template>
|
---|
1012 | </xsl:variable>
|
---|
1013 | <xsl:choose>
|
---|
1014 | <xsl:when test="parent::arg or parent::command">
|
---|
1015 | <xsl:variable name="subst12">
|
---|
1016 | <xsl:call-template name="str:subst">
|
---|
1017 | <xsl:with-param name="text" select="$subst10" />
|
---|
1018 | <xsl:with-param name="replace" select="' '" />
|
---|
1019 | <xsl:with-param name="with" select="'~'" />
|
---|
1020 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1021 | </xsl:call-template>
|
---|
1022 | </xsl:variable>
|
---|
1023 | <xsl:value-of select="$subst12" />
|
---|
1024 | </xsl:when>
|
---|
1025 | <xsl:otherwise>
|
---|
1026 | <xsl:value-of select="$subst11" />
|
---|
1027 | </xsl:otherwise>
|
---|
1028 | </xsl:choose>
|
---|
1029 | </xsl:when>
|
---|
1030 |
|
---|
1031 | <xsl:when test="(name(..)='address') or (name(../..)='address')">
|
---|
1032 | <xsl:variable name="subst5">
|
---|
1033 | <xsl:call-template name="str:subst">
|
---|
1034 | <xsl:with-param name="text" select="$subst4" />
|
---|
1035 | <xsl:with-param name="replace" select="'
'" />
|
---|
1036 | <xsl:with-param name="with" select="' \\'" />
|
---|
1037 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1038 | </xsl:call-template>
|
---|
1039 | </xsl:variable>
|
---|
1040 | <xsl:value-of select="$subst5" />
|
---|
1041 | </xsl:when>
|
---|
1042 |
|
---|
1043 | <!-- <screen> and <programlisting>, which work with alltt environment. -->
|
---|
1044 | <xsl:otherwise>
|
---|
1045 | <xsl:variable name="subst5">
|
---|
1046 | <xsl:call-template name="str:subst">
|
---|
1047 | <xsl:with-param name="text" select="$subst4" />
|
---|
1048 | <xsl:with-param name="replace" select="'_'" />
|
---|
1049 | <xsl:with-param name="with" select="'\_'" />
|
---|
1050 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1051 | </xsl:call-template>
|
---|
1052 | </xsl:variable>
|
---|
1053 | <xsl:variable name="subst6">
|
---|
1054 | <xsl:call-template name="str:subst">
|
---|
1055 | <xsl:with-param name="text" select="$subst5" />
|
---|
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="subst7">
|
---|
1062 | <xsl:call-template name="str:subst">
|
---|
1063 | <xsl:with-param name="text" select="$subst6" />
|
---|
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="subst8">
|
---|
1070 | <xsl:call-template name="str:subst">
|
---|
1071 | <xsl:with-param name="text" select="$subst7" />
|
---|
1072 | <xsl:with-param name="replace" select="'#'" />
|
---|
1073 | <xsl:with-param name="with" select="'\#'" />
|
---|
1074 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1075 | </xsl:call-template>
|
---|
1076 | </xsl:variable>
|
---|
1077 | <xsl:variable name="subst9">
|
---|
1078 | <xsl:call-template name="str:subst">
|
---|
1079 | <xsl:with-param name="text" select="$subst8" />
|
---|
1080 | <xsl:with-param name="replace" select="'µ'" />
|
---|
1081 | <xsl:with-param name="with" select="'$\mu$'" />
|
---|
1082 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1083 | </xsl:call-template>
|
---|
1084 | </xsl:variable>
|
---|
1085 | <xsl:variable name="subst10">
|
---|
1086 | <xsl:call-template name="str:subst">
|
---|
1087 | <xsl:with-param name="text" select="$subst9" />
|
---|
1088 | <xsl:with-param name="replace" select="'®'" />
|
---|
1089 | <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
|
---|
1090 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1091 | </xsl:call-template>
|
---|
1092 | </xsl:variable>
|
---|
1093 | <xsl:variable name="quote">"</xsl:variable>
|
---|
1094 | <!-- preparation for pretty quotes: replace all double quotes _outside_ screen
|
---|
1095 | sections with "\QUOTE{}" strings, which the makefile will then replace
|
---|
1096 | with pretty quotes by invoking sed a few times. Unfortunately there are
|
---|
1097 | no regular expressions in XSLT so there's no other way. -->
|
---|
1098 | <xsl:variable name="subst11">
|
---|
1099 | <xsl:choose>
|
---|
1100 | <xsl:when test="(name(..)='screen') or (name(../..)='screen')
|
---|
1101 | or (name(..)='programlisting') or (name(../..)='programlisting')
|
---|
1102 | ">
|
---|
1103 | <xsl:value-of select="$subst10" />
|
---|
1104 | </xsl:when>
|
---|
1105 | <xsl:otherwise>
|
---|
1106 | <xsl:call-template name="str:subst">
|
---|
1107 | <xsl:with-param name="text" select="$subst10" />
|
---|
1108 | <xsl:with-param name="replace" select="$quote" />
|
---|
1109 | <xsl:with-param name="with" select="'\QUOTE{}'" />
|
---|
1110 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1111 | </xsl:call-template>
|
---|
1112 | </xsl:otherwise>
|
---|
1113 | </xsl:choose>
|
---|
1114 | </xsl:variable>
|
---|
1115 | <xsl:variable name="subst12">
|
---|
1116 | <xsl:call-template name="str:subst">
|
---|
1117 | <xsl:with-param name="text" select="$subst11" />
|
---|
1118 | <xsl:with-param name="replace" select="'~'" />
|
---|
1119 | <xsl:with-param name="with" select="'\textasciitilde{}'" />
|
---|
1120 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1121 | </xsl:call-template>
|
---|
1122 | </xsl:variable>
|
---|
1123 | <xsl:variable name="subst13">
|
---|
1124 | <xsl:call-template name="str:subst">
|
---|
1125 | <xsl:with-param name="text" select="$subst12" />
|
---|
1126 | <xsl:with-param name="replace" select="'&'" />
|
---|
1127 | <xsl:with-param name="with" select="'\&'" />
|
---|
1128 | <xsl:with-param name="disable-output-escaping" select="no" />
|
---|
1129 | </xsl:call-template>
|
---|
1130 | </xsl:variable>
|
---|
1131 | <xsl:value-of select="$subst13" />
|
---|
1132 | </xsl:otherwise>
|
---|
1133 | </xsl:choose>
|
---|
1134 | </xsl:template>
|
---|
1135 |
|
---|
1136 | <!--
|
---|
1137 | xsltprocNewlineOutputHack - emits a single new line.
|
---|
1138 |
|
---|
1139 | Hack Alert! This template helps xsltproc split up the output text elements
|
---|
1140 | and avoid reallocating them into the MB range. Calls to this
|
---|
1141 | template is made occationally while generating larger output
|
---|
1142 | file. It's not necessary for small stuff like header.
|
---|
1143 |
|
---|
1144 | The trick we're playing on xsltproc has to do with CDATA
|
---|
1145 | and/or the escape setting of the xsl:text element. It forces
|
---|
1146 | xsltproc to allocate a new output element, thus preventing
|
---|
1147 | things from growing out of proportions and slowing us down.
|
---|
1148 |
|
---|
1149 | This was successfully employed to reduce a 18+ seconds run to
|
---|
1150 | around one second (possibly less due to kmk overhead).
|
---|
1151 | -->
|
---|
1152 | <xsl:template name="xsltprocNewlineOutputHack">
|
---|
1153 | <xsl:text disable-output-escaping="yes"><![CDATA[
|
---|
1154 | ]]></xsl:text>
|
---|
1155 | </xsl:template>
|
---|
1156 |
|
---|
1157 | </xsl:stylesheet>
|
---|
1158 |
|
---|