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