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

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

\backmatter
\chapter{Glossary}
</xsl:text>
|
---|
472 | <xsl:apply-templates />
|
---|
473 | </xsl:template>
|
---|
474 |
|
---|
475 | <xsl:template match="para">
|
---|
476 | <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or (name(../..)='varlistentry' and position()=1))">
|
---|
477 | <xsl:text>

</xsl:text>
|
---|
478 | </xsl:if>
|
---|
479 | <xsl:apply-templates />
|
---|
480 | </xsl:template>
|
---|
481 |
|
---|
482 | <xsl:template match="note">
|
---|
483 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
486 | </xsl:template>
|
---|
487 |
|
---|
488 | <xsl:template match="warning">
|
---|
489 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
492 | </xsl:template>
|
---|
493 |
|
---|
494 | <xsl:template match="screen">
|
---|
495 | <xsl:text>

\begin{Verbatim}[fontsize=\footnotesize]
</xsl:text>
|
---|
496 | <xsl:apply-templates />
|
---|
497 | <xsl:text>
\end{Verbatim}
</xsl:text>
|
---|
498 | </xsl:template>
|
---|
499 |
|
---|
500 | <xsl:template match="programlisting">
|
---|
501 | <xsl:text>

{\small\begin{alltt}
</xsl:text>
|
---|
502 | <xsl:apply-templates />
|
---|
503 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
504 | </xsl:template>
|
---|
505 |
|
---|
506 | <xsl:template match="footnote">
|
---|
507 | <xsl:text>\footnote{</xsl:text>
|
---|
508 | <xsl:apply-templates />
|
---|
509 | <xsl:text>}</xsl:text>
|
---|
510 | </xsl:template>
|
---|
511 |
|
---|
512 | <xsl:template match="tgroup">
|
---|
513 | <xsl:choose>
|
---|
514 | <xsl:when test="@style='verywide'">
|
---|
515 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{1.1\textwidth}[]</xsl:text>
|
---|
516 | </xsl:when>
|
---|
517 | <xsl:otherwise>
|
---|
518 | <xsl:text>

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

\item[{\parbox[t]{\linewidth}{\raggedright </xsl:text>
|
---|
609 | <xsl:apply-templates select="./term[1]"/>
|
---|
610 | <xsl:for-each select="./term[position() > 1]">
|
---|
611 | <xsl:text>\\
 </xsl:text>
|
---|
612 | <xsl:apply-templates select="."/>
|
---|
613 | </xsl:for-each>
|
---|
614 | <xsl:text>}}] \hfill \\
</xsl:text>
|
---|
615 | <xsl:apply-templates select="listitem/*"/>
|
---|
616 | </xsl:template>
|
---|
617 |
|
---|
618 | <xsl:template match="listitem">
|
---|
619 | <xsl:text>

\item </xsl:text>
|
---|
620 | <xsl:apply-templates />
|
---|
621 | <xsl:text>
</xsl:text>
|
---|
622 | </xsl:template>
|
---|
623 |
|
---|
624 | <xsl:template match="glossterm">
|
---|
625 | <xsl:variable name="refid" select="(@id)" />
|
---|
626 | <xsl:if test="$refid">
|
---|
627 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
628 | </xsl:if>
|
---|
629 | <xsl:text>

\item[</xsl:text>
|
---|
630 | <xsl:apply-templates />
|
---|
631 | <xsl:text>]</xsl:text>
|
---|
632 | </xsl:template>
|
---|
633 |
|
---|
634 | <xsl:template match="glosslist | glossdiv">
|
---|
635 | <xsl:text>

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