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