source: clfs-sysroot/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/fo/inline.xsl @ a18aefd

Last change on this file since a18aefd was a18aefd, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added lfs-xsl stylesheets.

  • Property mode set to 100644
File size: 37.2 KB
Line 
1<?xml version='1.0'?>
2<!DOCTYPE xsl:stylesheet [
3  <!ENTITY comment.block.parents "parent::answer|parent::appendix|parent::article|parent::bibliodiv|
4                                  parent::bibliography|parent::blockquote|parent::caution|parent::chapter|
5                                  parent::glossary|parent::glossdiv|parent::important|parent::index|
6                                  parent::indexdiv|parent::listitem|parent::note|parent::orderedlist|
7                                  parent::partintro|parent::preface|parent::procedure|parent::qandadiv|
8                                  parent::qandaset|parent::question|parent::refentry|parent::refnamediv|
9                                  parent::refsect1|parent::refsect2|parent::refsect3|parent::refsection|
10                                  parent::refsynopsisdiv|parent::sect1|parent::sect2|parent::sect3|parent::sect4|
11                                  parent::sect5|parent::section|parent::setindex|parent::sidebar|
12                                  parent::simplesect|parent::taskprerequisites|parent::taskrelated|
13                                  parent::tasksummary|parent::warning">
14]>
15<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16                xmlns:fo="http://www.w3.org/1999/XSL/Format"
17                xmlns:xlink='http://www.w3.org/1999/xlink'
18                exclude-result-prefixes="xlink"
19                version='1.0'>
20
21<!-- ********************************************************************
22     $Id$
23     ********************************************************************
24
25     This file is part of the XSL DocBook Stylesheet distribution.
26     See ../README or http://docbook.sf.net/release/xsl/current/ for
27     copyright and other information.
28
29     ******************************************************************** -->
30
31<xsl:template name="simple.xlink">
32  <xsl:param name="node" select="."/>
33  <xsl:param name="content">
34    <xsl:apply-templates/>
35  </xsl:param>
36  <xsl:param name="linkend" select="$node/@linkend"/>
37  <xsl:param name="xhref" select="$node/@xlink:href"/>
38
39  <xsl:choose>
40    <xsl:when test="$xhref
41                    and (not($node/@xlink:type) or
42                         $node/@xlink:type='simple')">
43
44      <!-- Is it a local idref? -->
45      <xsl:variable name="is.idref">
46        <xsl:choose>
47          <!-- if the href starts with # and does not contain an "(" -->
48          <!-- or if the href starts with #xpointer(id(, it's just an ID -->
49          <xsl:when test="starts-with($xhref,'#')
50                          and (not(contains($xhref,'&#40;'))
51                          or starts-with($xhref,
52                                     '#xpointer&#40;id&#40;'))">1</xsl:when>
53          <xsl:otherwise>0</xsl:otherwise>
54        </xsl:choose>
55      </xsl:variable>
56
57      <!-- Is it an olink ? -->
58      <xsl:variable name="is.olink">
59        <xsl:choose>
60          <!-- If xlink:role="http://docbook.org/xlink/role/olink" -->
61          <!-- and if the href contains # -->
62          <xsl:when test="contains($xhref,'#') and
63               @xlink:role = $xolink.role">1</xsl:when>
64          <xsl:otherwise>0</xsl:otherwise>
65        </xsl:choose>
66      </xsl:variable>
67
68      <xsl:choose>
69        <xsl:when test="$is.idref = 1">
70
71          <xsl:variable name="idref">
72            <xsl:call-template name="xpointer.idref">
73              <xsl:with-param name="xpointer" select="$xhref"/>
74            </xsl:call-template>
75          </xsl:variable>
76
77          <xsl:variable name="targets" select="key('id',$idref)"/>
78          <xsl:variable name="target" select="$targets[1]"/>
79
80          <xsl:call-template name="check.id.unique">
81            <xsl:with-param name="linkend" select="$idref"/>
82          </xsl:call-template>
83
84          <xsl:choose>
85            <xsl:when test="count($target) = 0">
86              <xsl:message>
87                <xsl:text>XLink to nonexistent id: </xsl:text>
88                <xsl:value-of select="$idref"/>
89              </xsl:message>
90              <xsl:copy-of select="$content"/>
91            </xsl:when>
92
93            <xsl:otherwise>
94              <fo:basic-link internal-destination="{$idref}">
95                <xsl:copy-of select="$content"/>
96              </fo:basic-link>
97            </xsl:otherwise>
98          </xsl:choose>
99        </xsl:when>
100
101        <xsl:when test="$is.olink = 1">
102          <xsl:call-template name="olink">
103            <xsl:with-param name="content" select="$content"/>
104          </xsl:call-template>
105        </xsl:when>
106
107        <!-- otherwise it's a URI -->
108        <xsl:otherwise>
109          <fo:basic-link external-destination="url({$xhref})">
110            <xsl:copy-of select="$content"/>
111          </fo:basic-link>
112        </xsl:otherwise>
113      </xsl:choose>
114    </xsl:when>
115
116    <xsl:when test="$linkend">
117      <xsl:variable name="targets" select="key('id',$linkend)"/>
118      <xsl:variable name="target" select="$targets[1]"/>
119
120      <xsl:call-template name="check.id.unique">
121        <xsl:with-param name="linkend" select="$linkend"/>
122      </xsl:call-template>
123
124      <xsl:choose>
125        <xsl:when test="count($target) = 0">
126          <xsl:message>
127            <xsl:text>XLink to nonexistent id: </xsl:text>
128            <xsl:value-of select="$linkend"/>
129          </xsl:message>
130          <xsl:copy-of select="$content"/>
131        </xsl:when>
132
133        <xsl:otherwise>
134          <fo:basic-link internal-destination="{$linkend}">
135            <xsl:copy-of select="$content"/>
136          </fo:basic-link>
137        </xsl:otherwise>
138      </xsl:choose>
139    </xsl:when>
140
141    <xsl:otherwise>
142      <xsl:copy-of select="$content"/>
143    </xsl:otherwise>
144  </xsl:choose>
145
146</xsl:template>
147
148<xsl:template name="inline.charseq">
149  <xsl:param name="content">
150    <xsl:call-template name="simple.xlink">
151      <xsl:with-param name="content">
152        <xsl:apply-templates/>
153      </xsl:with-param>
154    </xsl:call-template>
155  </xsl:param>
156
157  <xsl:choose>
158    <xsl:when test="@dir">
159      <fo:inline>
160        <xsl:attribute name="direction">
161          <xsl:choose>
162            <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
163            <xsl:otherwise>rtl</xsl:otherwise>
164          </xsl:choose>
165        </xsl:attribute>
166        <xsl:copy-of select="$content"/>
167      </fo:inline>
168    </xsl:when>
169    <xsl:otherwise>
170      <xsl:copy-of select="$content"/>
171    </xsl:otherwise>
172  </xsl:choose>
173</xsl:template>
174
175<xsl:template name="inline.monoseq">
176  <xsl:param name="content">
177    <xsl:call-template name="simple.xlink">
178      <xsl:with-param name="content">
179        <xsl:apply-templates/>
180      </xsl:with-param>
181    </xsl:call-template>
182  </xsl:param>
183
184  <fo:inline xsl:use-attribute-sets="monospace.properties">
185    <xsl:if test="@dir">
186      <xsl:attribute name="direction">
187        <xsl:choose>
188          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
189          <xsl:otherwise>rtl</xsl:otherwise>
190        </xsl:choose>
191      </xsl:attribute>
192    </xsl:if>
193    <xsl:copy-of select="$content"/>
194  </fo:inline>
195</xsl:template>
196
197<xsl:template name="inline.boldseq">
198  <xsl:param name="content">
199    <xsl:call-template name="simple.xlink">
200      <xsl:with-param name="content">
201        <xsl:apply-templates/>
202      </xsl:with-param>
203    </xsl:call-template>
204  </xsl:param>
205
206  <fo:inline font-weight="bold">
207    <xsl:if test="@dir">
208      <xsl:attribute name="direction">
209        <xsl:choose>
210          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
211          <xsl:otherwise>rtl</xsl:otherwise>
212        </xsl:choose>
213      </xsl:attribute>
214    </xsl:if>
215    <xsl:copy-of select="$content"/>
216  </fo:inline>
217</xsl:template>
218
219<xsl:template name="inline.italicseq">
220  <xsl:param name="content">
221    <xsl:call-template name="simple.xlink">
222      <xsl:with-param name="content">
223        <xsl:apply-templates/>
224      </xsl:with-param>
225    </xsl:call-template>
226  </xsl:param>
227
228  <fo:inline font-style="italic">
229    <xsl:call-template name="anchor"/>
230    <xsl:if test="@dir">
231      <xsl:attribute name="direction">
232        <xsl:choose>
233          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
234          <xsl:otherwise>rtl</xsl:otherwise>
235        </xsl:choose>
236      </xsl:attribute>
237    </xsl:if>
238    <xsl:copy-of select="$content"/>
239  </fo:inline>
240</xsl:template>
241
242<xsl:template name="inline.boldmonoseq">
243  <xsl:param name="content">
244    <xsl:call-template name="simple.xlink">
245      <xsl:with-param name="content">
246        <xsl:apply-templates/>
247      </xsl:with-param>
248    </xsl:call-template>
249  </xsl:param>
250
251  <fo:inline font-weight="bold" xsl:use-attribute-sets="monospace.properties">
252    <xsl:call-template name="anchor"/>
253    <xsl:if test="@dir">
254      <xsl:attribute name="direction">
255        <xsl:choose>
256          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
257          <xsl:otherwise>rtl</xsl:otherwise>
258        </xsl:choose>
259      </xsl:attribute>
260    </xsl:if>
261    <xsl:copy-of select="$content"/>
262  </fo:inline>
263</xsl:template>
264
265<xsl:template name="inline.italicmonoseq">
266  <xsl:param name="content">
267    <xsl:call-template name="simple.xlink">
268      <xsl:with-param name="content">
269        <xsl:apply-templates/>
270      </xsl:with-param>
271    </xsl:call-template>
272  </xsl:param>
273
274  <fo:inline font-style="italic" xsl:use-attribute-sets="monospace.properties">
275    <xsl:call-template name="anchor"/>
276    <xsl:if test="@dir">
277      <xsl:attribute name="direction">
278        <xsl:choose>
279          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
280          <xsl:otherwise>rtl</xsl:otherwise>
281        </xsl:choose>
282      </xsl:attribute>
283    </xsl:if>
284    <xsl:copy-of select="$content"/>
285  </fo:inline>
286</xsl:template>
287
288<xsl:template name="inline.superscriptseq">
289  <xsl:param name="content">
290    <xsl:call-template name="simple.xlink">
291      <xsl:with-param name="content">
292        <xsl:apply-templates/>
293      </xsl:with-param>
294    </xsl:call-template>
295  </xsl:param>
296
297  <fo:inline xsl:use-attribute-sets="superscript.properties">
298    <xsl:call-template name="anchor"/>
299    <xsl:if test="@dir">
300      <xsl:attribute name="direction">
301        <xsl:choose>
302          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
303          <xsl:otherwise>rtl</xsl:otherwise>
304        </xsl:choose>
305      </xsl:attribute>
306    </xsl:if>
307    <xsl:choose>
308      <xsl:when test="$fop.extensions != 0">
309        <xsl:attribute name="vertical-align">super</xsl:attribute>
310      </xsl:when>
311      <xsl:otherwise>
312        <xsl:attribute name="baseline-shift">super</xsl:attribute>
313      </xsl:otherwise>
314    </xsl:choose>
315    <xsl:copy-of select="$content"/>
316  </fo:inline>
317</xsl:template>
318
319<xsl:template name="inline.subscriptseq">
320  <xsl:param name="content">
321    <xsl:call-template name="simple.xlink">
322      <xsl:with-param name="content">
323        <xsl:apply-templates/>
324      </xsl:with-param>
325    </xsl:call-template>
326  </xsl:param>
327
328  <fo:inline xsl:use-attribute-sets="subscript.properties">
329    <xsl:call-template name="anchor"/>
330    <xsl:if test="@dir">
331      <xsl:attribute name="direction">
332        <xsl:choose>
333          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
334          <xsl:otherwise>rtl</xsl:otherwise>
335        </xsl:choose>
336      </xsl:attribute>
337    </xsl:if>
338    <xsl:choose>
339      <xsl:when test="$fop.extensions != 0">
340        <xsl:attribute name="vertical-align">sub</xsl:attribute>
341      </xsl:when>
342      <xsl:otherwise>
343        <xsl:attribute name="baseline-shift">sub</xsl:attribute>
344      </xsl:otherwise>
345    </xsl:choose>
346    <xsl:copy-of select="$content"/>
347  </fo:inline>
348</xsl:template>
349
350<!-- ==================================================================== -->
351<!-- some special cases -->
352
353<xsl:template match="author">
354  <xsl:call-template name="simple.xlink">
355    <xsl:with-param name="content">
356      <xsl:call-template name="person.name"/>
357    </xsl:with-param>
358  </xsl:call-template>
359</xsl:template>
360
361<xsl:template match="editor">
362  <xsl:call-template name="simple.xlink">
363    <xsl:with-param name="content">
364      <xsl:call-template name="person.name"/>
365    </xsl:with-param>
366  </xsl:call-template>
367</xsl:template>
368
369<xsl:template match="othercredit">
370  <xsl:call-template name="simple.xlink">
371    <xsl:with-param name="content">
372      <xsl:call-template name="person.name"/>
373    </xsl:with-param>
374  </xsl:call-template>
375</xsl:template>
376
377<xsl:template match="authorinitials">
378  <xsl:call-template name="inline.charseq"/>
379</xsl:template>
380
381<!-- ==================================================================== -->
382
383<xsl:template match="accel">
384  <xsl:call-template name="inline.charseq"/>
385</xsl:template>
386
387<xsl:template match="action">
388  <xsl:call-template name="inline.charseq"/>
389</xsl:template>
390
391<xsl:template match="application">
392  <xsl:call-template name="inline.charseq"/>
393</xsl:template>
394
395<xsl:template match="classname">
396  <xsl:call-template name="inline.monoseq"/>
397</xsl:template>
398
399<xsl:template match="exceptionname">
400  <xsl:call-template name="inline.monoseq"/>
401</xsl:template>
402
403<xsl:template match="interfacename">
404  <xsl:call-template name="inline.monoseq"/>
405</xsl:template>
406
407<xsl:template match="methodname">
408  <xsl:call-template name="inline.monoseq"/>
409</xsl:template>
410
411<xsl:template match="command">
412  <xsl:call-template name="inline.boldseq"/>
413</xsl:template>
414
415<xsl:template match="computeroutput">
416  <xsl:call-template name="inline.monoseq"/>
417</xsl:template>
418
419<xsl:template match="constant">
420  <xsl:call-template name="inline.monoseq"/>
421</xsl:template>
422
423<xsl:template match="database">
424  <xsl:call-template name="inline.charseq"/>
425</xsl:template>
426
427<xsl:template match="date">
428  <!-- should this support locale-specific formatting? how? -->
429  <xsl:call-template name="inline.charseq"/>
430</xsl:template>
431
432<xsl:template match="errorcode">
433  <xsl:call-template name="inline.charseq"/>
434</xsl:template>
435
436<xsl:template match="errorname">
437  <xsl:call-template name="inline.charseq"/>
438</xsl:template>
439
440<xsl:template match="errortype">
441  <xsl:call-template name="inline.charseq"/>
442</xsl:template>
443
444<xsl:template match="errortext">
445  <xsl:call-template name="inline.charseq"/>
446</xsl:template>
447
448<xsl:template match="envar">
449  <xsl:call-template name="inline.monoseq"/>
450</xsl:template>
451
452<xsl:template match="filename">
453  <xsl:call-template name="inline.monoseq"/>
454</xsl:template>
455
456<xsl:template match="function">
457  <xsl:choose>
458    <xsl:when test="$function.parens != '0'
459                    and (parameter or function or replaceable)">
460      <xsl:variable name="nodes" select="text()|*"/>
461      <xsl:call-template name="inline.monoseq">
462        <xsl:with-param name="content">
463          <xsl:call-template name="simple.xlink">
464            <xsl:with-param name="content">
465              <xsl:apply-templates select="$nodes[1]"/>
466            </xsl:with-param>
467          </xsl:call-template>
468        </xsl:with-param>
469      </xsl:call-template>
470      <xsl:text>(</xsl:text>
471      <xsl:apply-templates select="$nodes[position()>1]"/>
472      <xsl:text>)</xsl:text>
473    </xsl:when>
474    <xsl:otherwise>
475     <xsl:call-template name="inline.monoseq"/>
476    </xsl:otherwise>
477  </xsl:choose>
478</xsl:template>
479
480<xsl:template match="function/parameter" priority="2">
481  <xsl:call-template name="inline.italicmonoseq"/>
482  <xsl:if test="following-sibling::*">
483    <xsl:text>, </xsl:text>
484  </xsl:if>
485</xsl:template>
486
487<xsl:template match="function/replaceable" priority="2">
488  <xsl:call-template name="inline.italicmonoseq"/>
489  <xsl:if test="following-sibling::*">
490    <xsl:text>, </xsl:text>
491  </xsl:if>
492</xsl:template>
493
494<xsl:template match="guibutton">
495  <xsl:call-template name="inline.charseq"/>
496</xsl:template>
497
498<xsl:template match="guiicon">
499  <xsl:call-template name="inline.charseq"/>
500</xsl:template>
501
502<xsl:template match="guilabel">
503  <xsl:call-template name="inline.charseq"/>
504</xsl:template>
505
506<xsl:template match="guimenu">
507  <xsl:call-template name="inline.charseq"/>
508</xsl:template>
509
510<xsl:template match="guimenuitem">
511  <xsl:call-template name="inline.charseq"/>
512</xsl:template>
513
514<xsl:template match="guisubmenu">
515  <xsl:call-template name="inline.charseq"/>
516</xsl:template>
517
518<xsl:template match="hardware">
519  <xsl:call-template name="inline.charseq"/>
520</xsl:template>
521
522<xsl:template match="interface">
523  <xsl:call-template name="inline.charseq"/>
524</xsl:template>
525
526<xsl:template match="interfacedefinition">
527  <xsl:call-template name="inline.charseq"/>
528</xsl:template>
529
530<xsl:template match="keycap">
531  <xsl:call-template name="inline.boldseq"/>
532</xsl:template>
533
534<xsl:template match="keycode">
535  <xsl:call-template name="inline.charseq"/>
536</xsl:template>
537
538<xsl:template match="keysym">
539  <xsl:call-template name="inline.charseq"/>
540</xsl:template>
541
542<xsl:template match="literal">
543  <xsl:call-template name="inline.monoseq"/>
544</xsl:template>
545
546<xsl:template match="code">
547  <xsl:call-template name="inline.monoseq"/>
548</xsl:template>
549
550<xsl:template match="medialabel">
551  <xsl:call-template name="inline.italicseq"/>
552</xsl:template>
553
554<xsl:template match="shortcut">
555  <xsl:call-template name="inline.boldseq"/>
556</xsl:template>
557
558<xsl:template match="mousebutton">
559  <xsl:call-template name="inline.charseq"/>
560</xsl:template>
561
562<xsl:template match="option">
563  <xsl:call-template name="inline.monoseq"/>
564</xsl:template>
565
566<xsl:template match="package">
567  <xsl:call-template name="inline.charseq"/>
568</xsl:template>
569
570<xsl:template match="parameter">
571  <xsl:call-template name="inline.italicmonoseq"/>
572</xsl:template>
573
574<xsl:template match="property">
575  <xsl:call-template name="inline.charseq"/>
576</xsl:template>
577
578<xsl:template match="prompt">
579  <xsl:call-template name="inline.monoseq"/>
580</xsl:template>
581
582<xsl:template match="replaceable">
583  <xsl:call-template name="inline.italicmonoseq"/>
584</xsl:template>
585
586<xsl:template match="returnvalue">
587  <xsl:call-template name="inline.charseq"/>
588</xsl:template>
589
590<xsl:template match="structfield">
591  <xsl:call-template name="inline.italicmonoseq"/>
592</xsl:template>
593
594<xsl:template match="structname">
595  <xsl:call-template name="inline.charseq"/>
596</xsl:template>
597
598<xsl:template match="symbol">
599  <xsl:call-template name="inline.charseq"/>
600</xsl:template>
601
602<xsl:template match="systemitem">
603  <xsl:call-template name="inline.monoseq"/>
604</xsl:template>
605
606<xsl:template match="token">
607  <xsl:call-template name="inline.charseq"/>
608</xsl:template>
609
610<xsl:template match="type">
611  <xsl:call-template name="inline.charseq"/>
612</xsl:template>
613
614<xsl:template match="userinput">
615  <xsl:call-template name="inline.boldmonoseq"/>
616</xsl:template>
617
618<xsl:template match="abbrev">
619  <xsl:call-template name="inline.charseq"/>
620</xsl:template>
621
622<xsl:template match="acronym">
623  <xsl:call-template name="inline.charseq"/>
624</xsl:template>
625
626<xsl:template match="citerefentry">
627  <xsl:call-template name="inline.charseq"/>
628</xsl:template>
629
630<xsl:template match="citetitle">
631  <xsl:choose>
632    <xsl:when test="@pubwork = 'article'">
633      <xsl:call-template name="gentext.startquote"/>
634      <xsl:call-template name="inline.charseq"/>
635      <xsl:call-template name="gentext.endquote"/>
636    </xsl:when>
637    <xsl:otherwise>
638      <xsl:call-template name="inline.italicseq"/>
639    </xsl:otherwise>
640  </xsl:choose>
641</xsl:template>
642
643<xsl:template match="emphasis">
644  <xsl:variable name="depth">
645    <xsl:call-template name="dot.count">
646      <xsl:with-param name="string">
647        <xsl:number level="multiple"/>
648      </xsl:with-param>
649    </xsl:call-template>
650  </xsl:variable>
651
652  <xsl:choose>
653    <xsl:when test="@role='bold' or @role='strong'">
654      <xsl:call-template name="inline.boldseq"/>
655    </xsl:when>
656    <xsl:when test="@role='underline'">
657      <fo:inline text-decoration="underline">
658        <xsl:call-template name="inline.charseq"/>
659      </fo:inline>
660    </xsl:when>
661    <xsl:when test="@role='strikethrough'">
662      <fo:inline text-decoration="line-through">
663        <xsl:call-template name="inline.charseq"/>
664      </fo:inline>
665    </xsl:when>
666    <xsl:otherwise>
667      <xsl:choose>
668        <xsl:when test="$depth mod 2 = 1">
669          <fo:inline font-style="normal">
670            <xsl:apply-templates/>
671          </fo:inline>
672        </xsl:when>
673        <xsl:otherwise>
674          <xsl:call-template name="inline.italicseq"/>
675        </xsl:otherwise>
676      </xsl:choose>
677    </xsl:otherwise>
678  </xsl:choose>
679</xsl:template>
680
681<xsl:template match="foreignphrase">
682  <xsl:call-template name="inline.italicseq"/>
683</xsl:template>
684
685<xsl:template match="markup">
686  <xsl:call-template name="inline.charseq"/>
687</xsl:template>
688
689<xsl:template match="phrase">
690  <xsl:call-template name="inline.charseq"/>
691</xsl:template>
692
693<xsl:template match="quote">
694  <xsl:variable name="depth">
695    <xsl:call-template name="dot.count">
696      <xsl:with-param name="string"><xsl:number level="multiple"/></xsl:with-param>
697    </xsl:call-template>
698  </xsl:variable>
699  <xsl:choose>
700    <xsl:when test="$depth mod 2 = 0">
701      <xsl:call-template name="gentext.startquote"/>
702      <xsl:call-template name="inline.charseq"/>
703      <xsl:call-template name="gentext.endquote"/>
704    </xsl:when>
705    <xsl:otherwise>
706      <xsl:call-template name="gentext.nestedstartquote"/>
707      <xsl:call-template name="inline.charseq"/>
708      <xsl:call-template name="gentext.nestedendquote"/>
709    </xsl:otherwise>
710  </xsl:choose>
711</xsl:template>
712
713<xsl:template match="varname">
714  <xsl:call-template name="inline.monoseq"/>
715</xsl:template>
716
717<xsl:template match="wordasword">
718  <xsl:call-template name="inline.italicseq"/>
719</xsl:template>
720
721<xsl:template match="lineannotation">
722  <fo:inline font-style="italic">
723    <xsl:call-template name="inline.charseq"/>
724  </fo:inline>
725</xsl:template>
726
727<xsl:template match="superscript">
728  <xsl:call-template name="inline.superscriptseq"/>
729</xsl:template>
730
731<xsl:template match="subscript">
732  <xsl:call-template name="inline.subscriptseq"/>
733</xsl:template>
734
735<xsl:template match="trademark">
736  <xsl:call-template name="inline.charseq"/>
737  <xsl:choose>
738    <xsl:when test="@class = 'copyright'
739                    or @class = 'registered'">
740      <xsl:call-template name="dingbat">
741        <xsl:with-param name="dingbat" select="@class"/>
742      </xsl:call-template>
743    </xsl:when>
744    <xsl:when test="@class = 'service'">
745      <xsl:call-template name="inline.superscriptseq">
746        <xsl:with-param name="content" select="'SM'"/>
747      </xsl:call-template>
748    </xsl:when>
749    <xsl:otherwise>
750      <xsl:call-template name="dingbat">
751        <xsl:with-param name="dingbat" select="'trademark'"/>
752      </xsl:call-template>
753    </xsl:otherwise>
754  </xsl:choose>
755</xsl:template>
756
757<xsl:template match="firstterm">
758  <xsl:call-template name="glossterm">
759    <xsl:with-param name="firstterm" select="1"/>
760  </xsl:call-template>
761</xsl:template>
762
763<xsl:template match="glossterm" name="glossterm">
764  <xsl:param name="firstterm" select="0"/>
765
766  <xsl:choose>
767    <xsl:when test="($firstterm.only.link = 0 or $firstterm = 1) and @linkend">
768      <xsl:variable name="targets" select="key('id',@linkend)"/>
769      <xsl:variable name="target" select="$targets[1]"/>
770
771      <xsl:choose>
772        <xsl:when test="$target">
773          <fo:basic-link internal-destination="{@linkend}" 
774                         xsl:use-attribute-sets="xref.properties">
775            <xsl:call-template name="inline.italicseq"/>
776          </fo:basic-link>
777        </xsl:when>
778        <xsl:otherwise>
779          <xsl:call-template name="inline.italicseq"/>
780        </xsl:otherwise>
781      </xsl:choose>
782    </xsl:when>
783
784    <xsl:when test="not(@linkend)
785                    and ($firstterm.only.link = 0 or $firstterm = 1)
786                    and ($glossterm.auto.link != 0)
787                    and $glossary.collection != ''">
788      <xsl:variable name="term">
789        <xsl:choose>
790          <xsl:when test="@baseform"><xsl:value-of select="@baseform"/></xsl:when>
791          <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
792        </xsl:choose>
793      </xsl:variable>
794      <xsl:variable name="cterm"
795           select="(document($glossary.collection,.)//glossentry[glossterm=$term])[1]"/>
796
797      <xsl:choose>
798        <xsl:when test="not($cterm)">
799          <xsl:message>
800            <xsl:text>There's no entry for </xsl:text>
801            <xsl:value-of select="$term"/>
802            <xsl:text> in </xsl:text>
803            <xsl:value-of select="$glossary.collection"/>
804          </xsl:message>
805          <xsl:call-template name="inline.italicseq"/>
806        </xsl:when>
807        <xsl:otherwise>
808          <xsl:variable name="id">
809            <xsl:call-template name="object.id">
810              <xsl:with-param name="object" select="$cterm"/>
811            </xsl:call-template>
812          </xsl:variable>
813          <fo:basic-link internal-destination="{$id}"
814                         xsl:use-attribute-sets="xref.properties">
815            <xsl:call-template name="inline.italicseq"/>
816          </fo:basic-link>
817        </xsl:otherwise>
818      </xsl:choose>
819    </xsl:when>
820
821    <xsl:when test="not(@linkend)
822                    and ($firstterm.only.link = 0 or $firstterm = 1)
823                    and $glossterm.auto.link != 0">
824      <xsl:variable name="term">
825        <xsl:choose>
826          <xsl:when test="@baseform">
827            <xsl:value-of select="@baseform"/>
828          </xsl:when>
829          <xsl:otherwise>
830            <xsl:value-of select="."/>
831          </xsl:otherwise>
832        </xsl:choose>
833      </xsl:variable>
834
835      <xsl:variable name="targets"
836                    select="//glossentry[glossterm=$term or glossterm/@baseform=$term]"/>
837
838      <xsl:variable name="target" select="$targets[1]"/>
839
840      <xsl:choose>
841        <xsl:when test="count($targets)=0">
842          <xsl:message>
843            <xsl:text>Error: no glossentry for glossterm: </xsl:text>
844            <xsl:value-of select="."/>
845            <xsl:text>.</xsl:text>
846          </xsl:message>
847          <xsl:call-template name="inline.italicseq"/>
848        </xsl:when>
849        <xsl:otherwise>
850          <xsl:variable name="termid">
851            <xsl:call-template name="object.id">
852              <xsl:with-param name="object" select="$target"/>
853            </xsl:call-template>
854          </xsl:variable>
855
856          <fo:basic-link internal-destination="{$termid}"
857                         xsl:use-attribute-sets="xref.properties">
858            <xsl:call-template name="inline.charseq"/>
859          </fo:basic-link>
860        </xsl:otherwise>
861      </xsl:choose>
862    </xsl:when>
863    <xsl:otherwise>
864      <xsl:call-template name="inline.italicseq"/>
865    </xsl:otherwise>
866  </xsl:choose>
867</xsl:template>
868
869<xsl:template match="termdef">
870  <fo:inline>
871    <xsl:call-template name="gentext.template">
872      <xsl:with-param name="context" select="'termdef'"/>
873      <xsl:with-param name="name" select="'prefix'"/>
874    </xsl:call-template>
875    <xsl:apply-templates/>
876    <xsl:call-template name="gentext.template">
877      <xsl:with-param name="context" select="'termdef'"/>
878      <xsl:with-param name="name" select="'suffix'"/>
879    </xsl:call-template>
880  </fo:inline>
881</xsl:template>
882
883<xsl:template match="sgmltag|tag">
884  <xsl:variable name="class">
885    <xsl:choose>
886      <xsl:when test="@class">
887        <xsl:value-of select="@class"/>
888      </xsl:when>
889      <xsl:otherwise>element</xsl:otherwise>
890    </xsl:choose>
891  </xsl:variable>
892
893  <xsl:choose>
894    <xsl:when test="$class='attribute'">
895      <xsl:call-template name="inline.monoseq"/>
896    </xsl:when>
897    <xsl:when test="$class='attvalue'">
898      <xsl:call-template name="inline.monoseq"/>
899    </xsl:when>
900    <xsl:when test="$class='element'">
901      <xsl:call-template name="inline.monoseq"/>
902    </xsl:when>
903    <xsl:when test="$class='endtag'">
904      <xsl:call-template name="inline.monoseq">
905        <xsl:with-param name="content">
906          <xsl:text>&lt;/</xsl:text>
907          <xsl:apply-templates/>
908          <xsl:text>&gt;</xsl:text>
909        </xsl:with-param>
910      </xsl:call-template>
911    </xsl:when>
912    <xsl:when test="$class='genentity'">
913      <xsl:call-template name="inline.monoseq">
914        <xsl:with-param name="content">
915          <xsl:text>&amp;</xsl:text>
916          <xsl:apply-templates/>
917          <xsl:text>;</xsl:text>
918        </xsl:with-param>
919      </xsl:call-template>
920    </xsl:when>
921    <xsl:when test="$class='numcharref'">
922      <xsl:call-template name="inline.monoseq">
923        <xsl:with-param name="content">
924          <xsl:text>&amp;#</xsl:text>
925          <xsl:apply-templates/>
926          <xsl:text>;</xsl:text>
927        </xsl:with-param>
928      </xsl:call-template>
929    </xsl:when>
930    <xsl:when test="$class='paramentity'">
931      <xsl:call-template name="inline.monoseq">
932        <xsl:with-param name="content">
933          <xsl:text>%</xsl:text>
934          <xsl:apply-templates/>
935          <xsl:text>;</xsl:text>
936        </xsl:with-param>
937      </xsl:call-template>
938    </xsl:when>
939    <xsl:when test="$class='pi'">
940      <xsl:call-template name="inline.monoseq">
941        <xsl:with-param name="content">
942          <xsl:text>&lt;?</xsl:text>
943          <xsl:apply-templates/>
944          <xsl:text>&gt;</xsl:text>
945        </xsl:with-param>
946      </xsl:call-template>
947    </xsl:when>
948    <xsl:when test="$class='xmlpi'">
949      <xsl:call-template name="inline.monoseq">
950        <xsl:with-param name="content">
951          <xsl:text>&lt;?</xsl:text>
952          <xsl:apply-templates/>
953          <xsl:text>?&gt;</xsl:text>
954        </xsl:with-param>
955      </xsl:call-template>
956    </xsl:when>
957    <xsl:when test="$class='starttag'">
958      <xsl:call-template name="inline.monoseq">
959        <xsl:with-param name="content">
960          <xsl:text>&lt;</xsl:text>
961          <xsl:apply-templates/>
962          <xsl:text>&gt;</xsl:text>
963        </xsl:with-param>
964      </xsl:call-template>
965    </xsl:when>
966    <xsl:when test="$class='emptytag'">
967      <xsl:call-template name="inline.monoseq">
968        <xsl:with-param name="content">
969          <xsl:text>&lt;</xsl:text>
970          <xsl:apply-templates/>
971          <xsl:text>/&gt;</xsl:text>
972        </xsl:with-param>
973      </xsl:call-template>
974    </xsl:when>
975    <xsl:when test="$class='sgmlcomment' or $class='comment'">
976      <xsl:call-template name="inline.monoseq">
977        <xsl:with-param name="content">
978          <xsl:text>&lt;!--</xsl:text>
979          <xsl:apply-templates/>
980          <xsl:text>--&gt;</xsl:text>
981        </xsl:with-param>
982      </xsl:call-template>
983    </xsl:when>
984    <xsl:otherwise>
985      <xsl:call-template name="inline.charseq"/>
986    </xsl:otherwise>
987  </xsl:choose>
988</xsl:template>
989
990<xsl:template match="email">
991  <xsl:call-template name="inline.monoseq">
992    <xsl:with-param name="content">
993      <fo:inline keep-together.within-line="always" hyphenate="false">
994        <xsl:if test="not($email.delimiters.enabled = 0)">
995          <xsl:text>&lt;</xsl:text>
996        </xsl:if>
997        <xsl:apply-templates/>
998        <xsl:if test="not($email.delimiters.enabled = 0)">
999          <xsl:text>&gt;</xsl:text>
1000        </xsl:if>
1001      </fo:inline>
1002    </xsl:with-param>
1003  </xsl:call-template>
1004</xsl:template>
1005
1006<xsl:template match="keycombo">
1007  <xsl:variable name="action" select="@action"/>
1008  <xsl:variable name="joinchar">
1009    <xsl:choose>
1010      <xsl:when test="$action='seq'"><xsl:text> </xsl:text></xsl:when>
1011      <xsl:when test="$action='simul'">+</xsl:when>
1012      <xsl:when test="$action='press'">-</xsl:when>
1013      <xsl:when test="$action='click'">-</xsl:when>
1014      <xsl:when test="$action='double-click'">-</xsl:when>
1015      <xsl:when test="$action='other'"></xsl:when>
1016      <xsl:otherwise>+</xsl:otherwise>
1017    </xsl:choose>
1018  </xsl:variable>
1019  <xsl:for-each select="*">
1020    <xsl:if test="position()>1"><xsl:value-of select="$joinchar"/></xsl:if>
1021    <xsl:apply-templates select="."/>
1022  </xsl:for-each>
1023</xsl:template>
1024
1025<xsl:template match="uri">
1026  <xsl:call-template name="inline.monoseq"/>
1027</xsl:template>
1028
1029<!-- ==================================================================== -->
1030
1031<xsl:template match="menuchoice">
1032  <xsl:variable name="shortcut" select="./shortcut"/>
1033  <xsl:call-template name="process.menuchoice"/>
1034  <xsl:if test="$shortcut">
1035    <xsl:text> (</xsl:text>
1036    <xsl:apply-templates select="$shortcut"/>
1037    <xsl:text>)</xsl:text>
1038  </xsl:if>
1039</xsl:template>
1040
1041<xsl:template name="process.menuchoice">
1042  <xsl:param name="nodelist" select="guibutton|guiicon|guilabel|guimenu|guimenuitem|guisubmenu|interface"/><!-- not(shortcut) -->
1043  <xsl:param name="count" select="1"/>
1044
1045  <xsl:variable name="mm.separator">
1046    <xsl:choose>
1047      <xsl:when test="($fop.extensions != 0 or $fop1.extensions != 0 ) and
1048                contains($menuchoice.menu.separator, '&#x2192;')">
1049        <fo:inline font-family="Symbol">
1050          <xsl:copy-of select="$menuchoice.menu.separator"/>
1051        </fo:inline>
1052      </xsl:when>
1053      <xsl:otherwise>
1054        <xsl:copy-of select="$menuchoice.menu.separator"/>
1055      </xsl:otherwise>
1056    </xsl:choose>
1057  </xsl:variable>
1058
1059  <xsl:choose>
1060    <xsl:when test="$count>count($nodelist)"></xsl:when>
1061    <xsl:when test="$count=1">
1062      <xsl:apply-templates select="$nodelist[$count=position()]"/>
1063      <xsl:call-template name="process.menuchoice">
1064        <xsl:with-param name="nodelist" select="$nodelist"/>
1065        <xsl:with-param name="count" select="$count+1"/>
1066      </xsl:call-template>
1067    </xsl:when>
1068    <xsl:otherwise>
1069      <xsl:variable name="node" select="$nodelist[$count=position()]"/>
1070      <xsl:choose>
1071        <xsl:when test="local-name($node)='guimenuitem'
1072                        or local-name($node)='guisubmenu'">
1073          <xsl:copy-of select="$mm.separator"/>
1074        </xsl:when>
1075        <xsl:otherwise>
1076          <xsl:copy-of select="$menuchoice.separator"/>
1077        </xsl:otherwise>
1078      </xsl:choose>
1079      <xsl:apply-templates select="$node"/>
1080      <xsl:call-template name="process.menuchoice">
1081        <xsl:with-param name="nodelist" select="$nodelist"/>
1082        <xsl:with-param name="count" select="$count+1"/>
1083      </xsl:call-template>
1084    </xsl:otherwise>
1085  </xsl:choose>
1086</xsl:template>
1087
1088<!-- ==================================================================== -->
1089
1090<xsl:template match="optional">
1091  <xsl:value-of select="$arg.choice.opt.open.str"/>
1092  <xsl:call-template name="inline.charseq"/>
1093  <xsl:value-of select="$arg.choice.opt.close.str"/>
1094</xsl:template>
1095
1096<xsl:template match="citation">
1097  <!-- todo: integrate with bibliography collection -->
1098  <xsl:variable name="targets" select="(//biblioentry | //bibliomixed)[abbrev = string(current())]"/>
1099  <xsl:variable name="target" select="$targets[1]"/>
1100
1101  <xsl:choose>
1102    <!-- try automatic linking based on match to abbrev -->
1103    <xsl:when test="$target and not(xref) and not(link)">
1104
1105      <xsl:text>[</xsl:text>
1106      <fo:basic-link>
1107        <xsl:attribute name="internal-destination">
1108          <xsl:call-template name="object.id">
1109            <xsl:with-param name="object" select="$target"/>
1110          </xsl:call-template>
1111        </xsl:attribute>
1112
1113        <xsl:choose>
1114          <xsl:when test="$bibliography.numbered != 0">
1115            <xsl:apply-templates select="$target" mode="citation"/>
1116          </xsl:when>
1117          <xsl:otherwise>
1118            <xsl:call-template name="inline.charseq"/>
1119          </xsl:otherwise>
1120        </xsl:choose>
1121     
1122      </fo:basic-link>
1123      <xsl:text>]</xsl:text>
1124    </xsl:when>
1125
1126    <xsl:otherwise>
1127      <xsl:text>[</xsl:text>
1128      <xsl:call-template name="inline.charseq"/>
1129      <xsl:text>]</xsl:text>
1130    </xsl:otherwise>
1131  </xsl:choose>
1132</xsl:template>
1133
1134<xsl:template match="biblioentry|bibliomixed" mode="citation">
1135  <xsl:number from="bibliography" count="biblioentry|bibliomixed"
1136              level="any" format="1"/>
1137</xsl:template>
1138
1139<!-- ==================================================================== -->
1140
1141<xsl:template match="comment[&comment.block.parents;]|remark[&comment.block.parents;]">
1142  <xsl:if test="$show.comments != 0">
1143    <fo:block font-style="italic">
1144      <xsl:call-template name="inline.charseq"/>
1145    </fo:block>
1146  </xsl:if>
1147</xsl:template>
1148
1149<xsl:template match="comment|remark">
1150  <xsl:if test="$show.comments != 0">
1151    <fo:inline font-style="italic">
1152      <xsl:call-template name="inline.charseq"/>
1153    </fo:inline>
1154  </xsl:if>
1155</xsl:template>
1156
1157<!-- ==================================================================== -->
1158
1159<xsl:template match="productname">
1160  <xsl:call-template name="inline.charseq"/>
1161  <xsl:if test="@class">
1162    <xsl:call-template name="dingbat">
1163      <xsl:with-param name="dingbat" select="@class"/>
1164    </xsl:call-template>
1165  </xsl:if>
1166</xsl:template>
1167
1168<xsl:template match="productnumber">
1169  <xsl:call-template name="inline.charseq"/>
1170</xsl:template>
1171
1172<!-- ==================================================================== -->
1173
1174<xsl:template match="pob|street|city|state|postcode|country|otheraddr">
1175  <xsl:call-template name="inline.charseq"/>
1176</xsl:template>
1177
1178<xsl:template match="phone|fax">
1179  <xsl:call-template name="inline.charseq"/>
1180</xsl:template>
1181
1182<!-- in Addresses, for example -->
1183<xsl:template match="honorific|firstname|surname|lineage|othername">
1184  <xsl:call-template name="inline.charseq"/>
1185</xsl:template>
1186
1187<!-- ==================================================================== -->
1188
1189<xsl:template match="person">
1190  <xsl:apply-templates select="personname"/>
1191</xsl:template>
1192
1193<xsl:template match="personname">
1194  <xsl:call-template name="simple.xlink">
1195    <xsl:with-param name="content">
1196      <xsl:call-template name="person.name"/>
1197    </xsl:with-param>
1198  </xsl:call-template>
1199</xsl:template>
1200
1201<xsl:template match="jobtitle">
1202  <xsl:call-template name="simple.xlink">
1203    <xsl:with-param name="content">
1204      <xsl:apply-templates/>
1205    </xsl:with-param>
1206  </xsl:call-template>
1207</xsl:template>
1208
1209<!-- ==================================================================== -->
1210
1211<xsl:template match="org">
1212  <xsl:call-template name="inline.charseq"/>
1213</xsl:template>
1214
1215<xsl:template match="orgname">
1216  <xsl:call-template name="inline.charseq"/>
1217</xsl:template>
1218
1219<xsl:template match="orgdiv">
1220  <xsl:call-template name="inline.charseq"/>
1221</xsl:template>
1222
1223<xsl:template match="affiliation">
1224  <xsl:call-template name="inline.charseq"/>
1225</xsl:template>
1226
1227<!-- ==================================================================== -->
1228
1229<xsl:template match="beginpage">
1230  <!-- does nothing; this *is not* markup to force a page break. -->
1231</xsl:template>
1232
1233</xsl:stylesheet>
1234
Note: See TracBrowser for help on using the repository browser.