Project

General

Profile

1
<?xml version='1.0'?>
2
<!DOCTYPE xsl:stylesheet [
3
<!ENTITY % common.entities SYSTEM "../common/entities.ent">
4
%common.entities;
5
]>
6
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7
                xmlns:xlink='http://www.w3.org/1999/xlink'
8
                xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks"
9
                exclude-result-prefixes="xlink suwl"
10
                version='1.0'>
11

    
12
<!-- ********************************************************************
13
     $Id: inline.xsl 8421 2009-05-04 07:49:49Z bobstayton $
14
     ********************************************************************
15

    
16
     This file is part of the XSL DocBook Stylesheet distribution.
17
     See ../README or http://docbook.sf.net/release/xsl/current/ for
18
     copyright and other information.
19

    
20
     ******************************************************************** -->
21
<xsl:template name="simple.xlink">
22
  <xsl:param name="node" select="."/>
23
  <xsl:param name="content">
24
    <xsl:apply-templates/>
25
  </xsl:param>
26
  <xsl:param name="linkend" select="$node/@linkend"/>
27
  <xsl:param name="xhref" select="$node/@xlink:href"/>
28

    
29
  <!-- Support for @xlink:show -->
30
  <xsl:variable name="target.show">
31
    <xsl:choose>
32
      <xsl:when test="$node/@xlink:show = 'new'">_blank</xsl:when>
33
      <xsl:when test="$node/@xlink:show = 'replace'">_top</xsl:when>
34
      <xsl:otherwise></xsl:otherwise>
35
    </xsl:choose>
36
  </xsl:variable>
37

    
38
  <xsl:variable name="link">
39
    <xsl:choose>
40
      <xsl:when test="$xhref and 
41
                      (not($node/@xlink:type) or 
42
                           $node/@xlink:type='simple')">
43

    
44
        <!-- Is it a local idref or a uri? -->
45
        <xsl:variable name="is.idref">
46
          <xsl:choose>
47
            <!-- if the href starts with # and does not contain an "(" -->
48
            <!-- or if the href starts with #xpointer(id(, it's just an ID -->
49
            <xsl:when test="starts-with($xhref,'#')
50
                            and (not(contains($xhref,'&#40;'))
51
                            or starts-with($xhref,
52
                                       '#xpointer&#40;id&#40;'))">1</xsl:when>
53
            <xsl:otherwise>0</xsl:otherwise>
54
          </xsl:choose>
55
        </xsl:variable>
56

    
57
        <!-- Is it an olink ? -->
58
        <xsl:variable name="is.olink">
59
          <xsl:choose>
60
            <!-- If xlink:role="http://docbook.org/xlink/role/olink" -->
61
            <!-- and if the href contains # -->
62
            <xsl:when test="contains($xhref,'#') and
63
                 @xlink:role = $xolink.role">1</xsl:when>
64
            <xsl:otherwise>0</xsl:otherwise>
65
          </xsl:choose>
66
        </xsl:variable>
67

    
68
        <xsl:choose>
69
          <xsl:when test="$is.olink = 1">
70
            <xsl:call-template name="olink">
71
              <xsl:with-param name="content" select="$content"/>
72
            </xsl:call-template>
73
          </xsl:when>
74

    
75
          <xsl:when test="$is.idref = 1">
76

    
77
            <xsl:variable name="idref">
78
              <xsl:call-template name="xpointer.idref">
79
                <xsl:with-param name="xpointer" select="$xhref"/>
80
              </xsl:call-template>
81
            </xsl:variable>
82

    
83
            <xsl:variable name="targets" select="key('id',$idref)"/>
84
            <xsl:variable name="target" select="$targets[1]"/>
85

    
86
            <xsl:call-template name="check.id.unique">
87
              <xsl:with-param name="linkend" select="$idref"/>
88
            </xsl:call-template>
89

    
90
            <xsl:choose>
91
              <xsl:when test="count($target) = 0">
92
                <xsl:message>
93
                  <xsl:text>XLink to nonexistent id: </xsl:text>
94
                  <xsl:value-of select="$idref"/>
95
                </xsl:message>
96
                <xsl:copy-of select="$content"/>
97
              </xsl:when>
98

    
99
              <xsl:otherwise>
100
                <a>
101
                  <xsl:apply-templates select="." mode="common.html.attributes"/>
102

    
103
                  <xsl:attribute name="href">
104
                    <xsl:call-template name="href.target">
105
                      <xsl:with-param name="object" select="$target"/>
106
                    </xsl:call-template>
107
                  </xsl:attribute>
108

    
109
                  <xsl:choose>
110
                    <xsl:when test="$node/@xlink:title">
111
                      <xsl:attribute name="title">
112
                        <xsl:value-of select="$node/@xlink:title"/>
113
                      </xsl:attribute>
114
                    </xsl:when>
115
                    <xsl:otherwise>
116
                      <xsl:apply-templates select="$target"
117
                                           mode="html.title.attribute"/>
118
                    </xsl:otherwise>
119
                  </xsl:choose>
120

    
121
                  <xsl:if test="$target.show !=''">
122
                    <xsl:attribute name="target">
123
                      <xsl:value-of select="$target.show"/>
124
                    </xsl:attribute>
125
                  </xsl:if>
126

    
127
                  <xsl:copy-of select="$content"/>
128

    
129
                </a>
130
              </xsl:otherwise>
131
            </xsl:choose>
132
          </xsl:when>
133

    
134
          <!-- otherwise it's a URI -->
135
          <xsl:otherwise>
136
            <a>
137
              <xsl:apply-templates select="." mode="common.html.attributes"/>
138
              <xsl:attribute name="href">
139
                <xsl:value-of select="$xhref"/>
140
              </xsl:attribute>
141
              <xsl:if test="$node/@xlink:title">
142
                <xsl:attribute name="title">
143
                  <xsl:value-of select="$node/@xlink:title"/>
144
                </xsl:attribute>
145
              </xsl:if>
146

    
147
              <!-- For URIs, use @xlink:show if defined, otherwise use ulink.target -->
148
              <xsl:attribute name="target">
149
                <xsl:choose>
150
                  <xsl:when test="$target.show !=''">
151
                    <xsl:value-of select="$target.show"/>
152
                  </xsl:when>
153
                  <xsl:otherwise>
154
                  <xsl:value-of select="$ulink.target"/>
155
                  </xsl:otherwise>
156
                </xsl:choose>
157
              </xsl:attribute>
158
              
159
              <xsl:copy-of select="$content"/>
160
            </a>
161
          </xsl:otherwise>
162
        </xsl:choose>
163
      </xsl:when>
164

    
165
      <xsl:when test="$linkend">
166
        <xsl:variable name="targets" select="key('id',$linkend)"/>
167
        <xsl:variable name="target" select="$targets[1]"/>
168

    
169
        <xsl:call-template name="check.id.unique">
170
          <xsl:with-param name="linkend" select="$linkend"/>
171
        </xsl:call-template>
172

    
173
        <a>
174
          <xsl:apply-templates select="." mode="common.html.attributes"/>
175
          <xsl:attribute name="href">
176
            <xsl:call-template name="href.target">
177
              <xsl:with-param name="object" select="$target"/>
178
            </xsl:call-template>
179
          </xsl:attribute>
180

    
181
          <xsl:apply-templates select="$target" mode="html.title.attribute"/>
182

    
183
          <xsl:copy-of select="$content"/>
184
          
185
        </a>
186
      </xsl:when>
187
      <xsl:otherwise>
188
        <xsl:copy-of select="$content"/>
189
      </xsl:otherwise>
190
    </xsl:choose>
191
  </xsl:variable>
192

    
193
  <xsl:choose>
194
    <xsl:when test="function-available('suwl:unwrapLinks')">
195
      <xsl:copy-of select="suwl:unwrapLinks($link)"/>
196
    </xsl:when>
197
    <xsl:otherwise>
198
      <xsl:copy-of select="$link"/>
199
    </xsl:otherwise>
200
  </xsl:choose>
201
</xsl:template>
202

    
203
<xsl:template name="inline.charseq">
204
  <xsl:param name="content">
205
    <xsl:call-template name="anchor"/>
206
    <xsl:call-template name="simple.xlink">
207
      <xsl:with-param name="content">
208
        <xsl:apply-templates/>
209
      </xsl:with-param>
210
    </xsl:call-template>
211
  </xsl:param>
212
  <!-- * if you want output from the inline.charseq template wrapped in -->
213
  <!-- * something other than a Span, call the template with some value -->
214
  <!-- * for the 'wrapper-name' param -->
215
  <xsl:param name="wrapper-name">span</xsl:param>
216
  <xsl:element name="{$wrapper-name}">
217
    <xsl:attribute name="class">
218
      <xsl:value-of select="local-name(.)"/>
219
    </xsl:attribute>
220
    <xsl:call-template name="dir"/>
221
    <xsl:call-template name="generate.html.title"/>
222
    <xsl:copy-of select="$content"/>
223
    <xsl:call-template name="apply-annotations"/>
224
  </xsl:element>
225
</xsl:template>
226

    
227
<xsl:template name="inline.monoseq">
228
  <xsl:param name="content">
229
    <xsl:call-template name="anchor"/>
230
    <xsl:call-template name="simple.xlink">
231
      <xsl:with-param name="content">
232
        <xsl:apply-templates/>
233
      </xsl:with-param>
234
    </xsl:call-template>
235
  </xsl:param>
236
  <code>
237
    <xsl:apply-templates select="." mode="common.html.attributes"/>
238
    <xsl:copy-of select="$content"/>
239
    <xsl:call-template name="apply-annotations"/>
240
  </code>
241
</xsl:template>
242

    
243
<xsl:template name="inline.boldseq">
244
  <xsl:param name="content">
245
    <xsl:call-template name="anchor"/>
246
    <xsl:call-template name="simple.xlink">
247
      <xsl:with-param name="content">
248
        <xsl:apply-templates/>
249
      </xsl:with-param>
250
    </xsl:call-template>
251
  </xsl:param>
252

    
253
  <span>
254
    <xsl:apply-templates select="." mode="common.html.attributes"/>
255

    
256
    <!-- don't put <strong> inside figure, example, or table titles -->
257
    <xsl:choose>
258
      <xsl:when test="local-name(..) = 'title'
259
                      and (local-name(../..) = 'figure'
260
                      or local-name(../..) = 'example'
261
                      or local-name(../..) = 'table')">
262
        <xsl:copy-of select="$content"/>
263
      </xsl:when>
264
      <xsl:otherwise>
265
        <strong>
266
          <xsl:copy-of select="$content"/>
267
        </strong>
268
      </xsl:otherwise>
269
    </xsl:choose>
270
    <xsl:call-template name="apply-annotations"/>
271
  </span>
272
</xsl:template>
273

    
274
<xsl:template name="inline.italicseq">
275
  <xsl:param name="content">
276
    <xsl:call-template name="anchor"/>
277
    <xsl:call-template name="simple.xlink">
278
      <xsl:with-param name="content">
279
        <xsl:apply-templates/>
280
      </xsl:with-param>
281
    </xsl:call-template>
282
  </xsl:param>
283
  <em>
284
    <xsl:call-template name="common.html.attributes"/>
285
    <xsl:copy-of select="$content"/>
286
    <xsl:call-template name="apply-annotations"/>
287
  </em>
288
</xsl:template>
289

    
290
<xsl:template name="inline.boldmonoseq">
291
  <xsl:param name="content">
292
    <xsl:call-template name="anchor"/>
293
    <xsl:call-template name="simple.xlink">
294
      <xsl:with-param name="content">
295
        <xsl:apply-templates/>
296
      </xsl:with-param>
297
    </xsl:call-template>
298
  </xsl:param>
299
  <!-- don't put <strong> inside figure, example, or table titles -->
300
  <!-- or other titles that may already be represented with <strong>'s. -->
301
  <xsl:choose>
302
    <xsl:when test="local-name(..) = 'title'
303
                    and (local-name(../..) = 'figure'
304
                         or local-name(../..) = 'example'
305
                         or local-name(../..) = 'table'
306
                         or local-name(../..) = 'formalpara')">
307
      <code>
308
        <xsl:call-template name="common.html.attributes"/>
309
        <xsl:copy-of select="$content"/>
310
        <xsl:call-template name="apply-annotations"/>
311
      </code>
312
    </xsl:when>
313
    <xsl:otherwise>
314
      <strong>
315
        <xsl:call-template name="common.html.attributes"/>
316
        <code>
317
          <xsl:call-template name="generate.html.title"/>
318
          <xsl:call-template name="dir"/>
319
          <xsl:copy-of select="$content"/>
320
        </code>
321
        <xsl:call-template name="apply-annotations"/>
322
      </strong>
323
    </xsl:otherwise>
324
  </xsl:choose>
325
</xsl:template>
326

    
327
<xsl:template name="inline.italicmonoseq">
328
  <xsl:param name="content">
329
    <xsl:call-template name="anchor"/>
330
    <xsl:call-template name="simple.xlink">
331
      <xsl:with-param name="content">
332
        <xsl:apply-templates/>
333
      </xsl:with-param>
334
    </xsl:call-template>
335
  </xsl:param>
336
  <em>
337
    <xsl:call-template name="common.html.attributes"/>
338
    <code>
339
      <xsl:call-template name="generate.html.title"/>
340
      <xsl:call-template name="dir"/>
341
      <xsl:copy-of select="$content"/>
342
      <xsl:call-template name="apply-annotations"/>
343
    </code>
344
  </em>
345
</xsl:template>
346

    
347
<xsl:template name="inline.superscriptseq">
348
  <xsl:param name="content">
349
    <xsl:call-template name="anchor"/>
350
    <xsl:call-template name="simple.xlink">
351
      <xsl:with-param name="content">
352
        <xsl:apply-templates/>
353
      </xsl:with-param>
354
    </xsl:call-template>
355
  </xsl:param>
356
  <sup>
357
    <xsl:call-template name="generate.html.title"/>
358
    <xsl:call-template name="dir"/>
359
    <xsl:copy-of select="$content"/>
360
    <xsl:call-template name="apply-annotations"/>
361
  </sup>
362
</xsl:template>
363

    
364
<xsl:template name="inline.subscriptseq">
365
  <xsl:param name="content">
366
    <xsl:call-template name="anchor"/>
367
    <xsl:call-template name="simple.xlink">
368
      <xsl:with-param name="content">
369
        <xsl:apply-templates/>
370
      </xsl:with-param>
371
    </xsl:call-template>
372
  </xsl:param>
373
  <sub>
374
    <xsl:call-template name="generate.html.title"/>
375
    <xsl:call-template name="dir"/>
376
    <xsl:copy-of select="$content"/>
377
    <xsl:call-template name="apply-annotations"/>
378
  </sub>
379
</xsl:template>
380

    
381
<!-- ==================================================================== -->
382
<!-- some special cases -->
383

    
384
<xsl:template match="author">
385
  <xsl:param name="content">
386
    <xsl:call-template name="anchor"/>
387
    <xsl:call-template name="simple.xlink">
388
      <xsl:with-param name="content">
389
        <xsl:call-template name="person.name"/>
390
      </xsl:with-param>
391
    </xsl:call-template>
392
    <xsl:call-template name="apply-annotations"/>
393
  </xsl:param>
394

    
395
  <span>
396
    <xsl:call-template name="common.html.attributes"/>
397
    <xsl:copy-of select="$content"/>
398
  </span>
399
</xsl:template>
400

    
401
<xsl:template match="editor">
402
  <xsl:param name="content">
403
    <xsl:call-template name="anchor"/>
404
    <xsl:call-template name="simple.xlink">
405
      <xsl:with-param name="content">
406
        <xsl:call-template name="person.name"/>
407
      </xsl:with-param>
408
    </xsl:call-template>
409
    <xsl:call-template name="apply-annotations"/>
410
  </xsl:param>
411

    
412
  <span>
413
    <xsl:call-template name="common.html.attributes"/>
414
    <xsl:copy-of select="$content"/>
415
  </span>
416
</xsl:template>
417

    
418
<xsl:template match="othercredit">
419
  <xsl:param name="content">
420
    <xsl:call-template name="anchor"/>
421
    <xsl:call-template name="simple.xlink">
422
      <xsl:with-param name="content">
423
        <xsl:call-template name="person.name"/>
424
      </xsl:with-param>
425
    </xsl:call-template>
426
    <xsl:call-template name="apply-annotations"/>
427
  </xsl:param>
428

    
429
  <span>
430
    <xsl:call-template name="common.html.attributes"/>
431
    <xsl:copy-of select="$content"/>
432
  </span>
433
</xsl:template>
434

    
435
<xsl:template match="authorinitials">
436
  <xsl:call-template name="inline.charseq"/>
437
</xsl:template>
438

    
439
<!-- ==================================================================== -->
440

    
441
<xsl:template match="accel">
442
  <xsl:call-template name="inline.charseq"/>
443
</xsl:template>
444

    
445
<xsl:template match="action">
446
  <xsl:call-template name="inline.charseq"/>
447
</xsl:template>
448

    
449
<xsl:template match="application">
450
  <xsl:call-template name="inline.charseq"/>
451
</xsl:template>
452

    
453
<xsl:template match="classname">
454
  <xsl:call-template name="inline.monoseq"/>
455
</xsl:template>
456

    
457
<xsl:template match="exceptionname">
458
  <xsl:call-template name="inline.monoseq"/>
459
</xsl:template>
460

    
461
<xsl:template match="interfacename">
462
  <xsl:call-template name="inline.monoseq"/>
463
</xsl:template>
464

    
465
<xsl:template match="methodname">
466
  <xsl:call-template name="inline.monoseq"/>
467
</xsl:template>
468

    
469
<xsl:template match="command">
470
  <xsl:call-template name="inline.boldseq"/>
471
</xsl:template>
472

    
473
<xsl:template match="computeroutput">
474
  <xsl:call-template name="inline.monoseq"/>
475
</xsl:template>
476

    
477
<xsl:template match="constant">
478
  <xsl:call-template name="inline.monoseq"/>
479
</xsl:template>
480

    
481
<xsl:template match="database">
482
  <xsl:call-template name="inline.charseq"/>
483
</xsl:template>
484

    
485
<xsl:template match="date">
486
  <!-- should this support locale-specific formatting? how? -->
487
  <xsl:call-template name="inline.charseq"/>
488
</xsl:template>
489

    
490
<xsl:template match="errorcode">
491
  <xsl:call-template name="inline.charseq"/>
492
</xsl:template>
493

    
494
<xsl:template match="errorname">
495
  <xsl:call-template name="inline.charseq"/>
496
</xsl:template>
497

    
498
<xsl:template match="errortype">
499
  <xsl:call-template name="inline.charseq"/>
500
</xsl:template>
501

    
502
<xsl:template match="errortext">
503
  <xsl:call-template name="inline.charseq"/>
504
</xsl:template>
505

    
506
<xsl:template match="envar">
507
  <xsl:call-template name="inline.monoseq"/>
508
</xsl:template>
509

    
510
<xsl:template match="filename">
511
  <xsl:call-template name="inline.monoseq"/>
512
</xsl:template>
513

    
514
<xsl:template match="function">
515
  <xsl:choose>
516
    <xsl:when test="$function.parens != '0'
517
                    and (parameter or function or replaceable)">
518
      <xsl:variable name="nodes" select="text()|*"/>
519
      <xsl:call-template name="inline.monoseq">
520
        <xsl:with-param name="content">
521
          <xsl:call-template name="simple.xlink">
522
            <xsl:with-param name="content">
523
              <xsl:apply-templates select="$nodes[1]"/>
524
            </xsl:with-param>
525
          </xsl:call-template>
526
        </xsl:with-param>
527
      </xsl:call-template>
528
      <xsl:text>(</xsl:text>
529
      <xsl:apply-templates select="$nodes[position()>1]"/>
530
      <xsl:text>)</xsl:text>
531
    </xsl:when>
532
    <xsl:otherwise>
533
     <xsl:call-template name="inline.monoseq"/>
534
    </xsl:otherwise>
535
  </xsl:choose>
536
</xsl:template>
537

    
538
<xsl:template match="function/parameter" priority="2">
539
  <xsl:call-template name="inline.italicmonoseq"/>
540
  <xsl:if test="following-sibling::*">
541
    <xsl:text>, </xsl:text>
542
  </xsl:if>
543
</xsl:template>
544

    
545
<xsl:template match="function/replaceable" priority="2">
546
  <xsl:call-template name="inline.italicmonoseq"/>
547
  <xsl:if test="following-sibling::*">
548
    <xsl:text>, </xsl:text>
549
  </xsl:if>
550
</xsl:template>
551

    
552
<xsl:template match="guibutton">
553
  <xsl:call-template name="inline.charseq"/>
554
</xsl:template>
555

    
556
<xsl:template match="guiicon">
557
  <xsl:call-template name="inline.charseq"/>
558
</xsl:template>
559

    
560
<xsl:template match="guilabel">
561
  <xsl:call-template name="inline.charseq"/>
562
</xsl:template>
563

    
564
<xsl:template match="guimenu">
565
  <xsl:call-template name="inline.charseq"/>
566
</xsl:template>
567

    
568
<xsl:template match="guimenuitem">
569
  <xsl:call-template name="inline.charseq"/>
570
</xsl:template>
571

    
572
<xsl:template match="guisubmenu">
573
  <xsl:call-template name="inline.charseq"/>
574
</xsl:template>
575

    
576
<xsl:template match="hardware">
577
  <xsl:call-template name="inline.charseq"/>
578
</xsl:template>
579

    
580
<xsl:template match="interface">
581
  <xsl:call-template name="inline.charseq"/>
582
</xsl:template>
583

    
584
<xsl:template match="interfacedefinition">
585
  <xsl:call-template name="inline.charseq"/>
586
</xsl:template>
587

    
588
<xsl:template match="keycap">
589
  <xsl:call-template name="inline.boldseq"/>
590
</xsl:template>
591

    
592
<xsl:template match="keycode">
593
  <xsl:call-template name="inline.charseq"/>
594
</xsl:template>
595

    
596
<xsl:template match="keysym">
597
  <xsl:call-template name="inline.charseq"/>
598
</xsl:template>
599

    
600
<xsl:template match="literal">
601
  <xsl:call-template name="inline.monoseq"/>
602
</xsl:template>
603

    
604
<xsl:template match="code">
605
  <xsl:call-template name="inline.monoseq"/>
606
</xsl:template>
607

    
608
<xsl:template match="medialabel">
609
  <xsl:call-template name="inline.italicseq"/>
610
</xsl:template>
611

    
612
<xsl:template match="shortcut">
613
  <xsl:call-template name="inline.boldseq"/>
614
</xsl:template>
615

    
616
<xsl:template match="mousebutton">
617
  <xsl:call-template name="inline.charseq"/>
618
</xsl:template>
619

    
620
<xsl:template match="option">
621
  <xsl:call-template name="inline.monoseq"/>
622
</xsl:template>
623

    
624
<xsl:template match="package">
625
  <xsl:call-template name="inline.charseq"/>
626
</xsl:template>
627

    
628
<xsl:template match="parameter">
629
  <xsl:call-template name="inline.italicmonoseq"/>
630
</xsl:template>
631

    
632
<xsl:template match="property">
633
  <xsl:call-template name="inline.charseq"/>
634
</xsl:template>
635

    
636
<xsl:template match="prompt">
637
  <xsl:call-template name="inline.monoseq"/>
638
</xsl:template>
639

    
640
<xsl:template match="replaceable" priority="1">
641
  <xsl:call-template name="inline.italicmonoseq"/>
642
</xsl:template>
643

    
644
<xsl:template match="returnvalue">
645
  <xsl:call-template name="inline.charseq"/>
646
</xsl:template>
647

    
648
<xsl:template match="structfield">
649
  <xsl:call-template name="inline.italicmonoseq"/>
650
</xsl:template>
651

    
652
<xsl:template match="structname">
653
  <xsl:call-template name="inline.charseq"/>
654
</xsl:template>
655

    
656
<xsl:template match="symbol">
657
  <xsl:call-template name="inline.charseq"/>
658
</xsl:template>
659

    
660
<xsl:template match="systemitem">
661
  <xsl:call-template name="inline.monoseq"/>
662
</xsl:template>
663

    
664
<xsl:template match="token">
665
  <xsl:call-template name="inline.charseq"/>
666
</xsl:template>
667

    
668
<xsl:template match="type">
669
  <xsl:call-template name="inline.charseq"/>
670
</xsl:template>
671

    
672
<xsl:template match="userinput">
673
  <xsl:call-template name="inline.boldmonoseq"/>
674
</xsl:template>
675

    
676
<xsl:template match="abbrev">
677
  <xsl:call-template name="inline.charseq">
678
    <xsl:with-param name="wrapper-name">abbr</xsl:with-param>
679
  </xsl:call-template>
680
</xsl:template>
681

    
682
<xsl:template match="acronym">
683
  <xsl:call-template name="inline.charseq">
684
    <xsl:with-param name="wrapper-name">acronym</xsl:with-param>
685
  </xsl:call-template>
686
</xsl:template>
687

    
688
<xsl:template match="citerefentry">
689
  <xsl:choose>
690
    <xsl:when test="$citerefentry.link != '0'">
691
      <a>
692
        <xsl:apply-templates select="." mode="common.html.attributes"/>
693
        <xsl:attribute name="href">
694
          <xsl:call-template name="generate.citerefentry.link"/>
695
        </xsl:attribute>
696
        <xsl:call-template name="inline.charseq"/>
697
      </a>
698
    </xsl:when>
699
    <xsl:otherwise>
700
      <xsl:call-template name="inline.charseq"/>
701
    </xsl:otherwise>
702
  </xsl:choose>
703
</xsl:template>
704

    
705
<xsl:template name="generate.citerefentry.link">
706
  <!-- nop -->
707
</xsl:template>
708

    
709
<xsl:template name="x.generate.citerefentry.link">
710
  <xsl:text>http://example.com/cgi-bin/man.cgi?</xsl:text>
711
  <xsl:value-of select="refentrytitle"/>
712
  <xsl:text>(</xsl:text>
713
  <xsl:value-of select="manvolnum"/>
714
  <xsl:text>)</xsl:text>
715
</xsl:template>
716

    
717
<xsl:template match="citetitle">
718
  <xsl:choose>
719
    <xsl:when test="@pubwork = 'article'">
720
      <xsl:call-template name="gentext.startquote"/>
721
      <xsl:call-template name="inline.charseq"/>
722
      <xsl:call-template name="gentext.endquote"/>
723
    </xsl:when>
724
    <xsl:otherwise>
725
      <xsl:call-template name="inline.italicseq"/>
726
    </xsl:otherwise>
727
  </xsl:choose>
728
</xsl:template>
729

    
730
<xsl:template match="emphasis">
731
  <span>
732
    <xsl:choose>
733
      <!-- We don't want empty @class values, so do not propagate empty @roles -->
734
      <xsl:when test="@role  and
735
                      normalize-space(@role) != '' and
736
                      $emphasis.propagates.style != 0">
737
        <xsl:apply-templates select="." mode="common.html.attributes">
738
          <xsl:with-param name="class" select="@role"/>
739
        </xsl:apply-templates>
740
      </xsl:when>
741
      <xsl:otherwise>
742
        <xsl:apply-templates select="." mode="common.html.attributes"/>
743
      </xsl:otherwise>
744
    </xsl:choose>
745
    <xsl:call-template name="anchor"/>
746

    
747
    <xsl:call-template name="simple.xlink">
748
      <xsl:with-param name="content">
749
        <xsl:choose>
750
          <xsl:when test="@role = 'bold' or @role='strong'">
751
            <!-- backwards compatibility: make bold into b elements, but -->
752
            <!-- don't put bold inside figure, example, or table titles -->
753
            <xsl:choose>
754
              <xsl:when test="local-name(..) = 'title'
755
                              and (local-name(../..) = 'figure'
756
                              or local-name(../..) = 'example'
757
                              or local-name(../..) = 'table')">
758
                <xsl:apply-templates/>
759
              </xsl:when>
760
              <xsl:otherwise>
761
                <strong><xsl:apply-templates/></strong>
762
              </xsl:otherwise>
763
            </xsl:choose>
764
          </xsl:when>
765
          <xsl:when test="@role and $emphasis.propagates.style != 0">
766
            <xsl:apply-templates/>
767
          </xsl:when>
768
          <xsl:otherwise>
769
            <em><xsl:apply-templates/></em>
770
          </xsl:otherwise>
771
        </xsl:choose>
772
      </xsl:with-param>
773
    </xsl:call-template>
774
  </span>
775
</xsl:template>
776

    
777
<xsl:template match="foreignphrase">
778
  <span>
779
    <xsl:apply-templates select="." mode="common.html.attributes"/>
780
    <xsl:call-template name="inline.italicseq"/>
781
  </span>
782
</xsl:template>
783

    
784
<xsl:template match="markup">
785
  <xsl:call-template name="inline.charseq"/>
786
</xsl:template>
787

    
788
<xsl:template match="phrase">
789
  <span>
790
    <xsl:call-template name="locale.html.attributes"/>
791
    <!-- We don't want empty @class values, so do not propagate empty @roles -->
792
    <xsl:if test="@role and 
793
                  normalize-space(@role) != '' and
794
                  $phrase.propagates.style != 0">
795
      <xsl:apply-templates select="." mode="class.attribute">
796
        <xsl:with-param name="class" select="@role"/>
797
      </xsl:apply-templates>
798
    </xsl:if>
799
    <xsl:call-template name="dir"/>
800
    <xsl:call-template name="anchor"/>
801
    <xsl:call-template name="simple.xlink">
802
      <xsl:with-param name="content">
803
        <xsl:apply-templates/>
804
      </xsl:with-param>
805
    </xsl:call-template>
806
    <xsl:call-template name="apply-annotations"/>
807
  </span>
808
</xsl:template>
809

    
810
<xsl:template match="quote">
811
  <xsl:variable name="depth">
812
    <xsl:call-template name="dot.count">
813
      <xsl:with-param name="string">
814
        <xsl:number level="multiple"/>
815
      </xsl:with-param>
816
    </xsl:call-template>
817
  </xsl:variable>
818
  <span>
819
    <xsl:apply-templates select="." mode="common.html.attributes"/>
820
    <xsl:call-template name="anchor"/>
821
    <xsl:choose>
822
      <xsl:when test="$depth mod 2 = 0">
823
        <xsl:call-template name="gentext.startquote"/>
824
        <xsl:call-template name="inline.charseq"/>
825
        <xsl:call-template name="gentext.endquote"/>
826
      </xsl:when>
827
      <xsl:otherwise>
828
        <xsl:call-template name="gentext.nestedstartquote"/>
829
        <xsl:call-template name="inline.charseq"/>
830
        <xsl:call-template name="gentext.nestedendquote"/>
831
      </xsl:otherwise>
832
    </xsl:choose>
833
  </span>
834
</xsl:template>
835

    
836
<xsl:template match="varname">
837
  <xsl:call-template name="inline.monoseq"/>
838
</xsl:template>
839

    
840
<xsl:template match="wordasword">
841
  <xsl:call-template name="inline.italicseq"/>
842
</xsl:template>
843

    
844
<xsl:template match="lineannotation">
845
  <em>
846
    <xsl:apply-templates select="." mode="common.html.attributes"/>
847
    <xsl:call-template name="inline.charseq"/>
848
  </em>
849
</xsl:template>
850

    
851
<xsl:template match="superscript">
852
  <xsl:call-template name="inline.superscriptseq"/>
853
</xsl:template>
854

    
855
<xsl:template match="subscript">
856
  <xsl:call-template name="inline.subscriptseq"/>
857
</xsl:template>
858

    
859
<xsl:template match="trademark">
860
  <xsl:call-template name="inline.charseq"/>
861
  <xsl:choose>
862
    <xsl:when test="@class = 'copyright'
863
                    or @class = 'registered'">
864
      <xsl:call-template name="dingbat">
865
        <xsl:with-param name="dingbat" select="@class"/>
866
      </xsl:call-template>
867
    </xsl:when>
868
    <xsl:when test="@class = 'service'">
869
      <sup>SM</sup>
870
    </xsl:when>
871
    <xsl:otherwise>
872
      <xsl:call-template name="dingbat">
873
        <xsl:with-param name="dingbat" select="'trademark'"/>
874
      </xsl:call-template>
875
    </xsl:otherwise>
876
  </xsl:choose>
877
</xsl:template>
878

    
879
<xsl:template match="firstterm">
880
  <xsl:call-template name="glossterm">
881
    <xsl:with-param name="firstterm" select="1"/>
882
  </xsl:call-template>
883
</xsl:template>
884

    
885
<xsl:template match="glossterm" name="glossterm">
886
  <xsl:param name="firstterm" select="0"/>
887

    
888
  <!-- To avoid extra <a name=""> anchor from inline.italicseq -->
889
  <xsl:variable name="content">
890
    <xsl:apply-templates/>
891
  </xsl:variable>
892

    
893
  <xsl:choose>
894
    <xsl:when test="($firstterm.only.link = 0 or $firstterm = 1) and @linkend">
895
      <xsl:variable name="targets" select="key('id',@linkend)"/>
896
      <xsl:variable name="target" select="$targets[1]"/>
897

    
898
      <xsl:call-template name="check.id.unique">
899
        <xsl:with-param name="linkend" select="@linkend"/>
900
      </xsl:call-template>
901

    
902
      <xsl:choose>
903
        <xsl:when test="$target">
904
          <a>
905
            <xsl:apply-templates select="." mode="common.html.attributes"/>
906
            <xsl:if test="@id or @xml:id">
907
              <xsl:attribute name="name">
908
                <xsl:value-of select="(@id|@xml:id)[1]"/>
909
              </xsl:attribute>
910
            </xsl:if>
911

    
912
            <xsl:attribute name="href">
913
              <xsl:call-template name="href.target">
914
                <xsl:with-param name="object" select="$target"/>
915
              </xsl:call-template>
916
            </xsl:attribute>
917

    
918
            <xsl:call-template name="inline.italicseq">
919
              <xsl:with-param name="content" select="$content"/>
920
            </xsl:call-template>
921
          </a>
922
        </xsl:when>
923
        <xsl:otherwise>
924
          <xsl:call-template name="inline.italicseq">
925
            <xsl:with-param name="content" select="$content"/>
926
          </xsl:call-template>
927
        </xsl:otherwise>
928
      </xsl:choose>
929
    </xsl:when>
930

    
931
    <xsl:when test="not(@linkend)
932
                    and ($firstterm.only.link = 0 or $firstterm = 1)
933
                    and ($glossterm.auto.link != 0)
934
                    and $glossary.collection != ''">
935
      <xsl:variable name="term">
936
        <xsl:choose>
937
          <xsl:when test="@baseform"><xsl:value-of select="@baseform"/></xsl:when>
938
          <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
939
        </xsl:choose>
940
      </xsl:variable>
941

    
942
      <xsl:variable name="cterm"
943
           select="(document($glossary.collection,.)//glossentry[glossterm=$term])[1]"/>
944

    
945
      <!-- HACK HACK HACK! But it works... -->
946
      <!-- You'd need to do more work if you wanted to chunk on glossdiv, though -->
947

    
948
      <xsl:variable name="glossary" select="//glossary[@role='auto']"/>
949

    
950
      <xsl:if test="count($glossary) != 1">
951
        <xsl:message>
952
          <xsl:text>Warning: glossary.collection specified, but there are </xsl:text>
953
          <xsl:value-of select="count($glossary)"/>
954
          <xsl:text> automatic glossaries</xsl:text>
955
        </xsl:message>
956
      </xsl:if>
957

    
958
      <xsl:variable name="glosschunk">
959
        <xsl:call-template name="href.target">
960
          <xsl:with-param name="object" select="$glossary"/>
961
        </xsl:call-template>
962
      </xsl:variable>
963

    
964
      <xsl:variable name="chunkbase">
965
        <xsl:choose>
966
          <xsl:when test="contains($glosschunk, '#')">
967
            <xsl:value-of select="substring-before($glosschunk, '#')"/>
968
          </xsl:when>
969
          <xsl:otherwise>
970
            <xsl:value-of select="$glosschunk"/>
971
          </xsl:otherwise>
972
        </xsl:choose>
973
      </xsl:variable>
974

    
975
      <xsl:choose>
976
        <xsl:when test="not($cterm)">
977
          <xsl:message>
978
            <xsl:text>There's no entry for </xsl:text>
979
            <xsl:value-of select="$term"/>
980
            <xsl:text> in </xsl:text>
981
            <xsl:value-of select="$glossary.collection"/>
982
          </xsl:message>
983
          <xsl:call-template name="inline.italicseq"/>
984
        </xsl:when>
985
        <xsl:otherwise>
986
          <xsl:variable name="id">
987
            <xsl:call-template name="object.id">
988
              <xsl:with-param name="object" select="$cterm"/>
989
            </xsl:call-template>
990
          </xsl:variable>
991
          <a href="{$chunkbase}#{$id}">
992
            <xsl:apply-templates select="." mode="common.html.attributes"/>
993
            <xsl:call-template name="inline.italicseq">
994
              <xsl:with-param name="content" select="$content"/>
995
            </xsl:call-template>
996
          </a>
997
        </xsl:otherwise>
998
      </xsl:choose>
999
    </xsl:when>
1000

    
1001
    <xsl:when test="not(@linkend)
1002
                    and ($firstterm.only.link = 0 or $firstterm = 1)
1003
                    and $glossterm.auto.link != 0">
1004
      <xsl:variable name="term">
1005
        <xsl:choose>
1006
          <xsl:when test="@baseform">
1007
            <xsl:value-of select="normalize-space(@baseform)"/>
1008
          </xsl:when>
1009
          <xsl:otherwise>
1010
            <xsl:value-of select="normalize-space(.)"/>
1011
          </xsl:otherwise>
1012
        </xsl:choose>
1013
      </xsl:variable>
1014
      <xsl:variable name="targets"
1015
                    select="//glossentry[normalize-space(glossterm)=$term
1016
                              or normalize-space(glossterm/@baseform)=$term]"/>
1017
      <xsl:variable name="target" select="$targets[1]"/>
1018

    
1019
      <xsl:choose>
1020
        <xsl:when test="count($targets)=0">
1021
          <xsl:message>
1022
            <xsl:text>Error: no glossentry for glossterm: </xsl:text>
1023
            <xsl:value-of select="."/>
1024
            <xsl:text>.</xsl:text>
1025
          </xsl:message>
1026
          <xsl:call-template name="inline.italicseq"/>
1027
        </xsl:when>
1028
        <xsl:otherwise>
1029
          <a>
1030
            <xsl:apply-templates select="." mode="common.html.attributes"/>
1031
            <xsl:if test="@id or @xml:id">
1032
              <xsl:attribute name="name">
1033
                <xsl:value-of select="(@id|@xml:id)[1]"/>
1034
              </xsl:attribute>
1035
            </xsl:if>
1036

    
1037
            <xsl:attribute name="href">
1038
              <xsl:call-template name="href.target">
1039
                <xsl:with-param name="object" select="$target"/>
1040
              </xsl:call-template>
1041
            </xsl:attribute>
1042

    
1043
            <xsl:call-template name="inline.italicseq">
1044
              <xsl:with-param name="content" select="$content"/>
1045
            </xsl:call-template>
1046
          </a>
1047
        </xsl:otherwise>
1048
      </xsl:choose>
1049
    </xsl:when>
1050

    
1051
    <xsl:otherwise>
1052
      <xsl:call-template name="inline.italicseq"/>
1053
    </xsl:otherwise>
1054
  </xsl:choose>
1055
</xsl:template>
1056

    
1057
<xsl:template match="termdef">
1058
  <span>
1059
    <xsl:apply-templates select="." mode="common.html.attributes"/>
1060
    <xsl:call-template name="gentext.template">
1061
      <xsl:with-param name="context" select="'termdef'"/>
1062
      <xsl:with-param name="name" select="'prefix'"/>
1063
    </xsl:call-template>
1064
    <xsl:apply-templates/>
1065
    <xsl:call-template name="gentext.template">
1066
      <xsl:with-param name="context" select="'termdef'"/>
1067
      <xsl:with-param name="name" select="'suffix'"/>
1068
    </xsl:call-template>
1069
  </span>
1070
</xsl:template>
1071

    
1072
<xsl:template match="sgmltag|tag">
1073
  <xsl:call-template name="format.sgmltag"/>
1074
</xsl:template>
1075

    
1076
<xsl:template name="format.sgmltag">
1077
  <xsl:param name="class">
1078
    <xsl:choose>
1079
      <xsl:when test="@class">
1080
        <xsl:value-of select="@class"/>
1081
      </xsl:when>
1082
      <xsl:otherwise>element</xsl:otherwise>
1083
    </xsl:choose>
1084
  </xsl:param>
1085

    
1086
  <xsl:variable name="content">
1087
    <xsl:choose>
1088
      <xsl:when test="$class='attribute'">
1089
        <xsl:apply-templates/>
1090
      </xsl:when>
1091
      <xsl:when test="$class='attvalue'">
1092
        <xsl:apply-templates/>
1093
      </xsl:when>
1094
      <xsl:when test="$class='element'">
1095
        <xsl:apply-templates/>
1096
      </xsl:when>
1097
      <xsl:when test="$class='endtag'">
1098
        <xsl:text>&lt;/</xsl:text>
1099
        <xsl:apply-templates/>
1100
        <xsl:text>&gt;</xsl:text>
1101
      </xsl:when>
1102
      <xsl:when test="$class='genentity'">
1103
        <xsl:text>&amp;</xsl:text>
1104
        <xsl:apply-templates/>
1105
        <xsl:text>;</xsl:text>
1106
      </xsl:when>
1107
      <xsl:when test="$class='numcharref'">
1108
        <xsl:text>&amp;#</xsl:text>
1109
        <xsl:apply-templates/>
1110
        <xsl:text>;</xsl:text>
1111
      </xsl:when>
1112
      <xsl:when test="$class='paramentity'">
1113
        <xsl:text>%</xsl:text>
1114
        <xsl:apply-templates/>
1115
        <xsl:text>;</xsl:text>
1116
      </xsl:when>
1117
      <xsl:when test="$class='pi'">
1118
        <xsl:text>&lt;?</xsl:text>
1119
        <xsl:apply-templates/>
1120
        <xsl:text>&gt;</xsl:text>
1121
      </xsl:when>
1122
      <xsl:when test="$class='xmlpi'">
1123
        <xsl:text>&lt;?</xsl:text>
1124
        <xsl:apply-templates/>
1125
        <xsl:text>?&gt;</xsl:text>
1126
      </xsl:when>
1127
      <xsl:when test="$class='starttag'">
1128
        <xsl:text>&lt;</xsl:text>
1129
        <xsl:apply-templates/>
1130
        <xsl:text>&gt;</xsl:text>
1131
      </xsl:when>
1132
      <xsl:when test="$class='emptytag'">
1133
        <xsl:text>&lt;</xsl:text>
1134
        <xsl:apply-templates/>
1135
        <xsl:text>/&gt;</xsl:text>
1136
      </xsl:when>
1137
      <xsl:when test="$class='sgmlcomment' or $class='comment'">
1138
        <xsl:text>&lt;!--</xsl:text>
1139
        <xsl:apply-templates/>
1140
        <xsl:text>--&gt;</xsl:text>
1141
      </xsl:when>
1142
      <xsl:otherwise>
1143
        <xsl:apply-templates/>
1144
      </xsl:otherwise>
1145
    </xsl:choose>
1146
  </xsl:variable>
1147

    
1148
  <code>
1149
    <xsl:apply-templates select="." mode="common.html.attributes">
1150
      <xsl:with-param name="class" select="concat('sgmltag-', $class)"/>
1151
    </xsl:apply-templates>
1152
    <xsl:call-template name="simple.xlink">
1153
      <xsl:with-param name="content" select="$content"/>
1154
    </xsl:call-template>
1155
  </code>
1156
</xsl:template>
1157

    
1158
<xsl:template match="email">
1159
  <xsl:call-template name="inline.monoseq">
1160
    <xsl:with-param name="content">
1161
      <xsl:if test="not($email.delimiters.enabled = 0)">
1162
        <xsl:text>&lt;</xsl:text>
1163
      </xsl:if>
1164
      <a>
1165
        <xsl:apply-templates select="." mode="common.html.attributes"/>
1166
        <xsl:attribute name="href">
1167
          <xsl:text>mailto:</xsl:text>
1168
          <xsl:value-of select="."/>
1169
        </xsl:attribute>
1170
        <xsl:apply-templates/>
1171
      </a>
1172
      <xsl:if test="not($email.delimiters.enabled = 0)">
1173
        <xsl:text>&gt;</xsl:text>
1174
      </xsl:if>
1175
    </xsl:with-param>
1176
  </xsl:call-template>
1177
</xsl:template>
1178

    
1179
<xsl:template match="keycombo">
1180
  <xsl:variable name="action" select="@action"/>
1181
  <xsl:variable name="joinchar">
1182
    <xsl:choose>
1183
      <xsl:when test="$action='seq'"><xsl:text> </xsl:text></xsl:when>
1184
      <xsl:when test="$action='simul'">+</xsl:when>
1185
      <xsl:when test="$action='press'">-</xsl:when>
1186
      <xsl:when test="$action='click'">-</xsl:when>
1187
      <xsl:when test="$action='double-click'">-</xsl:when>
1188
      <xsl:when test="$action='other'"></xsl:when>
1189
      <xsl:otherwise>+</xsl:otherwise>
1190
    </xsl:choose>
1191
  </xsl:variable>
1192
  <xsl:for-each select="*">
1193
    <xsl:if test="position()>1"><xsl:value-of select="$joinchar"/></xsl:if>
1194
    <xsl:apply-templates select="."/>
1195
  </xsl:for-each>
1196
</xsl:template>
1197

    
1198
<xsl:template match="uri">
1199
  <xsl:call-template name="inline.monoseq"/>
1200
</xsl:template>
1201

    
1202
<!-- ==================================================================== -->
1203

    
1204
<xsl:template match="menuchoice">
1205
  <xsl:variable name="shortcut" select="./shortcut"/>
1206
  <xsl:call-template name="process.menuchoice"/>
1207
  <xsl:if test="$shortcut">
1208
    <xsl:text> (</xsl:text>
1209
    <xsl:apply-templates select="$shortcut"/>
1210
    <xsl:text>)</xsl:text>
1211
  </xsl:if>
1212
</xsl:template>
1213

    
1214
<xsl:template name="process.menuchoice">
1215
  <xsl:param name="nodelist" select="guibutton|guiicon|guilabel|guimenu|guimenuitem|guisubmenu|interface"/><!-- not(shortcut) -->
1216
  <xsl:param name="count" select="1"/>
1217

    
1218
  <xsl:choose>
1219
    <xsl:when test="$count>count($nodelist)"></xsl:when>
1220
    <xsl:when test="$count=1">
1221
      <xsl:apply-templates select="$nodelist[$count=position()]"/>
1222
      <xsl:call-template name="process.menuchoice">
1223
        <xsl:with-param name="nodelist" select="$nodelist"/>
1224
        <xsl:with-param name="count" select="$count+1"/>
1225
      </xsl:call-template>
1226
    </xsl:when>
1227
    <xsl:otherwise>
1228
      <xsl:variable name="node" select="$nodelist[$count=position()]"/>
1229
      <xsl:choose>
1230
        <xsl:when test="local-name($node)='guimenuitem'
1231
                        or local-name($node)='guisubmenu'">
1232
          <xsl:value-of select="$menuchoice.menu.separator"/>
1233
        </xsl:when>
1234
        <xsl:otherwise>
1235
          <xsl:value-of select="$menuchoice.separator"/>
1236
        </xsl:otherwise>
1237
      </xsl:choose>
1238
      <xsl:apply-templates select="$node"/>
1239
      <xsl:call-template name="process.menuchoice">
1240
        <xsl:with-param name="nodelist" select="$nodelist"/>
1241
        <xsl:with-param name="count" select="$count+1"/>
1242
      </xsl:call-template>
1243
    </xsl:otherwise>
1244
  </xsl:choose>
1245
</xsl:template>
1246

    
1247
<!-- ==================================================================== -->
1248

    
1249
<xsl:template match="optional">
1250
  <xsl:value-of select="$arg.choice.opt.open.str"/>
1251
  <xsl:call-template name="inline.charseq"/>
1252
  <xsl:value-of select="$arg.choice.opt.close.str"/>
1253
</xsl:template>
1254

    
1255
<xsl:template match="citation">
1256
  <!-- todo: integrate with bibliography collection -->
1257
  <xsl:variable name="targets" select="(//biblioentry | //bibliomixed)[abbrev = string(current())]"/>
1258
  <xsl:variable name="target" select="$targets[1]"/>
1259

    
1260
  <xsl:choose>
1261
    <!-- try automatic linking based on match to abbrev -->
1262
    <xsl:when test="$target and not(xref) and not(link)">
1263

    
1264
      <xsl:text>[</xsl:text>
1265
      <a>
1266
        <xsl:apply-templates select="." mode="common.html.attributes"/>
1267
        <xsl:attribute name="href">
1268
          <xsl:call-template name="href.target">
1269
            <xsl:with-param name="object" select="$target"/>
1270
          </xsl:call-template>
1271
        </xsl:attribute>
1272

    
1273
        <xsl:choose>
1274
          <xsl:when test="$bibliography.numbered != 0">
1275
            <xsl:apply-templates select="$target" mode="citation"/>
1276
          </xsl:when>
1277
          <xsl:otherwise>
1278
            <xsl:call-template name="inline.charseq"/>
1279
          </xsl:otherwise>
1280
        </xsl:choose>
1281

    
1282
      </a>
1283
      <xsl:text>]</xsl:text>
1284
    </xsl:when>
1285
    <xsl:otherwise>
1286
      <xsl:text>[</xsl:text>
1287
      <xsl:call-template name="inline.charseq"/>
1288
      <xsl:text>]</xsl:text>
1289
    </xsl:otherwise>
1290
  </xsl:choose>
1291
</xsl:template>
1292

    
1293
<xsl:template match="citebiblioid">
1294
  <xsl:variable name="targets" select="//*[biblioid = string(current())]"/>
1295
  <xsl:variable name="target" select="$targets[1]"/>
1296

    
1297
  <xsl:choose>
1298
    <!-- try automatic linking based on match to parent of biblioid -->
1299
    <xsl:when test="$target and not(xref) and not(link)">
1300

    
1301
      <xsl:text>[</xsl:text>
1302
      <a>
1303
        <xsl:apply-templates select="." mode="common.html.attributes"/>
1304
        <xsl:attribute name="href">
1305
          <xsl:call-template name="href.target">
1306
            <xsl:with-param name="object" select="$target"/>
1307
          </xsl:call-template>
1308
        </xsl:attribute>
1309

    
1310
        <xsl:call-template name="inline.charseq"/>
1311

    
1312
      </a>
1313
      <xsl:text>]</xsl:text>
1314
    </xsl:when>
1315
    <xsl:otherwise>
1316
      <xsl:text>[</xsl:text>
1317
      <xsl:call-template name="inline.charseq"/>
1318
      <xsl:text>]</xsl:text>
1319
    </xsl:otherwise>
1320
  </xsl:choose>
1321
</xsl:template>
1322

    
1323
<xsl:template match="biblioentry|bibliomixed" mode="citation">
1324
  <xsl:number from="bibliography" count="biblioentry|bibliomixed"
1325
              level="any" format="1"/>
1326
</xsl:template>
1327

    
1328
<!-- ==================================================================== -->
1329

    
1330
<xsl:template match="comment[&comment.block.parents;]|remark[&comment.block.parents;]">
1331
  <xsl:if test="$show.comments != 0">
1332
    <p class="remark"><i><xsl:call-template name="inline.charseq"/></i></p>
1333
  </xsl:if>
1334
</xsl:template>
1335

    
1336
<xsl:template match="comment|remark">
1337
  <xsl:if test="$show.comments != 0">
1338
    <em><xsl:call-template name="inline.charseq"/></em>
1339
  </xsl:if>
1340
</xsl:template>
1341

    
1342
<!-- ==================================================================== -->
1343

    
1344
<xsl:template match="productname">
1345
  <xsl:call-template name="inline.charseq"/>
1346
  <xsl:if test="@class">
1347
    <xsl:call-template name="dingbat">
1348
      <xsl:with-param name="dingbat" select="@class"/>
1349
    </xsl:call-template>
1350
  </xsl:if>
1351
</xsl:template>
1352

    
1353
<xsl:template match="productnumber">
1354
  <xsl:call-template name="inline.charseq"/>
1355
</xsl:template>
1356

    
1357
<!-- ==================================================================== -->
1358

    
1359
<xsl:template match="pob|street|city|state|postcode|country|otheraddr">
1360
  <xsl:call-template name="inline.charseq"/>
1361
</xsl:template>
1362

    
1363
<xsl:template match="phone|fax">
1364
  <xsl:call-template name="inline.charseq"/>
1365
</xsl:template>
1366

    
1367
<!-- in Addresses, for example -->
1368
<xsl:template match="honorific|firstname|surname|lineage|othername">
1369
  <xsl:call-template name="inline.charseq"/>
1370
</xsl:template>
1371

    
1372
<!-- ==================================================================== -->
1373

    
1374
<xsl:template match="person">
1375
  <xsl:param name="content">
1376
    <xsl:call-template name="anchor"/>
1377
    <xsl:call-template name="simple.xlink">
1378
      <xsl:with-param name="content">
1379
        <xsl:apply-templates select="personname"/>
1380
      </xsl:with-param>
1381
    </xsl:call-template>
1382
    <xsl:call-template name="apply-annotations"/>
1383
  </xsl:param>
1384

    
1385
  <span>
1386
    <xsl:apply-templates select="." mode="common.html.attributes"/>
1387
    <xsl:copy-of select="$content"/>
1388
  </span>
1389
</xsl:template>
1390

    
1391
<xsl:template match="personname">
1392
  <xsl:param name="content">
1393
    <xsl:call-template name="anchor"/>
1394
    <xsl:call-template name="simple.xlink">
1395
      <xsl:with-param name="content">
1396
        <xsl:call-template name="person.name"/>
1397
      </xsl:with-param>
1398
    </xsl:call-template>
1399
    <xsl:call-template name="apply-annotations"/>
1400
  </xsl:param>
1401

    
1402
  <span>
1403
    <xsl:apply-templates select="." mode="common.html.attributes"/>
1404
    <xsl:copy-of select="$content"/>
1405
  </span>
1406
</xsl:template>
1407

    
1408
<!-- ==================================================================== -->
1409

    
1410
<xsl:template match="org">
1411
  <xsl:param name="content">
1412
    <xsl:call-template name="anchor"/>
1413
    <xsl:call-template name="simple.xlink">
1414
      <xsl:with-param name="content">
1415
        <xsl:apply-templates/>
1416
      </xsl:with-param>
1417
    </xsl:call-template>
1418
    <xsl:call-template name="apply-annotations"/>
1419
  </xsl:param>
1420

    
1421
  <span>
1422
    <xsl:apply-templates select="." mode="common.html.attributes"/>
1423
    <xsl:copy-of select="$content"/>
1424
  </span>
1425
</xsl:template>
1426

    
1427
<xsl:template match="orgname">
1428
  <xsl:param name="content">
1429
    <xsl:call-template name="anchor"/>
1430
    <xsl:call-template name="simple.xlink">
1431
      <xsl:with-param name="content">
1432
        <xsl:apply-templates/>
1433
      </xsl:with-param>
1434
    </xsl:call-template>
1435
    <xsl:call-template name="apply-annotations"/>
1436
  </xsl:param>
1437

    
1438
  <span>
1439
    <xsl:apply-templates select="." mode="common.html.attributes"/>
1440
    <xsl:copy-of select="$content"/>
1441
  </span>
1442
</xsl:template>
1443

    
1444
<xsl:template match="orgdiv">
1445
  <xsl:param name="content">
1446
    <xsl:call-template name="anchor"/>
1447
    <xsl:call-template name="simple.xlink">
1448
      <xsl:with-param name="content">
1449
        <xsl:apply-templates/>
1450
      </xsl:with-param>
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:copy-of select="$content"/>
1458
  </span>
1459
</xsl:template>
1460

    
1461
<xsl:template match="affiliation">
1462
  <xsl:param name="content">
1463
    <xsl:call-template name="anchor"/>
1464
    <xsl:call-template name="simple.xlink">
1465
      <xsl:with-param name="content">
1466
        <xsl:call-template name="person.name"/>
1467
      </xsl:with-param>
1468
    </xsl:call-template>
1469
    <xsl:call-template name="apply-annotations"/>
1470
  </xsl:param>
1471

    
1472
  <span>
1473
    <xsl:apply-templates select="." mode="common.html.attributes"/>
1474
    <xsl:copy-of select="$content"/>
1475
  </span>
1476
</xsl:template>
1477

    
1478
<!-- ==================================================================== -->
1479

    
1480
<xsl:template match="beginpage">
1481
  <!-- does nothing; this *is not* markup to force a page break. -->
1482
</xsl:template>
1483

    
1484
</xsl:stylesheet>
1485

    
(23-23/39)