Whamcloud - gitweb
LUDOC-120 presentation: build bits for webhelp.
[doc/manual.git] / webhelp / xhtml / inline.xsl
1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
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: inline.xsl 9963 2015-05-20 18:37:42Z bobstayton $
8      ********************************************************************
9
10      This file is part of the XSL DocBook Stylesheet distribution.
11      See ../README or http://docbook.sf.net/release/xsl/current/ for
12      copyright and other information.
13
14      ******************************************************************** -->
15
16 <xsl:key name="glossentries" match="glossentry" use="normalize-space(glossterm)"/>
17 <xsl:key name="glossentries" match="glossentry" use="normalize-space(glossterm/@baseform)"/>
18
19 <xsl:template name="simple.xlink">
20   <xsl:param name="node" select="."/>
21   <xsl:param name="content">
22     <xsl:apply-templates/>
23   </xsl:param>
24   <xsl:param name="linkend" select="$node/@linkend"/>
25   <xsl:param name="xhref" select="$node/@xlink:href"/>
26
27   <!-- check for nested links, which are undefined in the output -->
28   <xsl:if test="($linkend or $xhref) and $node/ancestor::*[@xlink:href or @linkend]">
29     <xsl:message>
30       <xsl:text>WARNING: nested link may be undefined in output: </xsl:text>
31       <xsl:text>&lt;</xsl:text>
32       <xsl:value-of select="name($node)"/>
33       <xsl:text> </xsl:text>
34       <xsl:choose>
35         <xsl:when test="$linkend">
36           <xsl:text>@linkend = '</xsl:text>
37           <xsl:value-of select="$linkend"/>
38           <xsl:text>'&gt;</xsl:text>
39         </xsl:when>
40         <xsl:when test="$xhref">
41           <xsl:text>@xlink:href = '</xsl:text>
42           <xsl:value-of select="$xhref"/>
43           <xsl:text>'&gt;</xsl:text>
44         </xsl:when>
45       </xsl:choose>
46       <xsl:text> nested inside parent element </xsl:text>
47       <xsl:value-of select="name($node/parent::*)"/>
48     </xsl:message>
49   </xsl:if>
50
51   <!-- Support for @xlink:show -->
52   <xsl:variable name="target.show">
53     <xsl:choose>
54       <xsl:when test="$node/@xlink:show = 'new'">_blank</xsl:when>
55       <xsl:when test="$node/@xlink:show = 'replace'">_top</xsl:when>
56       <xsl:otherwise/>
57     </xsl:choose>
58   </xsl:variable>
59
60   <xsl:variable name="link">
61     <xsl:choose>
62       <xsl:when test="$xhref and                        (not($node/@xlink:type) or                             $node/@xlink:type='simple')">
63
64         <!-- Is it a local idref or a uri? -->
65         <xsl:variable name="is.idref">
66           <xsl:choose>
67             <!-- if the href starts with # and does not contain an "(" -->
68             <!-- or if the href starts with #xpointer(id(, it's just an ID -->
69             <xsl:when test="starts-with($xhref,'#')                             and (not(contains($xhref,'('))                             or starts-with($xhref,                                        '#xpointer(id('))">1</xsl:when>
70             <xsl:otherwise>0</xsl:otherwise>
71           </xsl:choose>
72         </xsl:variable>
73
74         <!-- Is it an olink ? -->
75         <xsl:variable name="is.olink">
76           <xsl:choose>
77             <!-- If xlink:role="http://docbook.org/xlink/role/olink" -->
78             <!-- and if the href contains # -->
79             <xsl:when test="contains($xhref,'#') and                  @xlink:role = $xolink.role">1</xsl:when>
80             <xsl:otherwise>0</xsl:otherwise>
81           </xsl:choose>
82         </xsl:variable>
83
84         <xsl:choose>
85           <xsl:when test="$is.olink = 1">
86             <xsl:call-template name="olink">
87               <xsl:with-param name="content" select="$content"/>
88             </xsl:call-template>
89           </xsl:when>
90
91           <xsl:when test="$is.idref = 1">
92
93             <xsl:variable name="idref">
94               <xsl:call-template name="xpointer.idref">
95                 <xsl:with-param name="xpointer" select="$xhref"/>
96               </xsl:call-template>
97             </xsl:variable>
98
99             <xsl:variable name="targets" select="key('id',$idref)"/>
100             <xsl:variable name="target" select="$targets[1]"/>
101
102             <xsl:call-template name="check.id.unique">
103               <xsl:with-param name="linkend" select="$idref"/>
104             </xsl:call-template>
105
106             <xsl:choose>
107               <xsl:when test="count($target) = 0">
108                 <xsl:message>
109                   <xsl:text>XLink to nonexistent id: </xsl:text>
110                   <xsl:value-of select="$idref"/>
111                 </xsl:message>
112                 <xsl:copy-of select="$content"/>
113               </xsl:when>
114
115               <xsl:otherwise>
116                 <a>
117                   <xsl:apply-templates select="." mode="common.html.attributes"/>
118                   <!-- id attribute goes on the element calling
119                   simple.xlink, not on the anchor element, so
120                   this is commented out:
121                   <xsl:call-template name="id.attribute"/>
122                   -->
123
124                   <xsl:attribute name="href">
125                     <xsl:call-template name="href.target">
126                       <xsl:with-param name="object" select="$target"/>
127                     </xsl:call-template>
128                   </xsl:attribute>
129
130                   <xsl:choose>
131                     <xsl:when test="$node/@xlink:title">
132                       <xsl:attribute name="title">
133                         <xsl:value-of select="$node/@xlink:title"/>
134                       </xsl:attribute>
135                     </xsl:when>
136                     <xsl:otherwise>
137                       <xsl:apply-templates select="$target" mode="html.title.attribute"/>
138                     </xsl:otherwise>
139                   </xsl:choose>
140
141                   <xsl:if test="$target.show !=''">
142                     <xsl:attribute name="target">
143                       <xsl:value-of select="$target.show"/>
144                     </xsl:attribute>
145                   </xsl:if>
146
147                   <xsl:copy-of select="$content"/>
148
149                 </a>
150               </xsl:otherwise>
151             </xsl:choose>
152           </xsl:when>
153
154           <!-- otherwise it's a URI -->
155           <xsl:otherwise>
156             <a>
157               <xsl:apply-templates select="." mode="common.html.attributes"/>
158               <xsl:call-template name="id.attribute"/>
159               <xsl:attribute name="href">
160                 <xsl:value-of select="$xhref"/>
161               </xsl:attribute>
162               <xsl:if test="$node/@xlink:title">
163                 <xsl:attribute name="title">
164                   <xsl:value-of select="$node/@xlink:title"/>
165                 </xsl:attribute>
166               </xsl:if>
167
168               <!-- For URIs, use @xlink:show if defined, otherwise use ulink.target -->
169               <xsl:choose>
170                 <xsl:when test="$target.show !=''">
171                   <xsl:attribute name="target">
172                     <xsl:value-of select="$target.show"/>
173                   </xsl:attribute>
174                 </xsl:when>
175                 <xsl:when test="$ulink.target !=''">
176                   <xsl:attribute name="target">
177                     <xsl:value-of select="$ulink.target"/>
178                   </xsl:attribute>
179                 </xsl:when>
180               </xsl:choose>
181               
182               <xsl:copy-of select="$content"/>
183             </a>
184           </xsl:otherwise>
185         </xsl:choose>
186       </xsl:when>
187
188       <xsl:when test="$linkend">
189         <xsl:variable name="targets" select="key('id',$linkend)"/>
190         <xsl:variable name="target" select="$targets[1]"/>
191
192         <xsl:call-template name="check.id.unique">
193           <xsl:with-param name="linkend" select="$linkend"/>
194         </xsl:call-template>
195
196         <a>
197           <xsl:apply-templates select="." mode="common.html.attributes"/>
198           <xsl:call-template name="id.attribute"/>
199           <xsl:attribute name="href">
200             <xsl:call-template name="href.target">
201               <xsl:with-param name="object" select="$target"/>
202             </xsl:call-template>
203           </xsl:attribute>
204
205           <xsl:apply-templates select="$target" mode="html.title.attribute"/>
206
207           <xsl:copy-of select="$content"/>
208           
209         </a>
210       </xsl:when>
211       <xsl:otherwise>
212         <xsl:copy-of select="$content"/>
213       </xsl:otherwise>
214     </xsl:choose>
215   </xsl:variable>
216
217   <xsl:choose>
218     <xsl:when test="function-available('suwl:unwrapLinks')">
219       <xsl:copy-of select="suwl:unwrapLinks($link)"/>
220     </xsl:when>
221     <xsl:otherwise>
222       <xsl:copy-of select="$link"/>
223     </xsl:otherwise>
224   </xsl:choose>
225 </xsl:template>
226
227 <xsl:template name="inline.charseq">
228   <xsl:param name="content">
229     <xsl:apply-templates/>
230   </xsl:param>
231
232   <xsl:param name="contentwithlink">
233     <xsl:call-template name="anchor"/>
234     <xsl:call-template name="simple.xlink">
235       <xsl:with-param name="content" select="$content"/>
236     </xsl:call-template>
237   </xsl:param>
238
239   <!-- * if you want output from the inline.charseq template wrapped in -->
240   <!-- * something other than a Span, call the template with some value -->
241   <!-- * for the 'wrapper-name' param -->
242   <xsl:param name="wrapper-name">span</xsl:param>
243   <xsl:element name="{$wrapper-name}" namespace="http://www.w3.org/1999/xhtml">
244     <xsl:call-template name="common.html.attributes"/>
245     <xsl:call-template name="id.attribute"/>
246     <xsl:call-template name="generate.html.title"/>
247     <xsl:copy-of select="$contentwithlink"/>
248     <xsl:call-template name="apply-annotations"/>
249   </xsl:element>
250 </xsl:template>
251
252 <xsl:template name="inline.monoseq">
253   <xsl:param name="content">
254     <xsl:apply-templates/>
255   </xsl:param>
256
257   <xsl:param name="contentwithlink">
258     <xsl:call-template name="anchor"/>
259     <xsl:call-template name="simple.xlink">
260       <xsl:with-param name="content" select="$content"/>
261     </xsl:call-template>
262   </xsl:param>
263
264   <code>
265     <xsl:apply-templates select="." mode="common.html.attributes"/>
266     <xsl:call-template name="id.attribute"/>
267     <xsl:copy-of select="$contentwithlink"/>
268     <xsl:call-template name="apply-annotations"/>
269   </code>
270 </xsl:template>
271
272 <xsl:template name="inline.boldseq">
273   <xsl:param name="content">
274     <xsl:apply-templates/>
275   </xsl:param>
276
277   <xsl:param name="contentwithlink">
278     <xsl:call-template name="anchor"/>
279     <xsl:call-template name="simple.xlink">
280       <xsl:with-param name="content" select="$content"/>
281     </xsl:call-template>
282   </xsl:param>
283
284   <span>
285     <xsl:apply-templates select="." mode="common.html.attributes"/>
286     <xsl:call-template name="id.attribute"/>
287
288     <!-- don't put <strong> inside figure, example, or table titles -->
289     <xsl:choose>
290       <xsl:when test="local-name(..) = 'title'                       and (local-name(../..) = 'figure'                       or local-name(../..) = 'example'                       or local-name(../..) = 'table')">
291         <xsl:copy-of select="$contentwithlink"/>
292       </xsl:when>
293       <xsl:otherwise>
294         <strong>
295           <xsl:copy-of select="$contentwithlink"/>
296         </strong>
297       </xsl:otherwise>
298     </xsl:choose>
299     <xsl:call-template name="apply-annotations"/>
300   </span>
301 </xsl:template>
302
303 <xsl:template name="inline.italicseq">
304   <xsl:param name="content">
305     <xsl:apply-templates/>
306   </xsl:param>
307
308   <xsl:param name="contentwithlink">
309     <xsl:call-template name="anchor"/>
310     <xsl:call-template name="simple.xlink">
311       <xsl:with-param name="content" select="$content"/>
312     </xsl:call-template>
313   </xsl:param>
314
315   <em>
316     <xsl:call-template name="common.html.attributes"/>
317     <xsl:call-template name="id.attribute"/>
318     <xsl:copy-of select="$contentwithlink"/>
319     <xsl:call-template name="apply-annotations"/>
320   </em>
321 </xsl:template>
322
323 <xsl:template name="inline.boldmonoseq">
324   <xsl:param name="content">
325     <xsl:apply-templates/>
326   </xsl:param>
327
328   <xsl:param name="contentwithlink">
329     <xsl:call-template name="anchor"/>
330     <xsl:call-template name="simple.xlink">
331       <xsl:with-param name="content" select="$content"/>
332     </xsl:call-template>
333   </xsl:param>
334
335   <!-- don't put <strong> inside figure, example, or table titles -->
336   <!-- or other titles that may already be represented with <strong>'s. -->
337   <xsl:choose>
338     <xsl:when test="local-name(..) = 'title'                     and (local-name(../..) = 'figure'                          or local-name(../..) = 'example'                          or local-name(../..) = 'table'                          or local-name(../..) = 'formalpara')">
339       <code>
340         <xsl:call-template name="common.html.attributes"/>
341         <xsl:call-template name="id.attribute"/>
342         <xsl:copy-of select="$contentwithlink"/>
343         <xsl:call-template name="apply-annotations"/>
344       </code>
345     </xsl:when>
346     <xsl:otherwise>
347       <strong>
348         <xsl:call-template name="common.html.attributes"/>
349         <xsl:call-template name="id.attribute"/>
350         <code>
351           <xsl:call-template name="generate.html.title"/>
352           <xsl:call-template name="dir"/>
353           <xsl:copy-of select="$contentwithlink"/>
354         </code>
355         <xsl:call-template name="apply-annotations"/>
356       </strong>
357     </xsl:otherwise>
358   </xsl:choose>
359 </xsl:template>
360
361 <xsl:template name="inline.italicmonoseq">
362   <xsl:param name="content">
363     <xsl:apply-templates/>
364   </xsl:param>
365
366   <xsl:param name="contentwithlink">
367     <xsl:call-template name="anchor"/>
368     <xsl:call-template name="simple.xlink">
369       <xsl:with-param name="content" select="$content"/>
370     </xsl:call-template>
371   </xsl:param>
372
373   <em>
374     <xsl:call-template name="common.html.attributes"/>
375     <xsl:call-template name="id.attribute"/>
376     <code>
377       <xsl:call-template name="generate.html.title"/>
378       <xsl:call-template name="dir"/>
379       <xsl:copy-of select="$contentwithlink"/>
380       <xsl:call-template name="apply-annotations"/>
381     </code>
382   </em>
383 </xsl:template>
384
385 <xsl:template name="inline.superscriptseq">
386   <xsl:param name="content">
387     <xsl:apply-templates/>
388   </xsl:param>
389
390   <xsl:param name="contentwithlink">
391     <xsl:call-template name="anchor"/>
392     <xsl:call-template name="simple.xlink">
393       <xsl:with-param name="content" select="$content"/>
394     </xsl:call-template>
395   </xsl:param>
396
397   <sup>
398     <xsl:call-template name="generate.html.title"/>
399     <xsl:call-template name="id.attribute"/>
400     <xsl:call-template name="dir"/>
401     <xsl:copy-of select="$contentwithlink"/>
402     <xsl:call-template name="apply-annotations"/>
403   </sup>
404 </xsl:template>
405
406 <xsl:template name="inline.subscriptseq">
407   <xsl:param name="content">
408     <xsl:apply-templates/>
409   </xsl:param>
410
411   <xsl:param name="contentwithlink">
412     <xsl:call-template name="anchor"/>
413     <xsl:call-template name="simple.xlink">
414       <xsl:with-param name="content" select="$content"/>
415     </xsl:call-template>
416   </xsl:param>
417
418   <sub>
419     <xsl:call-template name="generate.html.title"/>
420     <xsl:call-template name="id.attribute"/>
421     <xsl:call-template name="dir"/>
422     <xsl:copy-of select="$contentwithlink"/>
423     <xsl:call-template name="apply-annotations"/>
424   </sub>
425 </xsl:template>
426
427 <!-- ==================================================================== -->
428 <!-- some special cases -->
429
430 <xsl:template match="author">
431   <xsl:param name="content">
432     <xsl:call-template name="person.name"/>
433   </xsl:param>
434
435   <xsl:param name="contentwithlink">
436     <xsl:call-template name="anchor"/>
437     <xsl:call-template name="simple.xlink">
438       <xsl:with-param name="content" select="$content"/>
439     </xsl:call-template>
440     <xsl:call-template name="apply-annotations"/>
441   </xsl:param>
442
443   <span>
444     <xsl:call-template name="common.html.attributes"/>
445     <xsl:call-template name="id.attribute"/>
446     <xsl:copy-of select="$contentwithlink"/>
447   </span>
448 </xsl:template>
449
450 <xsl:template match="editor">
451   <xsl:param name="content">
452     <xsl:call-template name="person.name"/>
453   </xsl:param>
454
455   <xsl:param name="contentwithlink">
456     <xsl:call-template name="anchor"/>
457     <xsl:call-template name="simple.xlink">
458       <xsl:with-param name="content" select="$content"/>
459     </xsl:call-template>
460     <xsl:call-template name="apply-annotations"/>
461   </xsl:param>
462
463   <span>
464     <xsl:call-template name="common.html.attributes"/>
465     <xsl:call-template name="id.attribute"/>
466     <xsl:copy-of select="$contentwithlink"/>
467   </span>
468 </xsl:template>
469
470 <xsl:template match="othercredit">
471   <xsl:param name="content">
472     <xsl:call-template name="person.name"/>
473   </xsl:param>
474
475   <xsl:param name="contentwithlink">
476     <xsl:call-template name="anchor"/>
477     <xsl:call-template name="simple.xlink">
478       <xsl:with-param name="content" select="$content"/>
479     </xsl:call-template>
480     <xsl:call-template name="apply-annotations"/>
481   </xsl:param>
482
483   <span>
484     <xsl:call-template name="common.html.attributes"/>
485     <xsl:call-template name="id.attribute"/>
486     <xsl:copy-of select="$contentwithlink"/>
487   </span>
488 </xsl:template>
489
490 <xsl:template match="authorinitials">
491   <xsl:call-template name="inline.charseq"/>
492 </xsl:template>
493
494 <!-- ==================================================================== -->
495
496 <xsl:template match="accel">
497   <xsl:call-template name="inline.charseq"/>
498 </xsl:template>
499
500 <xsl:template match="action">
501   <xsl:call-template name="inline.charseq"/>
502 </xsl:template>
503
504 <xsl:template match="application">
505   <xsl:call-template name="inline.charseq"/>
506 </xsl:template>
507
508 <xsl:template match="classname">
509   <xsl:call-template name="inline.monoseq"/>
510 </xsl:template>
511
512 <xsl:template match="exceptionname">
513   <xsl:call-template name="inline.monoseq"/>
514 </xsl:template>
515
516 <xsl:template match="interfacename">
517   <xsl:call-template name="inline.monoseq"/>
518 </xsl:template>
519
520 <xsl:template match="methodname">
521   <xsl:call-template name="inline.monoseq"/>
522 </xsl:template>
523
524 <xsl:template match="command">
525   <xsl:call-template name="inline.boldseq"/>
526 </xsl:template>
527
528 <xsl:template match="computeroutput">
529   <xsl:call-template name="inline.monoseq"/>
530 </xsl:template>
531
532 <xsl:template match="constant">
533   <xsl:call-template name="inline.monoseq"/>
534 </xsl:template>
535
536 <xsl:template match="database">
537   <xsl:call-template name="inline.charseq"/>
538 </xsl:template>
539
540 <xsl:template match="date">
541   <!-- should this support locale-specific formatting? how? -->
542   <xsl:call-template name="inline.charseq"/>
543 </xsl:template>
544
545 <xsl:template match="errorcode">
546   <xsl:call-template name="inline.charseq"/>
547 </xsl:template>
548
549 <xsl:template match="errorname">
550   <xsl:call-template name="inline.charseq"/>
551 </xsl:template>
552
553 <xsl:template match="errortype">
554   <xsl:call-template name="inline.charseq"/>
555 </xsl:template>
556
557 <xsl:template match="errortext">
558   <xsl:call-template name="inline.charseq"/>
559 </xsl:template>
560
561 <xsl:template match="envar">
562   <xsl:call-template name="inline.monoseq"/>
563 </xsl:template>
564
565 <xsl:template match="filename">
566   <xsl:call-template name="inline.monoseq"/>
567 </xsl:template>
568
569 <xsl:template match="function">
570   <xsl:choose>
571     <xsl:when test="$function.parens != '0'                     and (parameter or function or replaceable)">
572       <xsl:variable name="nodes" select="text()|*"/>
573       <xsl:call-template name="inline.monoseq">
574         <xsl:with-param name="content">
575           <xsl:call-template name="simple.xlink">
576             <xsl:with-param name="content">
577               <xsl:apply-templates select="$nodes[1]"/>
578             </xsl:with-param>
579           </xsl:call-template>
580         </xsl:with-param>
581       </xsl:call-template>
582       <xsl:text>(</xsl:text>
583       <xsl:apply-templates select="$nodes[position()&gt;1]"/>
584       <xsl:text>)</xsl:text>
585     </xsl:when>
586     <xsl:otherwise>
587      <xsl:call-template name="inline.monoseq"/>
588     </xsl:otherwise>
589   </xsl:choose>
590 </xsl:template>
591
592 <xsl:template match="function/parameter" priority="2">
593   <xsl:call-template name="inline.italicmonoseq"/>
594   <xsl:if test="$function.parens != 0 and following-sibling::*">
595     <xsl:text>, </xsl:text>
596   </xsl:if>
597 </xsl:template>
598
599 <xsl:template match="function/replaceable" priority="2">
600   <xsl:call-template name="inline.italicmonoseq"/>
601   <xsl:if test="$function.parens != 0 and following-sibling::*">
602     <xsl:text>, </xsl:text>
603   </xsl:if>
604 </xsl:template>
605
606 <xsl:template match="guibutton">
607   <xsl:call-template name="inline.charseq"/>
608 </xsl:template>
609
610 <xsl:template match="guiicon">
611   <xsl:call-template name="inline.charseq"/>
612 </xsl:template>
613
614 <xsl:template match="guilabel">
615   <xsl:call-template name="inline.charseq"/>
616 </xsl:template>
617
618 <xsl:template match="guimenu">
619   <xsl:call-template name="inline.charseq"/>
620 </xsl:template>
621
622 <xsl:template match="guimenuitem">
623   <xsl:call-template name="inline.charseq"/>
624 </xsl:template>
625
626 <xsl:template match="guisubmenu">
627   <xsl:call-template name="inline.charseq"/>
628 </xsl:template>
629
630 <xsl:template match="hardware">
631   <xsl:call-template name="inline.charseq"/>
632 </xsl:template>
633
634 <xsl:template match="interface">
635   <xsl:call-template name="inline.charseq"/>
636 </xsl:template>
637
638 <xsl:template match="interfacedefinition">
639   <xsl:call-template name="inline.charseq"/>
640 </xsl:template>
641
642 <xsl:template match="keycap">
643   <xsl:choose>
644     <xsl:when test="@function and normalize-space(.) = ''">
645       <xsl:call-template name="inline.boldseq">
646         <xsl:with-param name="content">
647           <xsl:call-template name="gentext.template">
648             <xsl:with-param name="context" select="'keycap'"/>
649             <xsl:with-param name="name" select="@function"/>
650           </xsl:call-template>
651         </xsl:with-param>
652       </xsl:call-template>
653     </xsl:when>
654     <xsl:otherwise>
655       <xsl:call-template name="inline.boldseq"/>
656     </xsl:otherwise>
657   </xsl:choose>
658 </xsl:template>
659
660 <xsl:template match="keycode">
661   <xsl:call-template name="inline.charseq"/>
662 </xsl:template>
663
664 <xsl:template match="keysym">
665   <xsl:call-template name="inline.charseq"/>
666 </xsl:template>
667
668 <xsl:template match="literal">
669   <xsl:call-template name="inline.monoseq"/>
670 </xsl:template>
671
672 <xsl:template match="code">
673   <xsl:call-template name="inline.monoseq"/>
674 </xsl:template>
675
676 <xsl:template match="medialabel">
677   <xsl:call-template name="inline.italicseq"/>
678 </xsl:template>
679
680 <xsl:template match="shortcut">
681   <xsl:call-template name="inline.boldseq"/>
682 </xsl:template>
683
684 <xsl:template match="mousebutton">
685   <xsl:call-template name="inline.charseq"/>
686 </xsl:template>
687
688 <xsl:template match="option">
689   <xsl:call-template name="inline.monoseq"/>
690 </xsl:template>
691
692 <xsl:template match="package">
693   <xsl:call-template name="inline.charseq"/>
694 </xsl:template>
695
696 <xsl:template match="parameter">
697   <xsl:call-template name="inline.italicmonoseq"/>
698 </xsl:template>
699
700 <xsl:template match="property">
701   <xsl:call-template name="inline.charseq"/>
702 </xsl:template>
703
704 <xsl:template match="prompt">
705   <xsl:call-template name="inline.monoseq"/>
706 </xsl:template>
707
708 <xsl:template match="replaceable" priority="1">
709   <xsl:call-template name="inline.italicmonoseq"/>
710 </xsl:template>
711
712 <xsl:template match="returnvalue">
713   <xsl:call-template name="inline.charseq"/>
714 </xsl:template>
715
716 <xsl:template match="structfield">
717   <xsl:call-template name="inline.italicmonoseq"/>
718 </xsl:template>
719
720 <xsl:template match="structname">
721   <xsl:call-template name="inline.charseq"/>
722 </xsl:template>
723
724 <xsl:template match="symbol">
725   <xsl:call-template name="inline.charseq"/>
726 </xsl:template>
727
728 <xsl:template match="systemitem">
729   <xsl:call-template name="inline.monoseq"/>
730 </xsl:template>
731
732 <xsl:template match="token">
733   <xsl:call-template name="inline.charseq"/>
734 </xsl:template>
735
736 <xsl:template match="type">
737   <xsl:call-template name="inline.charseq"/>
738 </xsl:template>
739
740 <xsl:template match="userinput">
741   <xsl:call-template name="inline.boldmonoseq"/>
742 </xsl:template>
743
744 <xsl:template match="abbrev">
745   <xsl:call-template name="inline.charseq">
746     <xsl:with-param name="wrapper-name">abbr</xsl:with-param>
747   </xsl:call-template>
748 </xsl:template>
749
750 <xsl:template match="acronym">
751   <xsl:call-template name="inline.charseq">
752     <xsl:with-param name="wrapper-name">acronym</xsl:with-param>
753   </xsl:call-template>
754 </xsl:template>
755
756 <xsl:template match="citerefentry">
757   <xsl:choose>
758     <xsl:when test="$citerefentry.link != '0'">
759       <a>
760         <xsl:apply-templates select="." mode="common.html.attributes"/>
761         <xsl:attribute name="href">
762           <xsl:call-template name="generate.citerefentry.link"/>
763         </xsl:attribute>
764         <xsl:call-template name="inline.charseq"/>
765       </a>
766     </xsl:when>
767     <xsl:otherwise>
768       <xsl:call-template name="inline.charseq"/>
769     </xsl:otherwise>
770   </xsl:choose>
771 </xsl:template>
772
773 <xsl:template name="generate.citerefentry.link">
774   <!-- nop -->
775 </xsl:template>
776
777 <xsl:template name="x.generate.citerefentry.link">
778   <xsl:text>http://example.com/cgi-bin/man.cgi?</xsl:text>
779   <xsl:value-of select="refentrytitle"/>
780   <xsl:text>(</xsl:text>
781   <xsl:value-of select="manvolnum"/>
782   <xsl:text>)</xsl:text>
783 </xsl:template>
784
785 <xsl:template match="citetitle">
786   <xsl:choose>
787     <xsl:when test="@pubwork = 'article'">
788       <xsl:call-template name="gentext.startquote"/>
789       <xsl:call-template name="inline.charseq"/>
790       <xsl:call-template name="gentext.endquote"/>
791     </xsl:when>
792     <xsl:otherwise>
793       <xsl:call-template name="inline.italicseq"/>
794     </xsl:otherwise>
795   </xsl:choose>
796 </xsl:template>
797
798 <xsl:template match="emphasis">
799   <span>
800     <xsl:call-template name="id.attribute"/>
801     <xsl:choose>
802       <!-- We don't want empty @class values, so do not propagate empty @roles -->
803       <xsl:when test="@role  and                       normalize-space(@role) != '' and                       $emphasis.propagates.style != 0">
804         <xsl:apply-templates select="." mode="common.html.attributes">
805           <xsl:with-param name="class" select="@role"/>
806         </xsl:apply-templates>
807       </xsl:when>
808       <xsl:otherwise>
809         <xsl:apply-templates select="." mode="common.html.attributes"/>
810       </xsl:otherwise>
811     </xsl:choose>
812     <xsl:call-template name="anchor"/>
813
814     <xsl:call-template name="simple.xlink">
815       <xsl:with-param name="content">
816         <xsl:choose>
817           <xsl:when test="@role = 'bold' or @role='strong'">
818             <!-- backwards compatibility: make bold into b elements, but -->
819             <!-- don't put bold inside figure, example, or table titles -->
820             <xsl:choose>
821               <xsl:when test="local-name(..) = 'title'                               and (local-name(../..) = 'figure'                               or local-name(../..) = 'example'                               or local-name(../..) = 'table')">
822                 <xsl:apply-templates/>
823               </xsl:when>
824               <xsl:otherwise>
825                 <strong><xsl:apply-templates/></strong>
826               </xsl:otherwise>
827             </xsl:choose>
828           </xsl:when>
829           <xsl:when test="@role and $emphasis.propagates.style != 0">
830             <xsl:apply-templates/>
831           </xsl:when>
832           <xsl:otherwise>
833             <em><xsl:apply-templates/></em>
834           </xsl:otherwise>
835         </xsl:choose>
836       </xsl:with-param>
837     </xsl:call-template>
838   </span>
839 </xsl:template>
840
841 <xsl:template match="foreignphrase">
842   <span>
843     <xsl:apply-templates select="." mode="common.html.attributes"/>
844     <xsl:call-template name="inline.italicseq"/>
845   </span>
846 </xsl:template>
847
848 <xsl:template match="markup">
849   <xsl:call-template name="inline.charseq"/>
850 </xsl:template>
851
852 <xsl:template match="phrase">
853   <span>
854     <xsl:call-template name="id.attribute"/>
855     <xsl:call-template name="locale.html.attributes"/>
856     <!-- We don't want empty @class values, so do not propagate empty @roles -->
857     <xsl:choose>
858       <xsl:when test="@role and                       normalize-space(@role) != '' and                      $phrase.propagates.style != 0">
859         <xsl:apply-templates select="." mode="class.attribute">
860           <xsl:with-param name="class" select="@role"/>
861         </xsl:apply-templates>
862       </xsl:when>
863       <xsl:otherwise>
864         <xsl:apply-templates select="." mode="class.attribute"/>
865       </xsl:otherwise>
866     </xsl:choose>
867     <xsl:call-template name="dir"/>
868     <xsl:call-template name="anchor"/>
869     <xsl:call-template name="simple.xlink">
870       <xsl:with-param name="content">
871         <xsl:apply-templates/>
872       </xsl:with-param>
873     </xsl:call-template>
874     <xsl:call-template name="apply-annotations"/>
875   </span>
876 </xsl:template>
877
878 <xsl:template match="quote">
879   <xsl:variable name="depth">
880     <xsl:call-template name="dot.count">
881       <xsl:with-param name="string">
882         <xsl:number level="multiple"/>
883       </xsl:with-param>
884     </xsl:call-template>
885   </xsl:variable>
886   <span>
887     <xsl:apply-templates select="." mode="common.html.attributes"/>
888     <xsl:choose>
889       <xsl:when test="$depth mod 2 = 0">
890         <xsl:call-template name="gentext.startquote"/>
891         <xsl:call-template name="inline.charseq"/>
892         <xsl:call-template name="gentext.endquote"/>
893       </xsl:when>
894       <xsl:otherwise>
895         <xsl:call-template name="gentext.nestedstartquote"/>
896         <xsl:call-template name="inline.charseq"/>
897         <xsl:call-template name="gentext.nestedendquote"/>
898       </xsl:otherwise>
899     </xsl:choose>
900   </span>
901 </xsl:template>
902
903 <xsl:template match="varname">
904   <xsl:call-template name="inline.monoseq"/>
905 </xsl:template>
906
907 <xsl:template match="wordasword">
908   <xsl:call-template name="inline.italicseq"/>
909 </xsl:template>
910
911 <xsl:template match="lineannotation">
912   <em>
913     <xsl:apply-templates select="." mode="common.html.attributes"/>
914     <xsl:call-template name="inline.charseq"/>
915   </em>
916 </xsl:template>
917
918 <xsl:template match="superscript">
919   <xsl:call-template name="inline.superscriptseq"/>
920 </xsl:template>
921
922 <xsl:template match="subscript">
923   <xsl:call-template name="inline.subscriptseq"/>
924 </xsl:template>
925
926 <xsl:template match="trademark">
927   <xsl:call-template name="inline.charseq"/>
928   <xsl:choose>
929     <xsl:when test="@class = 'copyright'                     or @class = 'registered'">
930       <xsl:call-template name="dingbat">
931         <xsl:with-param name="dingbat" select="@class"/>
932       </xsl:call-template>
933     </xsl:when>
934     <xsl:when test="@class = 'service'">
935       <sup>SM</sup>
936     </xsl:when>
937     <xsl:otherwise>
938       <xsl:call-template name="dingbat">
939         <xsl:with-param name="dingbat" select="'trademark'"/>
940       </xsl:call-template>
941     </xsl:otherwise>
942   </xsl:choose>
943 </xsl:template>
944
945 <xsl:template match="firstterm">
946   <xsl:call-template name="glossterm">
947     <xsl:with-param name="firstterm" select="1"/>
948   </xsl:call-template>
949 </xsl:template>
950
951 <xsl:template match="glossterm" name="glossterm">
952   <xsl:param name="firstterm" select="0"/>
953
954   <!-- To avoid extra <a name=""> anchor from inline.italicseq -->
955   <xsl:variable name="content">
956     <xsl:apply-templates/>
957   </xsl:variable>
958
959   <xsl:choose>
960     <xsl:when test="($firstterm.only.link = 0 or $firstterm = 1) and @linkend">
961       <xsl:variable name="targets" select="key('id',@linkend)"/>
962       <xsl:variable name="target" select="$targets[1]"/>
963
964       <xsl:call-template name="check.id.unique">
965         <xsl:with-param name="linkend" select="@linkend"/>
966       </xsl:call-template>
967
968       <xsl:choose>
969         <xsl:when test="$target">
970           <a>
971             <xsl:apply-templates select="." mode="common.html.attributes"/>
972
973             <xsl:attribute name="href">
974               <xsl:call-template name="href.target">
975                 <xsl:with-param name="object" select="$target"/>
976               </xsl:call-template>
977             </xsl:attribute>
978
979             <xsl:call-template name="inline.italicseq">
980               <xsl:with-param name="content" select="$content"/>
981             </xsl:call-template>
982           </a>
983         </xsl:when>
984         <xsl:otherwise>
985           <xsl:call-template name="inline.italicseq">
986             <xsl:with-param name="content" select="$content"/>
987           </xsl:call-template>
988         </xsl:otherwise>
989       </xsl:choose>
990     </xsl:when>
991
992     <xsl:when test="not(@linkend)                     and ($firstterm.only.link = 0 or $firstterm = 1)                     and ($glossterm.auto.link != 0)                     and $glossary.collection != ''">
993       <xsl:variable name="term">
994         <xsl:choose>
995           <xsl:when test="@baseform"><xsl:value-of select="@baseform"/></xsl:when>
996           <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
997         </xsl:choose>
998       </xsl:variable>
999
1000       <xsl:variable name="cterm" select="(document($glossary.collection,.)//glossentry[glossterm=$term])[1]"/>
1001
1002       <!-- HACK HACK HACK! But it works... -->
1003       <!-- You'd need to do more work if you wanted to chunk on glossdiv, though -->
1004
1005       <xsl:variable name="glossary" select="//glossary[@role='auto']"/>
1006
1007       <xsl:if test="count($glossary) != 1">
1008         <xsl:message>
1009           <xsl:text>Warning: glossary.collection specified, but there are </xsl:text>
1010           <xsl:value-of select="count($glossary)"/>
1011           <xsl:text> automatic glossaries</xsl:text>
1012         </xsl:message>
1013       </xsl:if>
1014
1015       <xsl:variable name="glosschunk">
1016         <xsl:call-template name="href.target">
1017           <xsl:with-param name="object" select="$glossary"/>
1018         </xsl:call-template>
1019       </xsl:variable>
1020
1021       <xsl:variable name="chunkbase">
1022         <xsl:choose>
1023           <xsl:when test="contains($glosschunk, '#')">
1024             <xsl:value-of select="substring-before($glosschunk, '#')"/>
1025           </xsl:when>
1026           <xsl:otherwise>
1027             <xsl:value-of select="$glosschunk"/>
1028           </xsl:otherwise>
1029         </xsl:choose>
1030       </xsl:variable>
1031
1032       <xsl:choose>
1033         <xsl:when test="not($cterm)">
1034           <xsl:message>
1035             <xsl:text>There's no entry for </xsl:text>
1036             <xsl:value-of select="$term"/>
1037             <xsl:text> in </xsl:text>
1038             <xsl:value-of select="$glossary.collection"/>
1039           </xsl:message>
1040           <xsl:call-template name="inline.italicseq"/>
1041         </xsl:when>
1042         <xsl:otherwise>
1043           <xsl:variable name="id">
1044             <xsl:call-template name="object.id">
1045               <xsl:with-param name="object" select="$cterm"/>
1046             </xsl:call-template>
1047           </xsl:variable>
1048           <a href="{$chunkbase}#{$id}">
1049             <xsl:apply-templates select="." mode="common.html.attributes"/>
1050             <xsl:call-template name="inline.italicseq">
1051               <xsl:with-param name="content" select="$content"/>
1052             </xsl:call-template>
1053           </a>
1054         </xsl:otherwise>
1055       </xsl:choose>
1056     </xsl:when>
1057
1058     <xsl:when test="not(@linkend)                     and ($firstterm.only.link = 0 or $firstterm = 1)                     and $glossterm.auto.link != 0">
1059       <xsl:variable name="term">
1060         <xsl:choose>
1061           <xsl:when test="@baseform">
1062             <xsl:value-of select="normalize-space(@baseform)"/>
1063           </xsl:when>
1064           <xsl:otherwise>
1065             <xsl:value-of select="normalize-space(.)"/>
1066           </xsl:otherwise>
1067         </xsl:choose>
1068       </xsl:variable>
1069       <xsl:variable name="targets" select="key('glossentries', $term)"/>
1070       <xsl:variable name="target" select="$targets[1]"/>
1071
1072       <xsl:choose>
1073         <xsl:when test="count($targets)=0">
1074           <xsl:message>
1075             <xsl:text>Error: no glossentry for glossterm: </xsl:text>
1076             <xsl:value-of select="."/>
1077             <xsl:text>.</xsl:text>
1078           </xsl:message>
1079           <xsl:call-template name="inline.italicseq"/>
1080         </xsl:when>
1081         <xsl:otherwise>
1082           <a>
1083             <xsl:apply-templates select="." mode="common.html.attributes"/>
1084             <xsl:if test="@id or @xml:id">
1085               <xsl:attribute name="id">
1086                 <xsl:value-of select="(@id|@xml:id)[1]"/>
1087               </xsl:attribute>
1088             </xsl:if>
1089
1090             <xsl:attribute name="href">
1091               <xsl:call-template name="href.target">
1092                 <xsl:with-param name="object" select="$target"/>
1093               </xsl:call-template>
1094             </xsl:attribute>
1095
1096             <xsl:call-template name="inline.italicseq">
1097               <xsl:with-param name="content" select="$content"/>
1098             </xsl:call-template>
1099           </a>
1100         </xsl:otherwise>
1101       </xsl:choose>
1102     </xsl:when>
1103
1104     <xsl:otherwise>
1105       <xsl:call-template name="inline.italicseq"/>
1106     </xsl:otherwise>
1107   </xsl:choose>
1108 </xsl:template>
1109
1110 <xsl:template match="termdef">
1111   <span>
1112     <xsl:apply-templates select="." mode="common.html.attributes"/>
1113     <xsl:call-template name="gentext.template">
1114       <xsl:with-param name="context" select="'termdef'"/>
1115       <xsl:with-param name="name" select="'prefix'"/>
1116     </xsl:call-template>
1117     <xsl:apply-templates/>
1118     <xsl:call-template name="gentext.template">
1119       <xsl:with-param name="context" select="'termdef'"/>
1120       <xsl:with-param name="name" select="'suffix'"/>
1121     </xsl:call-template>
1122   </span>
1123 </xsl:template>
1124
1125 <xsl:template match="sgmltag|tag">
1126   <xsl:call-template name="format.sgmltag"/>
1127 </xsl:template>
1128
1129 <xsl:template name="format.sgmltag">
1130   <xsl:param name="class">
1131     <xsl:choose>
1132       <xsl:when test="@class">
1133         <xsl:value-of select="@class"/>
1134       </xsl:when>
1135       <xsl:otherwise>element</xsl:otherwise>
1136     </xsl:choose>
1137   </xsl:param>
1138
1139   <xsl:variable name="content">
1140     <xsl:choose>
1141       <xsl:when test="$class='attribute'">
1142         <xsl:apply-templates/>
1143       </xsl:when>
1144       <xsl:when test="$class='attvalue'">
1145         <xsl:apply-templates/>
1146       </xsl:when>
1147       <xsl:when test="$class='element'">
1148         <xsl:apply-templates/>
1149       </xsl:when>
1150       <xsl:when test="$class='endtag'">
1151         <xsl:text>&lt;/</xsl:text>
1152         <xsl:apply-templates/>
1153         <xsl:text>&gt;</xsl:text>
1154       </xsl:when>
1155       <xsl:when test="$class='genentity'">
1156         <xsl:text>&amp;</xsl:text>
1157         <xsl:apply-templates/>
1158         <xsl:text>;</xsl:text>
1159       </xsl:when>
1160       <xsl:when test="$class='numcharref'">
1161         <xsl:text>&amp;#</xsl:text>
1162         <xsl:apply-templates/>
1163         <xsl:text>;</xsl:text>
1164       </xsl:when>
1165       <xsl:when test="$class='paramentity'">
1166         <xsl:text>%</xsl:text>
1167         <xsl:apply-templates/>
1168         <xsl:text>;</xsl:text>
1169       </xsl:when>
1170       <xsl:when test="$class='pi'">
1171         <xsl:text>&lt;?</xsl:text>
1172         <xsl:apply-templates/>
1173         <xsl:text>&gt;</xsl:text>
1174       </xsl:when>
1175       <xsl:when test="$class='xmlpi'">
1176         <xsl:text>&lt;?</xsl:text>
1177         <xsl:apply-templates/>
1178         <xsl:text>?&gt;</xsl:text>
1179       </xsl:when>
1180       <xsl:when test="$class='starttag'">
1181         <xsl:text>&lt;</xsl:text>
1182         <xsl:apply-templates/>
1183         <xsl:text>&gt;</xsl:text>
1184       </xsl:when>
1185       <xsl:when test="$class='emptytag'">
1186         <xsl:text>&lt;</xsl:text>
1187         <xsl:apply-templates/>
1188         <xsl:text>/&gt;</xsl:text>
1189       </xsl:when>
1190       <xsl:when test="$class='sgmlcomment' or $class='comment'">
1191         <xsl:text>&lt;!--</xsl:text>
1192         <xsl:apply-templates/>
1193         <xsl:text>--&gt;</xsl:text>
1194       </xsl:when>
1195       <xsl:otherwise>
1196         <xsl:apply-templates/>
1197       </xsl:otherwise>
1198     </xsl:choose>
1199   </xsl:variable>
1200
1201   <code>
1202     <xsl:apply-templates select="." mode="common.html.attributes">
1203       <xsl:with-param name="class" select="concat('sgmltag-', $class)"/>
1204     </xsl:apply-templates>
1205     <xsl:call-template name="simple.xlink">
1206       <xsl:with-param name="content" select="$content"/>
1207     </xsl:call-template>
1208   </code>
1209 </xsl:template>
1210
1211 <xsl:template match="email">
1212   <xsl:call-template name="inline.monoseq">
1213     <xsl:with-param name="content">
1214       <xsl:if test="not($email.delimiters.enabled = 0)">
1215         <xsl:text>&lt;</xsl:text>
1216       </xsl:if>
1217       <a>
1218         <xsl:apply-templates select="." mode="common.html.attributes"/>
1219         <xsl:call-template name="id.attribute"/>
1220         <xsl:attribute name="href">
1221           <xsl:text>mailto:</xsl:text>
1222           <xsl:value-of select="."/>
1223         </xsl:attribute>
1224         <xsl:apply-templates/>
1225       </a>
1226       <xsl:if test="not($email.delimiters.enabled = 0)">
1227         <xsl:text>&gt;</xsl:text>
1228       </xsl:if>
1229     </xsl:with-param>
1230   </xsl:call-template>
1231 </xsl:template>
1232
1233 <xsl:template match="keycombo">
1234   <xsl:variable name="action" select="@action"/>
1235   <xsl:variable name="joinchar">
1236     <xsl:choose>
1237       <xsl:when test="$action='seq'"><xsl:text> </xsl:text></xsl:when>
1238       <xsl:when test="$action='simul'">+</xsl:when>
1239       <xsl:when test="$action='press'">-</xsl:when>
1240       <xsl:when test="$action='click'">-</xsl:when>
1241       <xsl:when test="$action='double-click'">-</xsl:when>
1242       <xsl:when test="$action='other'"/>
1243       <xsl:otherwise>+</xsl:otherwise>
1244     </xsl:choose>
1245   </xsl:variable>
1246   <xsl:for-each select="*">
1247     <xsl:if test="position()&gt;1"><xsl:value-of select="$joinchar"/></xsl:if>
1248     <xsl:apply-templates select="."/>
1249   </xsl:for-each>
1250 </xsl:template>
1251
1252 <xsl:template match="uri">
1253   <xsl:call-template name="inline.monoseq"/>
1254 </xsl:template>
1255
1256 <!-- ==================================================================== -->
1257
1258 <xsl:template match="menuchoice">
1259   <xsl:variable name="shortcut" select="./shortcut"/>
1260   <xsl:call-template name="process.menuchoice"/>
1261   <xsl:if test="$shortcut">
1262     <xsl:text> (</xsl:text>
1263     <xsl:apply-templates select="$shortcut"/>
1264     <xsl:text>)</xsl:text>
1265   </xsl:if>
1266 </xsl:template>
1267
1268 <xsl:template name="process.menuchoice">
1269   <xsl:param name="nodelist" select="guibutton|guiicon|guilabel|guimenu|guimenuitem|guisubmenu|interface"/><!-- not(shortcut) -->
1270   <xsl:param name="count" select="1"/>
1271
1272   <xsl:choose>
1273     <xsl:when test="$count&gt;count($nodelist)"/>
1274     <xsl:when test="$count=1">
1275       <xsl:apply-templates select="$nodelist[$count=position()]"/>
1276       <xsl:call-template name="process.menuchoice">
1277         <xsl:with-param name="nodelist" select="$nodelist"/>
1278         <xsl:with-param name="count" select="$count+1"/>
1279       </xsl:call-template>
1280     </xsl:when>
1281     <xsl:otherwise>
1282       <xsl:variable name="node" select="$nodelist[$count=position()]"/>
1283       <xsl:choose>
1284         <xsl:when test="local-name($node)='guimenuitem'                         or local-name($node)='guisubmenu'">
1285           <xsl:value-of select="$menuchoice.menu.separator"/>
1286         </xsl:when>
1287         <xsl:otherwise>
1288           <xsl:value-of select="$menuchoice.separator"/>
1289         </xsl:otherwise>
1290       </xsl:choose>
1291       <xsl:apply-templates select="$node"/>
1292       <xsl:call-template name="process.menuchoice">
1293         <xsl:with-param name="nodelist" select="$nodelist"/>
1294         <xsl:with-param name="count" select="$count+1"/>
1295       </xsl:call-template>
1296     </xsl:otherwise>
1297   </xsl:choose>
1298 </xsl:template>
1299
1300 <!-- ==================================================================== -->
1301
1302 <xsl:template match="optional">
1303   <xsl:value-of select="$arg.choice.opt.open.str"/>
1304   <xsl:call-template name="inline.charseq"/>
1305   <xsl:value-of select="$arg.choice.opt.close.str"/>
1306 </xsl:template>
1307
1308 <xsl:template match="citation">
1309   <!-- todo: integrate with bibliography collection -->
1310   <xsl:variable name="targets" select="(//biblioentry | //bibliomixed)[abbrev = string(current())]"/>
1311   <xsl:variable name="target" select="$targets[1]"/>
1312
1313   <xsl:choose>
1314     <!-- try automatic linking based on match to abbrev -->
1315     <xsl:when test="$target and not(xref) and not(link)">
1316
1317       <xsl:text>[</xsl:text>
1318       <a>
1319         <xsl:apply-templates select="." mode="common.html.attributes"/>
1320         <xsl:attribute name="href">
1321           <xsl:call-template name="href.target">
1322             <xsl:with-param name="object" select="$target"/>
1323           </xsl:call-template>
1324         </xsl:attribute>
1325
1326         <xsl:choose>
1327           <xsl:when test="$bibliography.numbered != 0">
1328             <xsl:call-template name="id.attribute"/>
1329             <xsl:apply-templates select="$target" mode="citation"/>
1330           </xsl:when>
1331           <xsl:otherwise>
1332             <xsl:call-template name="inline.charseq"/>
1333           </xsl:otherwise>
1334         </xsl:choose>
1335
1336       </a>
1337       <xsl:text>]</xsl:text>
1338     </xsl:when>
1339     <xsl:otherwise>
1340       <xsl:text>[</xsl:text>
1341       <xsl:call-template name="inline.charseq"/>
1342       <xsl:text>]</xsl:text>
1343     </xsl:otherwise>
1344   </xsl:choose>
1345 </xsl:template>
1346
1347 <xsl:template match="citebiblioid">
1348   <xsl:variable name="targets" select="//*[biblioid = string(current())]"/>
1349   <xsl:variable name="target" select="$targets[1]"/>
1350
1351   <xsl:choose>
1352     <!-- try automatic linking based on match to parent of biblioid -->
1353     <xsl:when test="$target and not(xref) and not(link)">
1354
1355       <xsl:text>[</xsl:text>
1356       <a>
1357         <xsl:apply-templates select="." mode="common.html.attributes"/>
1358         <xsl:attribute name="href">
1359           <xsl:call-template name="href.target">
1360             <xsl:with-param name="object" select="$target"/>
1361           </xsl:call-template>
1362         </xsl:attribute>
1363
1364         <xsl:call-template name="inline.charseq"/>
1365
1366       </a>
1367       <xsl:text>]</xsl:text>
1368     </xsl:when>
1369     <xsl:otherwise>
1370       <xsl:text>[</xsl:text>
1371       <xsl:call-template name="inline.charseq"/>
1372       <xsl:text>]</xsl:text>
1373     </xsl:otherwise>
1374   </xsl:choose>
1375 </xsl:template>
1376
1377 <xsl:template match="biblioentry|bibliomixed" mode="citation">
1378   <xsl:number from="bibliography" count="biblioentry|bibliomixed" level="any" format="1"/>
1379 </xsl:template>
1380
1381 <!-- ==================================================================== -->
1382
1383 <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|parent::topic]|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|parent::topic]">
1384   <xsl:if test="$show.comments != 0">
1385     <p class="remark"><em><xsl:call-template name="inline.charseq"/></em></p>
1386   </xsl:if>
1387 </xsl:template>
1388
1389 <xsl:template match="comment|remark">
1390   <xsl:if test="$show.comments != 0">
1391     <em><xsl:call-template name="inline.charseq"/></em>
1392   </xsl:if>
1393 </xsl:template>
1394
1395 <!-- ==================================================================== -->
1396
1397 <xsl:template match="productname">
1398   <xsl:call-template name="inline.charseq"/>
1399   <xsl:if test="@class">
1400     <xsl:call-template name="dingbat">
1401       <xsl:with-param name="dingbat" select="@class"/>
1402     </xsl:call-template>
1403   </xsl:if>
1404 </xsl:template>
1405
1406 <xsl:template match="productnumber">
1407   <xsl:call-template name="inline.charseq"/>
1408 </xsl:template>
1409
1410 <!-- ==================================================================== -->
1411
1412 <xsl:template match="pob|street|city|state|postcode|country|otheraddr">
1413   <xsl:call-template name="inline.charseq"/>
1414 </xsl:template>
1415
1416 <xsl:template match="phone|fax">
1417   <xsl:call-template name="inline.charseq"/>
1418 </xsl:template>
1419
1420 <!-- in Addresses, for example -->
1421 <xsl:template match="honorific|firstname|surname|lineage|othername">
1422   <xsl:call-template name="inline.charseq"/>
1423 </xsl:template>
1424
1425 <!-- ==================================================================== -->
1426
1427 <xsl:template match="person">
1428   <xsl:param name="content">
1429     <xsl:apply-templates select="personname"/>
1430   </xsl:param>
1431
1432   <xsl:param name="contentwithlink">
1433     <xsl:call-template name="anchor"/>
1434     <xsl:call-template name="simple.xlink">
1435       <xsl:with-param name="content" select="$content"/>
1436     </xsl:call-template>
1437     <xsl:call-template name="apply-annotations"/>
1438   </xsl:param>
1439
1440   <span>
1441     <xsl:apply-templates select="." mode="common.html.attributes"/>
1442     <xsl:call-template name="id.attribute"/>
1443     <xsl:copy-of select="$contentwithlink"/>
1444   </span>
1445 </xsl:template>
1446
1447 <xsl:template match="personname">
1448   <xsl:param name="content">
1449     <xsl:call-template name="person.name"/>
1450   </xsl:param>
1451
1452   <xsl:param name="contentwithlink">
1453     <xsl:call-template name="anchor"/>
1454     <xsl:call-template name="simple.xlink">
1455       <xsl:with-param name="content" select="$content"/>
1456     </xsl:call-template>
1457     <xsl:call-template name="apply-annotations"/>
1458   </xsl:param>
1459
1460   <span>
1461     <xsl:apply-templates select="." mode="common.html.attributes"/>
1462     <xsl:call-template name="id.attribute"/>
1463     <xsl:copy-of select="$contentwithlink"/>
1464   </span>
1465 </xsl:template>
1466
1467 <!-- ==================================================================== -->
1468
1469 <xsl:template match="org">
1470   <xsl:param name="content">
1471     <xsl:apply-templates/>
1472   </xsl:param>
1473
1474   <xsl:param name="contentwithlink">
1475     <xsl:call-template name="anchor"/>
1476     <xsl:call-template name="simple.xlink">
1477       <xsl:with-param name="content" select="$content"/>
1478     </xsl:call-template>
1479     <xsl:call-template name="apply-annotations"/>
1480   </xsl:param>
1481
1482   <span>
1483     <xsl:apply-templates select="." mode="common.html.attributes"/>
1484     <xsl:call-template name="id.attribute"/>
1485     <xsl:copy-of select="$contentwithlink"/>
1486   </span>
1487 </xsl:template>
1488
1489 <xsl:template match="orgname">
1490   <xsl:param name="content">
1491     <xsl:apply-templates/>
1492   </xsl:param>
1493
1494   <xsl:param name="contentwithlink">
1495     <xsl:call-template name="anchor"/>
1496     <xsl:call-template name="simple.xlink">
1497       <xsl:with-param name="content" select="$content"/>
1498     </xsl:call-template>
1499     <xsl:call-template name="apply-annotations"/>
1500   </xsl:param>
1501
1502   <span>
1503     <xsl:apply-templates select="." mode="common.html.attributes"/>
1504     <xsl:call-template name="id.attribute"/>
1505     <xsl:copy-of select="$contentwithlink"/>
1506   </span>
1507 </xsl:template>
1508
1509 <xsl:template match="orgdiv">
1510   <xsl:param name="content">
1511     <xsl:apply-templates/>
1512   </xsl:param>
1513
1514   <xsl:param name="contentwithlink">
1515     <xsl:call-template name="anchor"/>
1516     <xsl:call-template name="simple.xlink">
1517       <xsl:with-param name="content" select="$content"/>
1518     </xsl:call-template>
1519     <xsl:call-template name="apply-annotations"/>
1520   </xsl:param>
1521
1522   <span>
1523     <xsl:apply-templates select="." mode="common.html.attributes"/>
1524     <xsl:call-template name="id.attribute"/>
1525     <xsl:copy-of select="$contentwithlink"/>
1526   </span>
1527 </xsl:template>
1528
1529 <xsl:template match="affiliation">
1530   <xsl:param name="content">
1531     <xsl:call-template name="person.name"/>
1532   </xsl:param>
1533
1534   <xsl:param name="contentwithlink">
1535     <xsl:call-template name="anchor"/>
1536     <xsl:call-template name="simple.xlink">
1537       <xsl:with-param name="content" select="$content"/>
1538     </xsl:call-template>
1539     <xsl:call-template name="apply-annotations"/>
1540   </xsl:param>
1541
1542   <span>
1543     <xsl:apply-templates select="." mode="common.html.attributes"/>
1544     <xsl:call-template name="id.attribute"/>
1545     <xsl:copy-of select="$contentwithlink"/>
1546   </span>
1547 </xsl:template>
1548
1549 <!-- ==================================================================== -->
1550
1551 <xsl:template match="beginpage">
1552   <!-- does nothing; this *is not* markup to force a page break. -->
1553 </xsl:template>
1554
1555 </xsl:stylesheet>