2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
4
<!--############################################################################
5
XSLT Stylesheet DocBook -> LaTeX
6
############################################################################ -->
8
<xsl:param name="filename.as.url">1</xsl:param>
9
<xsl:param name="monoseq.hyphenation">1</xsl:param>
10
<xsl:param name="monoseq.small">0</xsl:param>
13
<xsl:template name="inline.setup">
14
<xsl:if test="$monoseq.hyphenation='nohyphen'">
15
<xsl:text>\sloppy </xsl:text>
19
<xsl:template name="inline.boldseq">
20
<xsl:param name="content">
21
<xsl:apply-templates/>
23
<xsl:text>\textbf{</xsl:text>
24
<xsl:copy-of select="$content"/>
25
<xsl:text>}</xsl:text>
28
<xsl:template name="inline.italicseq">
29
<xsl:param name="content">
30
<xsl:apply-templates/>
32
<xsl:text>\emph{</xsl:text>
33
<xsl:copy-of select="$content"/>
34
<xsl:text>}</xsl:text>
37
<!-- Cela prend plus de temps que la version qui suit... Bizarre.
38
<xsl:template name="inline.monoseq">
39
<xsl:text>\texttt{</xsl:text>
40
<xsl:apply-templates/>
41
<xsl:text>}</xsl:text>
44
<xsl:template name="inline.italicmonoseq">
45
<xsl:text>\texttt{\emph{</xsl:text>
46
<xsl:apply-templates/>
47
<xsl:text>}}</xsl:text>
51
<xsl:template name="inline.charseq">
52
<xsl:param name="content">
53
<xsl:apply-templates/>
55
<xsl:copy-of select="$content"/>
58
<xsl:template name="inline.boldmonoseq">
59
<xsl:param name="content">
60
<xsl:apply-templates/>
62
<xsl:text>{\ttfamily\bfseries{</xsl:text>
63
<xsl:copy-of select="$content"/>
64
<xsl:text>}}</xsl:text>
67
<xsl:template name="inline.superscriptseq">
68
<xsl:param name="content">
69
<xsl:apply-templates/>
71
<xsl:text>$^{\text{</xsl:text>
72
<xsl:copy-of select="$content"/>
73
<xsl:text>}}$</xsl:text>
76
<xsl:template name="inline.subscriptseq">
77
<xsl:param name="content">
78
<xsl:apply-templates/>
80
<xsl:text>$_{\text{</xsl:text>
81
<xsl:copy-of select="$content"/>
82
<xsl:text>}}$</xsl:text>
85
<xsl:template name="inline.monoseq">
86
<xsl:param name="content">
87
<xsl:apply-templates/>
89
<xsl:text>\texttt{</xsl:text>
90
<xsl:if test="not($monoseq.small = '0')">
91
<xsl:text>\small{</xsl:text>
94
<xsl:when test="$monoseq.hyphenation='1'">
95
<xsl:text><h></xsl:text>
96
<xsl:copy-of select="$content"/>
97
<xsl:text></h></xsl:text>
100
<xsl:copy-of select="$content"/>
103
<xsl:if test="not($monoseq.small = '0')">
104
<xsl:text>}</xsl:text>
106
<xsl:text>}</xsl:text>
109
<xsl:template name="inline.italicmonoseq">
110
<xsl:param name="content">
111
<xsl:apply-templates/>
113
<xsl:text>\texttt{\emph{\small{</xsl:text>
115
<xsl:when test="$monoseq.hyphenation='1'">
116
<xsl:text><h></xsl:text>
117
<xsl:copy-of select="$content"/>
118
<xsl:text></h></xsl:text>
121
<xsl:copy-of select="$content"/>
124
<xsl:text>}}}</xsl:text>
127
<xsl:template name="inline.underlineseq">
128
<xsl:param name="content">
129
<xsl:apply-templates/>
131
<xsl:text>\underline{</xsl:text>
132
<xsl:copy-of select="$content"/>
133
<xsl:text>}</xsl:text>
136
<!-- ==================================================================== -->
137
<!-- some special cases -->
139
<xsl:template match="author|editor|othercredit|personname">
140
<xsl:call-template name="person.name"/>
143
<xsl:template match="authorinitials">
144
<xsl:call-template name="inline.charseq"/>
147
<xsl:template match="authorgroup">
148
<xsl:variable name="string">
149
<xsl:call-template name="person.name.list"/>
151
<xsl:value-of select="normalize-space($string)"/>
154
<!-- ==================================================================== -->
156
<xsl:template match="accel">
157
<xsl:call-template name="inline.charseq"/>
160
<xsl:template match="action">
161
<xsl:call-template name="inline.charseq"/>
164
<xsl:template match="application">
165
<xsl:call-template name="inline.charseq"/>
168
<xsl:template match="classname">
169
<xsl:call-template name="inline.monoseq"/>
172
<xsl:template match="code">
173
<xsl:call-template name="inline.monoseq"/>
176
<xsl:template match="exceptionname">
177
<xsl:call-template name="inline.monoseq"/>
180
<xsl:template match="interfacename">
181
<xsl:call-template name="inline.monoseq"/>
184
<xsl:template match="methodname">
185
<xsl:call-template name="inline.monoseq"/>
188
<xsl:template match="command">
189
<xsl:call-template name="inline.boldseq"/>
192
<xsl:template match="computeroutput">
193
<xsl:call-template name="inline.monoseq"/>
196
<xsl:template match="constant">
197
<xsl:call-template name="inline.monoseq"/>
200
<xsl:template match="database">
201
<xsl:call-template name="inline.charseq"/>
204
<xsl:template match="errorcode">
205
<xsl:call-template name="inline.charseq"/>
208
<xsl:template match="errorname">
209
<xsl:call-template name="inline.charseq"/>
212
<xsl:template match="errortype">
213
<xsl:call-template name="inline.charseq"/>
216
<xsl:template match="envar">
217
<xsl:call-template name="inline.monoseq"/>
220
<xsl:template match="filename">
222
<!-- \Url cannot stand in a section heading -->
223
<xsl:when test="$filename.as.url='1' and
224
not(ancestor::title or ancestor::refentrytitle)">
225
<!-- Guess hyperref is always used now. -->
226
<xsl:call-template name="nolinkurl-output">
227
<xsl:with-param name="url" select="."/>
231
<xsl:call-template name="inline.monoseq"/>
236
<xsl:template match="function">
238
<xsl:when test="$function.parens != '0'
239
or parameter or function or replaceable">
240
<xsl:variable name="nodes" select="text()|*"/>
241
<xsl:call-template name="inline.monoseq">
242
<xsl:with-param name="content">
243
<xsl:apply-templates select="$nodes[1]"/>
246
<xsl:text>(</xsl:text>
247
<xsl:apply-templates select="$nodes[position()>1]"/>
248
<xsl:text>)</xsl:text>
251
<xsl:call-template name="inline.monoseq"/>
256
<xsl:template match="function/parameter" priority="2">
257
<xsl:call-template name="inline.italicmonoseq"/>
258
<xsl:if test="following-sibling::*">
259
<xsl:text>, </xsl:text>
263
<xsl:template match="function/replaceable" priority="2">
264
<xsl:call-template name="inline.italicmonoseq"/>
265
<xsl:if test="following-sibling::*">
266
<xsl:text>, </xsl:text>
270
<xsl:template match="replaceable" priority="1">
271
<xsl:call-template name="inline.italicmonoseq"/>
274
<xsl:template match="guibutton">
275
<xsl:call-template name="inline.charseq"/>
278
<xsl:template match="guiicon">
279
<xsl:call-template name="inline.charseq"/>
282
<xsl:template match="guilabel">
283
<xsl:call-template name="inline.charseq"/>
286
<xsl:template match="guimenu">
287
<xsl:call-template name="inline.charseq"/>
290
<xsl:template match="guimenuitem">
291
<xsl:call-template name="inline.charseq"/>
294
<xsl:template match="guisubmenu">
295
<xsl:call-template name="inline.charseq"/>
298
<xsl:template match="hardware">
299
<xsl:call-template name="inline.charseq"/>
302
<xsl:template match="interface">
303
<xsl:call-template name="inline.charseq"/>
306
<xsl:template match="interfacedefinition">
307
<xsl:call-template name="inline.charseq"/>
310
<xsl:template match="keycap">
311
<xsl:call-template name="inline.boldseq"/>
314
<xsl:template match="keycode">
315
<xsl:call-template name="inline.charseq"/>
318
<xsl:template match="keysym">
319
<xsl:call-template name="inline.charseq"/>
322
<xsl:template match="literal">
323
<xsl:call-template name="inline.monoseq"/>
326
<xsl:template match="medialabel">
327
<xsl:call-template name="inline.italicseq"/>
330
<xsl:template match="mousebutton">
331
<xsl:call-template name="inline.charseq"/>
334
<xsl:template match="option">
335
<xsl:call-template name="inline.monoseq"/>
338
<xsl:template match="package">
339
<xsl:call-template name="inline.monoseq"/>
342
<xsl:template match="parameter">
343
<xsl:call-template name="inline.italicmonoseq"/>
346
<xsl:template match="property">
347
<xsl:call-template name="inline.charseq"/>
350
<xsl:template match="prompt">
351
<xsl:call-template name="inline.monoseq"/>
354
<xsl:template match="returnvalue">
355
<xsl:call-template name="inline.charseq"/>
358
<xsl:template match="shortcut">
359
<xsl:call-template name="inline.boldseq"/>
362
<xsl:template match="structfield">
363
<xsl:call-template name="inline.italicmonoseq"/>
366
<xsl:template match="structname">
367
<xsl:call-template name="inline.charseq"/>
370
<xsl:template match="symbol">
371
<xsl:call-template name="inline.charseq"/>
374
<xsl:template match="systemitem">
375
<xsl:call-template name="inline.monoseq"/>
378
<xsl:template match="token">
379
<xsl:call-template name="inline.charseq"/>
382
<xsl:template match="type">
383
<xsl:call-template name="inline.charseq"/>
386
<xsl:template match="uri">
387
<xsl:call-template name="inline.monoseq"/>
390
<xsl:template match="userinput">
391
<xsl:call-template name="inline.boldmonoseq"/>
394
<xsl:template match="abbrev">
395
<xsl:call-template name="inline.charseq"/>
398
<xsl:template match="acronym">
399
<xsl:call-template name="inline.charseq"/>
402
<xsl:template match="citerefentry">
403
<xsl:call-template name="inline.charseq"/>
406
<xsl:template match="citetitle">
407
<xsl:call-template name="inline.italicseq"/>
410
<xsl:template match="emphasis">
411
<xsl:call-template name="inline.italicseq"/>
414
<xsl:template match="emphasis[@role='bold' or @role='strong']">
415
<xsl:call-template name="inline.boldseq"/>
418
<xsl:template match="emphasis[@role='underline']">
419
<xsl:call-template name="inline.underlineseq"/>
422
<xsl:template match="errortext">
423
<xsl:call-template name="inline.charseq"/>
426
<xsl:template match="firstname|surname|honorific|othername|lineage">
427
<xsl:apply-templates/>
430
<xsl:template match="foreignphrase">
431
<xsl:call-template name="inline.italicseq"/>
434
<xsl:template match="markup">
435
<xsl:call-template name="inline.charseq"/>
438
<xsl:template match="phrase">
439
<xsl:call-template name="inline.charseq"/>
442
<xsl:template match="quote">
443
<xsl:variable name="depth">
444
<xsl:call-template name="dot.count">
445
<xsl:with-param name="string">
446
<xsl:number level="multiple"/>
452
<xsl:when test="$depth mod 2 = 0">
453
<xsl:call-template name="gentext.startquote"/>
454
<xsl:call-template name="inline.charseq"/>
455
<xsl:call-template name="gentext.endquote"/>
458
<xsl:call-template name="gentext.nestedstartquote"/>
459
<xsl:call-template name="inline.charseq"/>
460
<xsl:call-template name="gentext.nestedendquote"/>
465
<xsl:template match="varname">
466
<xsl:call-template name="inline.monoseq"/>
469
<xsl:template match="wordasword">
470
<xsl:call-template name="inline.italicseq"/>
473
<xsl:template match="lineannotation">
474
<xsl:call-template name="inline.charseq"/>
477
<xsl:template match="superscript">
478
<xsl:call-template name="inline.superscriptseq"/>
481
<xsl:template match="subscript">
482
<xsl:call-template name="inline.subscriptseq"/>
485
<xsl:template match="trademark">
486
<xsl:call-template name="inline.charseq"/>
487
<xsl:call-template name="dingbat">
488
<xsl:with-param name="dingbat">trademark</xsl:with-param>
492
<xsl:template match="trademark[@class='copyright' or
493
@class='registered']">
494
<xsl:call-template name="inline.charseq"/>
495
<xsl:call-template name="dingbat">
496
<xsl:with-param name="dingbat" select="@class"/>
500
<xsl:template match="trademark[@class='service']">
501
<xsl:call-template name="inline.charseq"/>
502
<xsl:call-template name="inline.superscriptseq">
503
<xsl:with-param name="content" select="'SM'"/>
507
<xsl:template match="firstterm|glossterm">
508
<xsl:variable name="termtext">
509
<xsl:call-template name="inline.italicseq"/>
513
<xsl:when test="@linkend">
514
<xsl:call-template name="hyperlink.markup">
515
<xsl:with-param name="linkend" select="@linkend"/>
516
<xsl:with-param name="text" select="$termtext"/>
519
<xsl:when test="$glossterm.auto.link != 0">
520
<xsl:variable name="term">
522
<xsl:when test="@baseform">
523
<xsl:value-of select="normalize-space(@baseform)"/>
526
<xsl:value-of select="normalize-space(.)"/>
530
<xsl:variable name="glossentry"
531
select="(//glossentry[normalize-space(glossterm)=$term or
532
normalize-space(glossterm/@baseform)=$term][@id])[1]"/>
534
<xsl:when test="$glossentry">
535
<xsl:call-template name="hyperlink.markup">
536
<xsl:with-param name="linkend" select="$glossentry/@id"/>
537
<xsl:with-param name="text" select="$termtext"/>
542
<xsl:text>Error: no ID glossentry for glossterm: </xsl:text>
543
<xsl:value-of select="."/>
544
<xsl:text>.</xsl:text>
546
<xsl:value-of select="$termtext"/>
551
<xsl:value-of select="$termtext"/>
556
<xsl:template match="keycombo">
557
<xsl:variable name="action" select="@action"/>
558
<xsl:variable name="joinchar">
560
<xsl:when test="$action='seq'"><xsl:text> </xsl:text></xsl:when>
561
<xsl:when test="$action='simul'">+</xsl:when>
562
<xsl:when test="$action='press'">-</xsl:when>
563
<xsl:when test="$action='click'">-</xsl:when>
564
<xsl:when test="$action='double-click'">-</xsl:when>
565
<xsl:when test="$action='other'"></xsl:when>
566
<xsl:otherwise>-</xsl:otherwise>
569
<xsl:for-each select="./*">
570
<xsl:if test="position()>1"><xsl:value-of select="$joinchar"/></xsl:if>
571
<xsl:apply-templates/>
575
<xsl:strip-space elements="menuchoice shortcut"/>
577
<xsl:template match="menuchoice">
578
<xsl:variable name="shortcut" select="./shortcut"/>
579
<!-- print the menuchoice tree -->
580
<xsl:for-each select="*[not(self::shortcut)]">
581
<xsl:if test="position() > 1">
583
<xsl:when test="self::guimenuitem or self::guisubmenu">
584
<xsl:text>\hspace{2pt}\ensuremath{\to{}}</xsl:text>
586
<xsl:otherwise>+</xsl:otherwise>
589
<xsl:apply-templates select="."/>
591
<!-- now, the shortcut if any -->
592
<xsl:if test="$shortcut">
593
<xsl:text> (</xsl:text>
594
<xsl:apply-templates select="$shortcut"/>
595
<xsl:text>)</xsl:text>
599
<xsl:template match="jobtitle|corpauthor|orgname|orgdiv">
600
<xsl:apply-templates/>
603
<!-- ==================================================================== -->
605
<xsl:template match="optional">
606
<xsl:value-of select="$arg.choice.opt.open.str"/>
607
<xsl:call-template name="inline.charseq"/>
608
<xsl:value-of select="$arg.choice.opt.close.str"/>
611
<!-- ==================================================================== -->
613
<xsl:template match="comment|remark">
614
<xsl:if test="$show.comments != 0">
615
<xsl:text>\comment</xsl:text>
616
<xsl:if test="@role">
617
<xsl:text>[title={</xsl:text>
618
<xsl:value-of select="@role"/>
619
<xsl:text>}]</xsl:text>
621
<xsl:text>{</xsl:text>
622
<xsl:variable name="string">
623
<xsl:apply-templates/>
625
<xsl:value-of select="normalize-space($string)"/>
626
<xsl:text>}</xsl:text>
630
<!-- ==================================================================== -->
632
<xsl:template match="productname">
633
<xsl:call-template name="inline.charseq"/>
636
<xsl:template match="productnumber">
637
<xsl:call-template name="inline.charseq"/>
640
<!-- ==================================================================== -->
642
<xsl:template match="pob|street|city|state|postcode|country|phone|fax|otheraddr">
643
<xsl:call-template name="inline.charseq"/>
646
<!-- ==================================================================== -->
647
<!-- inline elements in program listings -->
649
<xsl:template name="verbatim.boldseq">
650
<xsl:param name="co-tagin" select="'<'"/>
651
<xsl:param name="rnode" select="/"/>
652
<xsl:param name="probe" select="0"/>
653
<xsl:param name="style" select="'b'"/>
654
<xsl:param name="content"/>
656
<xsl:call-template name="verbatim.format">
657
<xsl:with-param name="co-tagin" select="$co-tagin"/>
658
<xsl:with-param name="rnode" select="$rnode"/>
659
<xsl:with-param name="probe" select="$probe"/>
660
<xsl:with-param name="style" select="'b'"/>
661
<xsl:with-param name="content" select="$content"/>
665
<xsl:template match="userinput" mode="latex.programlisting">
666
<xsl:param name="co-tagin" select="'<:'"/>
667
<xsl:param name="rnode" select="/"/>
668
<xsl:param name="probe" select="0"/>
670
<xsl:call-template name="verbatim.boldseq">
671
<xsl:with-param name="co-tagin" select="$co-tagin"/>
672
<xsl:with-param name="rnode" select="$rnode"/>
673
<xsl:with-param name="probe" select="$probe"/>
677
<xsl:template match="emphasis" mode="latex.programlisting">
678
<xsl:param name="co-tagin" select="'<:'"/>
679
<xsl:param name="rnode" select="/"/>
680
<xsl:param name="probe" select="0"/>
682
<xsl:variable name="style">
684
<xsl:when test="@role='bold' or @role='strong'">
685
<xsl:value-of select="'b'"/>
688
<xsl:value-of select="'i'"/>
693
<xsl:call-template name="verbatim.format">
694
<xsl:with-param name="co-tagin" select="$co-tagin"/>
695
<xsl:with-param name="rnode" select="$rnode"/>
696
<xsl:with-param name="probe" select="$probe"/>
697
<xsl:with-param name="style" select="$style"/>
701
<xsl:template match="replaceable" mode="latex.programlisting">
702
<xsl:param name="co-tagin" select="'<:'"/>
703
<xsl:param name="rnode" select="/"/>
704
<xsl:param name="probe" select="0"/>
706
<xsl:call-template name="verbatim.format">
707
<xsl:with-param name="co-tagin" select="$co-tagin"/>
708
<xsl:with-param name="rnode" select="$rnode"/>
709
<xsl:with-param name="probe" select="$probe"/>
710
<xsl:with-param name="style" select="'i'"/>
714
<xsl:template match="optional" mode="latex.programlisting">
715
<xsl:param name="co-tagin" select="'<:'"/>
716
<xsl:param name="rnode" select="/"/>
717
<xsl:param name="probe" select="0"/>
719
<xsl:value-of select="$arg.choice.opt.open.str"/>
720
<xsl:apply-templates mode="latex.programlisting">
721
<xsl:with-param name="co-tagin" select="$co-tagin"/>
722
<xsl:with-param name="rnode" select="$rnode"/>
723
<xsl:with-param name="probe" select="$probe"/>
724
</xsl:apply-templates>
725
<xsl:value-of select="$arg.choice.opt.close.str"/>