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

\backmatter
\chapter{Glossary}
</xsl:text>
|
---|
552 | <xsl:apply-templates />
|
---|
553 | </xsl:template>
|
---|
554 |
|
---|
555 | <xsl:template match="para">
|
---|
556 | <xsl:if test="not(name(..)='footnote' or name(..)='note' or name(..)='warning' or (name(../..)='varlistentry' and position()=1))">
|
---|
557 | <xsl:text>

</xsl:text>
|
---|
558 | </xsl:if>
|
---|
559 | <xsl:apply-templates />
|
---|
560 | </xsl:template>
|
---|
561 |
|
---|
562 | <xsl:template match="note">
|
---|
563 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
566 | </xsl:template>
|
---|
567 |
|
---|
568 | <xsl:template match="warning">
|
---|
569 | <xsl:value-of select="concat('

\vspace{.2cm}

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

\vspace{.2cm}

</xsl:text>
|
---|
572 | </xsl:template>
|
---|
573 |
|
---|
574 | <xsl:template match="screen">
|
---|
575 | <xsl:text>

{\footnotesize\begin{alltt}
</xsl:text>
|
---|
576 | <xsl:apply-templates />
|
---|
577 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
578 | </xsl:template>
|
---|
579 |
|
---|
580 | <xsl:template match="programlisting">
|
---|
581 | <xsl:text>

{\small\begin{alltt}
</xsl:text>
|
---|
582 | <xsl:apply-templates />
|
---|
583 | <xsl:text>
\end{alltt}}
</xsl:text>
|
---|
584 | </xsl:template>
|
---|
585 |
|
---|
586 | <xsl:template match="footnote">
|
---|
587 | <xsl:text>\footnote{</xsl:text>
|
---|
588 | <xsl:apply-templates />
|
---|
589 | <xsl:text>}</xsl:text>
|
---|
590 | </xsl:template>
|
---|
591 |
|
---|
592 | <xsl:template match="tgroup">
|
---|
593 | <xsl:choose>
|
---|
594 | <xsl:when test="@style='verywide'">
|
---|
595 | <xsl:text>

{\small\begin{center}
\begin{tabulary}{1.1\textwidth}[]</xsl:text>
|
---|
596 | </xsl:when>
|
---|
597 | <xsl:otherwise>
|
---|
598 | <xsl:text>

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

\item[{\parbox[t]{\linewidth}{\raggedright </xsl:text>
|
---|
689 | <xsl:apply-templates select="./term[1]"/>
|
---|
690 | <xsl:for-each select="./term[position() > 1]">
|
---|
691 | <xsl:text>\\
 </xsl:text>
|
---|
692 | <xsl:apply-templates select="."/>
|
---|
693 | </xsl:for-each>
|
---|
694 | <xsl:text>}}] \hfill \\
</xsl:text>
|
---|
695 | <xsl:apply-templates select="listitem/*"/>
|
---|
696 | </xsl:template>
|
---|
697 |
|
---|
698 | <xsl:template match="listitem">
|
---|
699 | <xsl:text>

\item </xsl:text>
|
---|
700 | <xsl:apply-templates />
|
---|
701 | <xsl:text>
</xsl:text>
|
---|
702 | </xsl:template>
|
---|
703 |
|
---|
704 | <xsl:template match="glossterm">
|
---|
705 | <xsl:variable name="refid" select="(@id)" />
|
---|
706 | <xsl:if test="$refid">
|
---|
707 | <xsl:value-of select="concat('
\label{', $refid, '}')" />
|
---|
708 | </xsl:if>
|
---|
709 | <xsl:text>

\item[</xsl:text>
|
---|
710 | <xsl:apply-templates />
|
---|
711 | <xsl:text>]</xsl:text>
|
---|
712 | </xsl:template>
|
---|
713 |
|
---|
714 | <xsl:template match="glosslist | glossdiv">
|
---|
715 | <xsl:text>

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