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