1
|
<?xml version='1.0'?>
|
2
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
3
|
xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks"
|
4
|
xmlns:exsl="http://exslt.org/common"
|
5
|
xmlns:xlink='http://www.w3.org/1999/xlink'
|
6
|
exclude-result-prefixes="suwl exsl xlink"
|
7
|
version='1.0'>
|
8
|
|
9
|
<!-- ********************************************************************
|
10
|
$Id: xref.xsl 8421 2009-05-04 07:49:49Z bobstayton $
|
11
|
********************************************************************
|
12
|
|
13
|
This file is part of the XSL DocBook Stylesheet distribution.
|
14
|
See ../README or http://docbook.sf.net/release/xsl/current/ for
|
15
|
copyright and other information.
|
16
|
|
17
|
******************************************************************** -->
|
18
|
|
19
|
<!-- Use internal variable for olink xlink role for consistency -->
|
20
|
<xsl:variable
|
21
|
name="xolink.role">http://docbook.org/xlink/role/olink</xsl:variable>
|
22
|
|
23
|
<!-- ==================================================================== -->
|
24
|
|
25
|
<xsl:template match="anchor">
|
26
|
<xsl:call-template name="anchor"/>
|
27
|
</xsl:template>
|
28
|
|
29
|
<!-- ==================================================================== -->
|
30
|
|
31
|
<xsl:template match="xref" name="xref">
|
32
|
<xsl:param name="xhref" select="@xlink:href"/>
|
33
|
<!-- is the @xlink:href a local idref link? -->
|
34
|
<xsl:param name="xlink.idref">
|
35
|
<xsl:if test="starts-with($xhref,'#')
|
36
|
and (not(contains($xhref,'('))
|
37
|
or starts-with($xhref, '#xpointer(id('))">
|
38
|
<xsl:call-template name="xpointer.idref">
|
39
|
<xsl:with-param name="xpointer" select="$xhref"/>
|
40
|
</xsl:call-template>
|
41
|
</xsl:if>
|
42
|
</xsl:param>
|
43
|
<xsl:param name="xlink.targets" select="key('id',$xlink.idref)"/>
|
44
|
<xsl:param name="linkend.targets" select="key('id',@linkend)"/>
|
45
|
<xsl:param name="target" select="($xlink.targets | $linkend.targets)[1]"/>
|
46
|
|
47
|
<xsl:variable name="xrefstyle">
|
48
|
<xsl:choose>
|
49
|
<xsl:when test="@role and not(@xrefstyle)
|
50
|
and $use.role.as.xrefstyle != 0">
|
51
|
<xsl:value-of select="@role"/>
|
52
|
</xsl:when>
|
53
|
<xsl:otherwise>
|
54
|
<xsl:value-of select="@xrefstyle"/>
|
55
|
</xsl:otherwise>
|
56
|
</xsl:choose>
|
57
|
</xsl:variable>
|
58
|
|
59
|
<xsl:call-template name="anchor"/>
|
60
|
|
61
|
<xsl:variable name="content">
|
62
|
<xsl:choose>
|
63
|
|
64
|
<xsl:when test="@endterm">
|
65
|
<xsl:variable name="etargets" select="key('id',@endterm)"/>
|
66
|
<xsl:variable name="etarget" select="$etargets[1]"/>
|
67
|
<xsl:choose>
|
68
|
<xsl:when test="count($etarget) = 0">
|
69
|
<xsl:message>
|
70
|
<xsl:value-of select="count($etargets)"/>
|
71
|
<xsl:text>Endterm points to nonexistent ID: </xsl:text>
|
72
|
<xsl:value-of select="@endterm"/>
|
73
|
</xsl:message>
|
74
|
<xsl:text>???</xsl:text>
|
75
|
</xsl:when>
|
76
|
<xsl:otherwise>
|
77
|
<xsl:apply-templates select="$etarget" mode="endterm"/>
|
78
|
</xsl:otherwise>
|
79
|
</xsl:choose>
|
80
|
</xsl:when>
|
81
|
|
82
|
<xsl:when test="$target/@xreflabel">
|
83
|
<xsl:call-template name="xref.xreflabel">
|
84
|
<xsl:with-param name="target" select="$target"/>
|
85
|
</xsl:call-template>
|
86
|
</xsl:when>
|
87
|
|
88
|
<xsl:when test="$target">
|
89
|
<xsl:if test="not(parent::citation)">
|
90
|
<xsl:apply-templates select="$target" mode="xref-to-prefix"/>
|
91
|
</xsl:if>
|
92
|
|
93
|
<xsl:apply-templates select="$target" mode="xref-to">
|
94
|
<xsl:with-param name="referrer" select="."/>
|
95
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
96
|
</xsl:apply-templates>
|
97
|
|
98
|
<xsl:if test="not(parent::citation)">
|
99
|
<xsl:apply-templates select="$target" mode="xref-to-suffix"/>
|
100
|
</xsl:if>
|
101
|
</xsl:when>
|
102
|
|
103
|
<xsl:otherwise>
|
104
|
<xsl:message>
|
105
|
<xsl:text>ERROR: xref linking to </xsl:text>
|
106
|
<xsl:value-of select="@linkend|@xlink:href"/>
|
107
|
<xsl:text> has no generated link text.</xsl:text>
|
108
|
</xsl:message>
|
109
|
<xsl:text>???</xsl:text>
|
110
|
</xsl:otherwise>
|
111
|
</xsl:choose>
|
112
|
</xsl:variable>
|
113
|
|
114
|
<xsl:call-template name="simple.xlink">
|
115
|
<xsl:with-param name="content" select="$content"/>
|
116
|
</xsl:call-template>
|
117
|
|
118
|
</xsl:template>
|
119
|
|
120
|
<!-- ==================================================================== -->
|
121
|
|
122
|
<!-- biblioref handled largely like an xref -->
|
123
|
<!-- To be done: add support for begin, end, and units attributes -->
|
124
|
<xsl:template match="biblioref">
|
125
|
<xsl:variable name="targets" select="key('id',@linkend)"/>
|
126
|
<xsl:variable name="target" select="$targets[1]"/>
|
127
|
<xsl:variable name="refelem" select="local-name($target)"/>
|
128
|
|
129
|
<xsl:call-template name="check.id.unique">
|
130
|
<xsl:with-param name="linkend" select="@linkend"/>
|
131
|
</xsl:call-template>
|
132
|
|
133
|
<xsl:call-template name="anchor"/>
|
134
|
|
135
|
<xsl:choose>
|
136
|
<xsl:when test="count($target) = 0">
|
137
|
<xsl:message>
|
138
|
<xsl:text>XRef to nonexistent id: </xsl:text>
|
139
|
<xsl:value-of select="@linkend"/>
|
140
|
</xsl:message>
|
141
|
<xsl:text>???</xsl:text>
|
142
|
</xsl:when>
|
143
|
|
144
|
<xsl:when test="@endterm">
|
145
|
<xsl:variable name="href">
|
146
|
<xsl:call-template name="href.target">
|
147
|
<xsl:with-param name="object" select="$target"/>
|
148
|
</xsl:call-template>
|
149
|
</xsl:variable>
|
150
|
|
151
|
<xsl:variable name="etargets" select="key('id',@endterm)"/>
|
152
|
<xsl:variable name="etarget" select="$etargets[1]"/>
|
153
|
<xsl:choose>
|
154
|
<xsl:when test="count($etarget) = 0">
|
155
|
<xsl:message>
|
156
|
<xsl:value-of select="count($etargets)"/>
|
157
|
<xsl:text>Endterm points to nonexistent ID: </xsl:text>
|
158
|
<xsl:value-of select="@endterm"/>
|
159
|
</xsl:message>
|
160
|
<a href="{$href}">
|
161
|
<xsl:apply-templates select="." mode="common.html.attributes"/>
|
162
|
<xsl:text>???</xsl:text>
|
163
|
</a>
|
164
|
</xsl:when>
|
165
|
<xsl:otherwise>
|
166
|
<a href="{$href}">
|
167
|
<xsl:apply-templates select="." mode="common.html.attributes"/>
|
168
|
<xsl:apply-templates select="$etarget" mode="endterm"/>
|
169
|
</a>
|
170
|
</xsl:otherwise>
|
171
|
</xsl:choose>
|
172
|
</xsl:when>
|
173
|
|
174
|
<xsl:when test="$target/@xreflabel">
|
175
|
<a>
|
176
|
<xsl:apply-templates select="." mode="common.html.attributes"/>
|
177
|
<xsl:attribute name="href">
|
178
|
<xsl:call-template name="href.target">
|
179
|
<xsl:with-param name="object" select="$target"/>
|
180
|
</xsl:call-template>
|
181
|
</xsl:attribute>
|
182
|
<xsl:call-template name="xref.xreflabel">
|
183
|
<xsl:with-param name="target" select="$target"/>
|
184
|
</xsl:call-template>
|
185
|
</a>
|
186
|
</xsl:when>
|
187
|
|
188
|
<xsl:otherwise>
|
189
|
<xsl:variable name="href">
|
190
|
<xsl:call-template name="href.target">
|
191
|
<xsl:with-param name="object" select="$target"/>
|
192
|
</xsl:call-template>
|
193
|
</xsl:variable>
|
194
|
|
195
|
<xsl:if test="not(parent::citation)">
|
196
|
<xsl:apply-templates select="$target" mode="xref-to-prefix"/>
|
197
|
</xsl:if>
|
198
|
|
199
|
<a href="{$href}">
|
200
|
<xsl:apply-templates select="." mode="class.attribute"/>
|
201
|
<xsl:if test="$target/title or $target/*/title">
|
202
|
<xsl:attribute name="title">
|
203
|
<xsl:apply-templates select="$target" mode="xref-title"/>
|
204
|
</xsl:attribute>
|
205
|
</xsl:if>
|
206
|
<xsl:apply-templates select="$target" mode="xref-to">
|
207
|
<xsl:with-param name="referrer" select="."/>
|
208
|
<xsl:with-param name="xrefstyle">
|
209
|
<xsl:choose>
|
210
|
<xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
|
211
|
<xsl:value-of select="@role"/>
|
212
|
</xsl:when>
|
213
|
<xsl:otherwise>
|
214
|
<xsl:value-of select="@xrefstyle"/>
|
215
|
</xsl:otherwise>
|
216
|
</xsl:choose>
|
217
|
</xsl:with-param>
|
218
|
</xsl:apply-templates>
|
219
|
</a>
|
220
|
|
221
|
<xsl:if test="not(parent::citation)">
|
222
|
<xsl:apply-templates select="$target" mode="xref-to-suffix"/>
|
223
|
</xsl:if>
|
224
|
</xsl:otherwise>
|
225
|
</xsl:choose>
|
226
|
</xsl:template>
|
227
|
|
228
|
<!-- ==================================================================== -->
|
229
|
|
230
|
<xsl:template match="*" mode="endterm">
|
231
|
<!-- Process the children of the endterm element -->
|
232
|
<xsl:variable name="endterm">
|
233
|
<xsl:apply-templates select="child::node()"/>
|
234
|
</xsl:variable>
|
235
|
|
236
|
<xsl:choose>
|
237
|
<xsl:when test="$exsl.node.set.available != 0">
|
238
|
<xsl:apply-templates select="exsl:node-set($endterm)" mode="remove-ids"/>
|
239
|
</xsl:when>
|
240
|
<xsl:otherwise>
|
241
|
<xsl:copy-of select="$endterm"/>
|
242
|
</xsl:otherwise>
|
243
|
</xsl:choose>
|
244
|
</xsl:template>
|
245
|
|
246
|
<xsl:template match="*" mode="remove-ids">
|
247
|
<xsl:choose>
|
248
|
<!-- handle html or xhtml -->
|
249
|
<xsl:when test="local-name(.) = 'a'
|
250
|
and (namespace-uri(.) = ''
|
251
|
or namespace-uri(.) = 'http://www.w3.org/1999/xhtml')">
|
252
|
<xsl:choose>
|
253
|
<xsl:when test="(@name and count(@*) = 1)
|
254
|
or (@id and count(@*) = 1)
|
255
|
or (@xml:id and count(@*) = 1)
|
256
|
or (@xml:id and @name and count(@*) = 2)
|
257
|
or (@id and @name and count(@*) = 2)">
|
258
|
<xsl:message>suppress anchor</xsl:message>
|
259
|
<!-- suppress the whole thing -->
|
260
|
</xsl:when>
|
261
|
<xsl:otherwise>
|
262
|
<xsl:copy>
|
263
|
<xsl:for-each select="@*">
|
264
|
<xsl:choose>
|
265
|
<xsl:when test="local-name(.) != 'name' and local-name(.) != 'id'">
|
266
|
<xsl:copy/>
|
267
|
</xsl:when>
|
268
|
<xsl:otherwise>
|
269
|
<xsl:message>removing <xsl:value-of
|
270
|
select="local-name(.)"/></xsl:message>
|
271
|
</xsl:otherwise>
|
272
|
</xsl:choose>
|
273
|
</xsl:for-each>
|
274
|
</xsl:copy>
|
275
|
<xsl:apply-templates mode="remove-ids"/>
|
276
|
</xsl:otherwise>
|
277
|
</xsl:choose>
|
278
|
</xsl:when>
|
279
|
<xsl:otherwise>
|
280
|
<xsl:copy>
|
281
|
<xsl:for-each select="@*">
|
282
|
<xsl:choose>
|
283
|
<xsl:when test="local-name(.) != 'id'">
|
284
|
<xsl:copy/>
|
285
|
</xsl:when>
|
286
|
<xsl:otherwise>
|
287
|
<xsl:message>removing <xsl:value-of
|
288
|
select="local-name(.)"/></xsl:message>
|
289
|
</xsl:otherwise>
|
290
|
</xsl:choose>
|
291
|
</xsl:for-each>
|
292
|
<xsl:apply-templates mode="remove-ids"/>
|
293
|
</xsl:copy>
|
294
|
</xsl:otherwise>
|
295
|
</xsl:choose>
|
296
|
</xsl:template>
|
297
|
|
298
|
<!-- ==================================================================== -->
|
299
|
|
300
|
<xsl:template match="*" mode="xref-to-prefix"/>
|
301
|
<xsl:template match="*" mode="xref-to-suffix"/>
|
302
|
|
303
|
<xsl:template match="*" mode="xref-to">
|
304
|
<xsl:param name="referrer"/>
|
305
|
<xsl:param name="xrefstyle"/>
|
306
|
<xsl:param name="verbose" select="1"/>
|
307
|
|
308
|
<xsl:if test="$verbose">
|
309
|
<xsl:message>
|
310
|
<xsl:text>Don't know what gentext to create for xref to: "</xsl:text>
|
311
|
<xsl:value-of select="name(.)"/>
|
312
|
<xsl:text>", ("</xsl:text>
|
313
|
<xsl:value-of select="(@id|@xml:id)[1]"/>
|
314
|
<xsl:text>")</xsl:text>
|
315
|
</xsl:message>
|
316
|
</xsl:if>
|
317
|
<xsl:text>???</xsl:text>
|
318
|
</xsl:template>
|
319
|
|
320
|
<xsl:template match="title" mode="xref-to">
|
321
|
<xsl:param name="referrer"/>
|
322
|
<xsl:param name="xrefstyle"/>
|
323
|
<xsl:param name="verbose" select="1"/>
|
324
|
|
325
|
<!-- if you xref to a title, xref to the parent... -->
|
326
|
<xsl:choose>
|
327
|
<!-- FIXME: how reliable is this? -->
|
328
|
<xsl:when test="contains(local-name(parent::*), 'info')">
|
329
|
<xsl:apply-templates select="parent::*[2]" mode="xref-to">
|
330
|
<xsl:with-param name="referrer" select="$referrer"/>
|
331
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
332
|
<xsl:with-param name="verbose" select="$verbose"/>
|
333
|
</xsl:apply-templates>
|
334
|
</xsl:when>
|
335
|
<xsl:otherwise>
|
336
|
<xsl:apply-templates select="parent::*" mode="xref-to">
|
337
|
<xsl:with-param name="referrer" select="$referrer"/>
|
338
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
339
|
<xsl:with-param name="verbose" select="$verbose"/>
|
340
|
</xsl:apply-templates>
|
341
|
</xsl:otherwise>
|
342
|
</xsl:choose>
|
343
|
</xsl:template>
|
344
|
|
345
|
<xsl:template match="abstract|authorblurb|personblurb|bibliodiv|bibliomset
|
346
|
|biblioset|blockquote|calloutlist|caution|colophon
|
347
|
|constraintdef|formalpara|glossdiv|important|indexdiv
|
348
|
|itemizedlist|legalnotice|lot|msg|msgexplan|msgmain
|
349
|
|msgrel|msgset|msgsub|note|orderedlist|partintro
|
350
|
|productionset|qandadiv|refsynopsisdiv|segmentedlist
|
351
|
|set|setindex|sidebar|tip|toc|variablelist|warning"
|
352
|
mode="xref-to">
|
353
|
<xsl:param name="referrer"/>
|
354
|
<xsl:param name="xrefstyle"/>
|
355
|
<xsl:param name="verbose" select="1"/>
|
356
|
|
357
|
<!-- catch-all for things with (possibly optional) titles -->
|
358
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
359
|
<xsl:with-param name="purpose" select="'xref'"/>
|
360
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
361
|
<xsl:with-param name="referrer" select="$referrer"/>
|
362
|
<xsl:with-param name="verbose" select="$verbose"/>
|
363
|
</xsl:apply-templates>
|
364
|
</xsl:template>
|
365
|
|
366
|
<xsl:template match="author|editor|othercredit|personname" mode="xref-to">
|
367
|
<xsl:param name="referrer"/>
|
368
|
<xsl:param name="xrefstyle"/>
|
369
|
|
370
|
<xsl:call-template name="person.name"/>
|
371
|
</xsl:template>
|
372
|
|
373
|
<xsl:template match="authorgroup" mode="xref-to">
|
374
|
<xsl:param name="referrer"/>
|
375
|
<xsl:param name="xrefstyle"/>
|
376
|
|
377
|
<xsl:call-template name="person.name.list"/>
|
378
|
</xsl:template>
|
379
|
|
380
|
<xsl:template match="figure|example|table|equation" mode="xref-to">
|
381
|
<xsl:param name="referrer"/>
|
382
|
<xsl:param name="xrefstyle"/>
|
383
|
<xsl:param name="verbose" select="1"/>
|
384
|
|
385
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
386
|
<xsl:with-param name="purpose" select="'xref'"/>
|
387
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
388
|
<xsl:with-param name="referrer" select="$referrer"/>
|
389
|
<xsl:with-param name="verbose" select="$verbose"/>
|
390
|
</xsl:apply-templates>
|
391
|
</xsl:template>
|
392
|
|
393
|
<xsl:template match="procedure" mode="xref-to">
|
394
|
<xsl:param name="referrer"/>
|
395
|
<xsl:param name="xrefstyle"/>
|
396
|
<xsl:param name="verbose"/>
|
397
|
|
398
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
399
|
<xsl:with-param name="purpose" select="'xref'"/>
|
400
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
401
|
<xsl:with-param name="referrer" select="$referrer"/>
|
402
|
<xsl:with-param name="verbose" select="$verbose"/>
|
403
|
</xsl:apply-templates>
|
404
|
</xsl:template>
|
405
|
|
406
|
<xsl:template match="task" mode="xref-to">
|
407
|
<xsl:param name="referrer"/>
|
408
|
<xsl:param name="xrefstyle"/>
|
409
|
<xsl:param name="verbose"/>
|
410
|
|
411
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
412
|
<xsl:with-param name="purpose" select="'xref'"/>
|
413
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
414
|
<xsl:with-param name="referrer" select="$referrer"/>
|
415
|
<xsl:with-param name="verbose" select="$verbose"/>
|
416
|
</xsl:apply-templates>
|
417
|
</xsl:template>
|
418
|
|
419
|
<xsl:template match="cmdsynopsis" mode="xref-to">
|
420
|
<xsl:apply-templates select="(.//command)[1]" mode="xref"/>
|
421
|
</xsl:template>
|
422
|
|
423
|
<xsl:template match="funcsynopsis" mode="xref-to">
|
424
|
<xsl:apply-templates select="(.//function)[1]" mode="xref"/>
|
425
|
</xsl:template>
|
426
|
|
427
|
<xsl:template match="dedication|acknowledgements|preface|chapter|appendix|article" mode="xref-to">
|
428
|
<xsl:param name="referrer"/>
|
429
|
<xsl:param name="xrefstyle"/>
|
430
|
<xsl:param name="verbose" select="1"/>
|
431
|
|
432
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
433
|
<xsl:with-param name="purpose" select="'xref'"/>
|
434
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
435
|
<xsl:with-param name="referrer" select="$referrer"/>
|
436
|
<xsl:with-param name="verbose" select="$verbose"/>
|
437
|
</xsl:apply-templates>
|
438
|
</xsl:template>
|
439
|
|
440
|
<xsl:template match="bibliography" mode="xref-to">
|
441
|
<xsl:param name="referrer"/>
|
442
|
<xsl:param name="xrefstyle"/>
|
443
|
<xsl:param name="verbose" select="1"/>
|
444
|
|
445
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
446
|
<xsl:with-param name="purpose" select="'xref'"/>
|
447
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
448
|
<xsl:with-param name="referrer" select="$referrer"/>
|
449
|
<xsl:with-param name="verbose" select="$verbose"/>
|
450
|
</xsl:apply-templates>
|
451
|
</xsl:template>
|
452
|
|
453
|
<xsl:template match="biblioentry|bibliomixed" mode="xref-to-prefix">
|
454
|
<xsl:text>[</xsl:text>
|
455
|
</xsl:template>
|
456
|
|
457
|
<xsl:template match="biblioentry|bibliomixed" mode="xref-to-suffix">
|
458
|
<xsl:text>]</xsl:text>
|
459
|
</xsl:template>
|
460
|
|
461
|
<xsl:template match="biblioentry|bibliomixed" mode="xref-to">
|
462
|
<xsl:param name="referrer"/>
|
463
|
<xsl:param name="xrefstyle"/>
|
464
|
<xsl:param name="verbose" select="1"/>
|
465
|
|
466
|
<!-- handles both biblioentry and bibliomixed -->
|
467
|
<xsl:choose>
|
468
|
<xsl:when test="string(.) = ''">
|
469
|
<xsl:variable name="bib" select="document($bibliography.collection,.)"/>
|
470
|
<xsl:variable name="id" select="(@id|@xml:id)[1]"/>
|
471
|
<xsl:variable name="entry" select="$bib/bibliography/
|
472
|
*[@id=$id or @xml:id=$id][1]"/>
|
473
|
<xsl:choose>
|
474
|
<xsl:when test="$entry">
|
475
|
<xsl:choose>
|
476
|
<xsl:when test="$bibliography.numbered != 0">
|
477
|
<xsl:number from="bibliography" count="biblioentry|bibliomixed"
|
478
|
level="any" format="1"/>
|
479
|
</xsl:when>
|
480
|
<xsl:when test="local-name($entry/*[1]) = 'abbrev'">
|
481
|
<xsl:apply-templates select="$entry/*[1]"/>
|
482
|
</xsl:when>
|
483
|
<xsl:otherwise>
|
484
|
<xsl:value-of select="(@id|@xml:id)[1]"/>
|
485
|
</xsl:otherwise>
|
486
|
</xsl:choose>
|
487
|
</xsl:when>
|
488
|
<xsl:otherwise>
|
489
|
<xsl:message>
|
490
|
<xsl:text>No bibliography entry: </xsl:text>
|
491
|
<xsl:value-of select="$id"/>
|
492
|
<xsl:text> found in </xsl:text>
|
493
|
<xsl:value-of select="$bibliography.collection"/>
|
494
|
</xsl:message>
|
495
|
<xsl:value-of select="(@id|@xml:id)[1]"/>
|
496
|
</xsl:otherwise>
|
497
|
</xsl:choose>
|
498
|
</xsl:when>
|
499
|
<xsl:otherwise>
|
500
|
<xsl:choose>
|
501
|
<xsl:when test="$bibliography.numbered != 0">
|
502
|
<xsl:number from="bibliography" count="biblioentry|bibliomixed"
|
503
|
level="any" format="1"/>
|
504
|
</xsl:when>
|
505
|
<xsl:when test="local-name(*[1]) = 'abbrev'">
|
506
|
<xsl:apply-templates select="*[1]"/>
|
507
|
</xsl:when>
|
508
|
<xsl:otherwise>
|
509
|
<xsl:value-of select="(@id|@xml:id)[1]"/>
|
510
|
</xsl:otherwise>
|
511
|
</xsl:choose>
|
512
|
</xsl:otherwise>
|
513
|
</xsl:choose>
|
514
|
</xsl:template>
|
515
|
|
516
|
<xsl:template match="glossary" mode="xref-to">
|
517
|
<xsl:param name="referrer"/>
|
518
|
<xsl:param name="xrefstyle"/>
|
519
|
<xsl:param name="verbose" select="1"/>
|
520
|
|
521
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
522
|
<xsl:with-param name="purpose" select="'xref'"/>
|
523
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
524
|
<xsl:with-param name="referrer" select="$referrer"/>
|
525
|
<xsl:with-param name="verbose" select="$verbose"/>
|
526
|
</xsl:apply-templates>
|
527
|
</xsl:template>
|
528
|
|
529
|
<xsl:template match="glossentry" mode="xref-to">
|
530
|
<xsl:param name="referrer"/>
|
531
|
<xsl:param name="xrefstyle"/>
|
532
|
<xsl:param name="verbose" select="1"/>
|
533
|
<xsl:choose>
|
534
|
<xsl:when test="$glossentry.show.acronym = 'primary'">
|
535
|
<xsl:choose>
|
536
|
<xsl:when test="acronym|abbrev">
|
537
|
<xsl:apply-templates select="(acronym|abbrev)[1]"/>
|
538
|
</xsl:when>
|
539
|
<xsl:otherwise>
|
540
|
<xsl:apply-templates select="glossterm[1]" mode="xref-to">
|
541
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
542
|
<xsl:with-param name="referrer" select="$referrer"/>
|
543
|
<xsl:with-param name="verbose" select="$verbose"/>
|
544
|
</xsl:apply-templates>
|
545
|
</xsl:otherwise>
|
546
|
</xsl:choose>
|
547
|
</xsl:when>
|
548
|
<xsl:otherwise>
|
549
|
<xsl:apply-templates select="glossterm[1]" mode="xref-to">
|
550
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
551
|
<xsl:with-param name="referrer" select="$referrer"/>
|
552
|
<xsl:with-param name="verbose" select="$verbose"/>
|
553
|
</xsl:apply-templates>
|
554
|
</xsl:otherwise>
|
555
|
</xsl:choose>
|
556
|
</xsl:template>
|
557
|
|
558
|
<xsl:template match="glossterm|firstterm" mode="xref-to">
|
559
|
<xsl:apply-templates/>
|
560
|
</xsl:template>
|
561
|
|
562
|
<xsl:template match="index" mode="xref-to">
|
563
|
<xsl:param name="referrer"/>
|
564
|
<xsl:param name="xrefstyle"/>
|
565
|
<xsl:param name="verbose" select="1"/>
|
566
|
|
567
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
568
|
<xsl:with-param name="purpose" select="'xref'"/>
|
569
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
570
|
<xsl:with-param name="referrer" select="$referrer"/>
|
571
|
<xsl:with-param name="verbose" select="$verbose"/>
|
572
|
</xsl:apply-templates>
|
573
|
</xsl:template>
|
574
|
|
575
|
<xsl:template match="listitem" mode="xref-to">
|
576
|
<xsl:param name="referrer"/>
|
577
|
<xsl:param name="xrefstyle"/>
|
578
|
<xsl:param name="verbose"/>
|
579
|
|
580
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
581
|
<xsl:with-param name="purpose" select="'xref'"/>
|
582
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
583
|
<xsl:with-param name="referrer" select="$referrer"/>
|
584
|
<xsl:with-param name="verbose" select="$verbose"/>
|
585
|
</xsl:apply-templates>
|
586
|
</xsl:template>
|
587
|
|
588
|
<xsl:template match="section|simplesect
|
589
|
|sect1|sect2|sect3|sect4|sect5
|
590
|
|refsect1|refsect2|refsect3|refsection" mode="xref-to">
|
591
|
<xsl:param name="referrer"/>
|
592
|
<xsl:param name="xrefstyle"/>
|
593
|
<xsl:param name="verbose" select="1"/>
|
594
|
|
595
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
596
|
<xsl:with-param name="purpose" select="'xref'"/>
|
597
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
598
|
<xsl:with-param name="referrer" select="$referrer"/>
|
599
|
<xsl:with-param name="verbose" select="$verbose"/>
|
600
|
</xsl:apply-templates>
|
601
|
<!-- FIXME: What about "in Chapter X"? -->
|
602
|
</xsl:template>
|
603
|
|
604
|
<xsl:template match="bridgehead" mode="xref-to">
|
605
|
<xsl:param name="referrer"/>
|
606
|
<xsl:param name="xrefstyle"/>
|
607
|
<xsl:param name="verbose" select="1"/>
|
608
|
|
609
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
610
|
<xsl:with-param name="purpose" select="'xref'"/>
|
611
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
612
|
<xsl:with-param name="referrer" select="$referrer"/>
|
613
|
<xsl:with-param name="verbose" select="$verbose"/>
|
614
|
</xsl:apply-templates>
|
615
|
<!-- FIXME: What about "in Chapter X"? -->
|
616
|
</xsl:template>
|
617
|
|
618
|
<xsl:template match="qandaset" mode="xref-to">
|
619
|
<xsl:param name="referrer"/>
|
620
|
<xsl:param name="xrefstyle"/>
|
621
|
<xsl:param name="verbose" select="1"/>
|
622
|
|
623
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
624
|
<xsl:with-param name="purpose" select="'xref'"/>
|
625
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
626
|
<xsl:with-param name="referrer" select="$referrer"/>
|
627
|
<xsl:with-param name="verbose" select="$verbose"/>
|
628
|
</xsl:apply-templates>
|
629
|
</xsl:template>
|
630
|
|
631
|
<xsl:template match="qandadiv" mode="xref-to">
|
632
|
<xsl:param name="referrer"/>
|
633
|
<xsl:param name="xrefstyle"/>
|
634
|
<xsl:param name="verbose" select="1"/>
|
635
|
|
636
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
637
|
<xsl:with-param name="purpose" select="'xref'"/>
|
638
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
639
|
<xsl:with-param name="referrer" select="$referrer"/>
|
640
|
<xsl:with-param name="verbose" select="$verbose"/>
|
641
|
</xsl:apply-templates>
|
642
|
</xsl:template>
|
643
|
|
644
|
<xsl:template match="qandaentry" mode="xref-to">
|
645
|
<xsl:param name="referrer"/>
|
646
|
<xsl:param name="xrefstyle"/>
|
647
|
<xsl:param name="verbose" select="1"/>
|
648
|
|
649
|
<xsl:apply-templates select="question[1]" mode="xref-to">
|
650
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
651
|
<xsl:with-param name="referrer" select="$referrer"/>
|
652
|
<xsl:with-param name="verbose" select="$verbose"/>
|
653
|
</xsl:apply-templates>
|
654
|
</xsl:template>
|
655
|
|
656
|
<xsl:template match="question|answer" mode="xref-to">
|
657
|
<xsl:param name="referrer"/>
|
658
|
<xsl:param name="xrefstyle"/>
|
659
|
<xsl:param name="verbose" select="1"/>
|
660
|
|
661
|
<xsl:choose>
|
662
|
<xsl:when test="string-length(label) != 0">
|
663
|
<xsl:apply-templates select="." mode="label.markup"/>
|
664
|
</xsl:when>
|
665
|
<xsl:otherwise>
|
666
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
667
|
<xsl:with-param name="purpose" select="'xref'"/>
|
668
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
669
|
<xsl:with-param name="referrer" select="$referrer"/>
|
670
|
<xsl:with-param name="verbose" select="$verbose"/>
|
671
|
</xsl:apply-templates>
|
672
|
</xsl:otherwise>
|
673
|
</xsl:choose>
|
674
|
</xsl:template>
|
675
|
|
676
|
<xsl:template match="part|reference" mode="xref-to">
|
677
|
<xsl:param name="referrer"/>
|
678
|
<xsl:param name="xrefstyle"/>
|
679
|
<xsl:param name="verbose" select="1"/>
|
680
|
|
681
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
682
|
<xsl:with-param name="purpose" select="'xref'"/>
|
683
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
684
|
<xsl:with-param name="referrer" select="$referrer"/>
|
685
|
<xsl:with-param name="verbose" select="$verbose"/>
|
686
|
</xsl:apply-templates>
|
687
|
</xsl:template>
|
688
|
|
689
|
<xsl:template match="refentry" mode="xref-to">
|
690
|
<xsl:param name="referrer"/>
|
691
|
<xsl:param name="xrefstyle"/>
|
692
|
|
693
|
<xsl:choose>
|
694
|
<xsl:when test="refmeta/refentrytitle">
|
695
|
<xsl:apply-templates select="refmeta/refentrytitle"/>
|
696
|
</xsl:when>
|
697
|
<xsl:otherwise>
|
698
|
<xsl:apply-templates select="refnamediv/refname[1]"/>
|
699
|
</xsl:otherwise>
|
700
|
</xsl:choose>
|
701
|
<xsl:apply-templates select="refmeta/manvolnum"/>
|
702
|
</xsl:template>
|
703
|
|
704
|
<xsl:template match="refnamediv" mode="xref-to">
|
705
|
<xsl:param name="referrer"/>
|
706
|
<xsl:param name="xrefstyle"/>
|
707
|
<xsl:param name="verbose" select="1"/>
|
708
|
|
709
|
<xsl:apply-templates select="refname[1]" mode="xref-to">
|
710
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
711
|
<xsl:with-param name="referrer" select="$referrer"/>
|
712
|
<xsl:with-param name="verbose" select="$verbose"/>
|
713
|
</xsl:apply-templates>
|
714
|
</xsl:template>
|
715
|
|
716
|
<xsl:template match="refname" mode="xref-to">
|
717
|
<xsl:param name="referrer"/>
|
718
|
<xsl:param name="xrefstyle"/>
|
719
|
<xsl:param name="verbose" select="1"/>
|
720
|
|
721
|
<xsl:apply-templates mode="xref-to"/>
|
722
|
</xsl:template>
|
723
|
|
724
|
<xsl:template match="step" mode="xref-to">
|
725
|
<xsl:param name="referrer"/>
|
726
|
<xsl:param name="xrefstyle"/>
|
727
|
|
728
|
<xsl:call-template name="gentext">
|
729
|
<xsl:with-param name="key" select="'Step'"/>
|
730
|
</xsl:call-template>
|
731
|
<xsl:text> </xsl:text>
|
732
|
<xsl:apply-templates select="." mode="number"/>
|
733
|
</xsl:template>
|
734
|
|
735
|
<xsl:template match="varlistentry" mode="xref-to">
|
736
|
<xsl:param name="referrer"/>
|
737
|
<xsl:param name="xrefstyle"/>
|
738
|
<xsl:param name="verbose" select="1"/>
|
739
|
|
740
|
<xsl:apply-templates select="term[1]" mode="xref-to">
|
741
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
742
|
<xsl:with-param name="referrer" select="$referrer"/>
|
743
|
<xsl:with-param name="verbose" select="$verbose"/>
|
744
|
</xsl:apply-templates>
|
745
|
</xsl:template>
|
746
|
|
747
|
<xsl:template match="primary|secondary|tertiary" mode="xref-to">
|
748
|
<xsl:value-of select="."/>
|
749
|
</xsl:template>
|
750
|
|
751
|
<xsl:template match="indexterm" mode="xref-to">
|
752
|
<xsl:value-of select="primary"/>
|
753
|
</xsl:template>
|
754
|
|
755
|
<xsl:template match="varlistentry/term" mode="xref-to">
|
756
|
<xsl:param name="referrer"/>
|
757
|
<xsl:param name="xrefstyle"/>
|
758
|
|
759
|
<!-- to avoid the comma that will be generated if there are several terms -->
|
760
|
<xsl:apply-templates/>
|
761
|
</xsl:template>
|
762
|
|
763
|
<xsl:template match="co" mode="xref-to">
|
764
|
<xsl:param name="referrer"/>
|
765
|
<xsl:param name="xrefstyle"/>
|
766
|
|
767
|
<xsl:apply-templates select="." mode="callout-bug"/>
|
768
|
</xsl:template>
|
769
|
|
770
|
<xsl:template match="area|areaset" mode="xref-to">
|
771
|
<xsl:param name="referrer"/>
|
772
|
<xsl:param name="xrefstyle"/>
|
773
|
|
774
|
<xsl:call-template name="callout-bug">
|
775
|
<xsl:with-param name="conum">
|
776
|
<xsl:apply-templates select="." mode="conumber"/>
|
777
|
</xsl:with-param>
|
778
|
</xsl:call-template>
|
779
|
</xsl:template>
|
780
|
|
781
|
<xsl:template match="book" mode="xref-to">
|
782
|
<xsl:param name="referrer"/>
|
783
|
<xsl:param name="xrefstyle"/>
|
784
|
<xsl:param name="verbose" select="1"/>
|
785
|
|
786
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
787
|
<xsl:with-param name="purpose" select="'xref'"/>
|
788
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
789
|
<xsl:with-param name="referrer" select="$referrer"/>
|
790
|
<xsl:with-param name="verbose" select="$verbose"/>
|
791
|
</xsl:apply-templates>
|
792
|
</xsl:template>
|
793
|
|
794
|
<!-- These are elements for which no link text exists, so an xref to one
|
795
|
uses the xrefstyle attribute if specified, or if not it falls back
|
796
|
to the container element's link text -->
|
797
|
<xsl:template match="para|phrase|simpara|anchor|quote" mode="xref-to">
|
798
|
<xsl:param name="referrer"/>
|
799
|
<xsl:param name="xrefstyle"/>
|
800
|
<xsl:param name="verbose" select="1"/>
|
801
|
|
802
|
<xsl:variable name="context" select="(ancestor::simplesect
|
803
|
|ancestor::section
|
804
|
|ancestor::sect1
|
805
|
|ancestor::sect2
|
806
|
|ancestor::sect3
|
807
|
|ancestor::sect4
|
808
|
|ancestor::sect5
|
809
|
|ancestor::refsection
|
810
|
|ancestor::refsect1
|
811
|
|ancestor::refsect2
|
812
|
|ancestor::refsect3
|
813
|
|ancestor::chapter
|
814
|
|ancestor::appendix
|
815
|
|ancestor::preface
|
816
|
|ancestor::partintro
|
817
|
|ancestor::dedication
|
818
|
|ancestor::acknowledgements
|
819
|
|ancestor::colophon
|
820
|
|ancestor::bibliography
|
821
|
|ancestor::index
|
822
|
|ancestor::glossary
|
823
|
|ancestor::glossentry
|
824
|
|ancestor::listitem
|
825
|
|ancestor::varlistentry)[last()]"/>
|
826
|
|
827
|
<xsl:choose>
|
828
|
<xsl:when test="$xrefstyle != ''">
|
829
|
<xsl:apply-templates select="." mode="object.xref.markup">
|
830
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
831
|
<xsl:with-param name="referrer" select="$referrer"/>
|
832
|
<xsl:with-param name="verbose" select="$verbose"/>
|
833
|
</xsl:apply-templates>
|
834
|
</xsl:when>
|
835
|
<xsl:otherwise>
|
836
|
<xsl:apply-templates select="$context" mode="xref-to">
|
837
|
<xsl:with-param name="purpose" select="'xref'"/>
|
838
|
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
839
|
<xsl:with-param name="referrer" select="$referrer"/>
|
840
|
<xsl:with-param name="verbose" select="$verbose"/>
|
841
|
</xsl:apply-templates>
|
842
|
</xsl:otherwise>
|
843
|
</xsl:choose>
|
844
|
</xsl:template>
|
845
|
|
846
|
<!-- ==================================================================== -->
|
847
|
|
848
|
<xsl:template match="*" mode="xref-title">
|
849
|
<xsl:variable name="title">
|
850
|
<xsl:apply-templates select="." mode="object.title.markup"/>
|
851
|
</xsl:variable>
|
852
|
|
853
|
<xsl:value-of select="$title"/>
|
854
|
</xsl:template>
|
855
|
|
856
|
<xsl:template match="author" mode="xref-title">
|
857
|
<xsl:variable name="title">
|
858
|
<xsl:call-template name="person.name"/>
|
859
|
</xsl:variable>
|
860
|
|
861
|
<xsl:value-of select="$title"/>
|
862
|
</xsl:template>
|
863
|
|
864
|
<xsl:template match="authorgroup" mode="xref-title">
|
865
|
<xsl:variable name="title">
|
866
|
<xsl:call-template name="person.name.list"/>
|
867
|
</xsl:variable>
|
868
|
|
869
|
<xsl:value-of select="$title"/>
|
870
|
</xsl:template>
|
871
|
|
872
|
<xsl:template match="cmdsynopsis" mode="xref-title">
|
873
|
<xsl:variable name="title">
|
874
|
<xsl:apply-templates select="(.//command)[1]" mode="xref"/>
|
875
|
</xsl:variable>
|
876
|
|
877
|
<xsl:value-of select="$title"/>
|
878
|
</xsl:template>
|
879
|
|
880
|
<xsl:template match="funcsynopsis" mode="xref-title">
|
881
|
<xsl:variable name="title">
|
882
|
<xsl:apply-templates select="(.//function)[1]" mode="xref"/>
|
883
|
</xsl:variable>
|
884
|
|
885
|
<xsl:value-of select="$title"/>
|
886
|
</xsl:template>
|
887
|
|
888
|
<xsl:template match="biblioentry|bibliomixed" mode="xref-title">
|
889
|
<!-- handles both biblioentry and bibliomixed -->
|
890
|
<xsl:variable name="title">
|
891
|
<xsl:text>[</xsl:text>
|
892
|
<xsl:choose>
|
893
|
<xsl:when test="local-name(*[1]) = 'abbrev'">
|
894
|
<xsl:apply-templates select="*[1]"/>
|
895
|
</xsl:when>
|
896
|
<xsl:otherwise>
|
897
|
<xsl:value-of select="(@id|@xml:id)[1]"/>
|
898
|
</xsl:otherwise>
|
899
|
</xsl:choose>
|
900
|
<xsl:text>]</xsl:text>
|
901
|
</xsl:variable>
|
902
|
|
903
|
<xsl:value-of select="$title"/>
|
904
|
</xsl:template>
|
905
|
|
906
|
<xsl:template match="step" mode="xref-title">
|
907
|
<xsl:call-template name="gentext">
|
908
|
<xsl:with-param name="key" select="'Step'"/>
|
909
|
</xsl:call-template>
|
910
|
<xsl:text> </xsl:text>
|
911
|
<xsl:apply-templates select="." mode="number"/>
|
912
|
</xsl:template>
|
913
|
|
914
|
<xsl:template match="step[not(./title)]" mode="title.markup">
|
915
|
<xsl:call-template name="gentext">
|
916
|
<xsl:with-param name="key" select="'Step'"/>
|
917
|
</xsl:call-template>
|
918
|
<xsl:text> </xsl:text>
|
919
|
<xsl:apply-templates select="." mode="number"/>
|
920
|
</xsl:template>
|
921
|
|
922
|
<xsl:template match="co" mode="xref-title">
|
923
|
<xsl:variable name="title">
|
924
|
<xsl:apply-templates select="." mode="callout-bug"/>
|
925
|
</xsl:variable>
|
926
|
|
927
|
<xsl:value-of select="$title"/>
|
928
|
</xsl:template>
|
929
|
|
930
|
<!-- ==================================================================== -->
|
931
|
|
932
|
<xsl:template match="link" name="link">
|
933
|
<xsl:param name="linkend" select="@linkend"/>
|
934
|
<xsl:param name="a.target"/>
|
935
|
<xsl:param name="xhref" select="@xlink:href"/>
|
936
|
|
937
|
<xsl:variable name="content">
|
938
|
<xsl:call-template name="anchor"/>
|
939
|
<xsl:choose>
|
940
|
<xsl:when test="count(child::node()) > 0">
|
941
|
<!-- If it has content, use it -->
|
942
|
<xsl:apply-templates/>
|
943
|
</xsl:when>
|
944
|
<!-- else look for an endterm -->
|
945
|
<xsl:when test="@endterm">
|
946
|
<xsl:variable name="etargets" select="key('id',@endterm)"/>
|
947
|
<xsl:variable name="etarget" select="$etargets[1]"/>
|
948
|
<xsl:choose>
|
949
|
<xsl:when test="count($etarget) = 0">
|
950
|
<xsl:message>
|
951
|
<xsl:value-of select="count($etargets)"/>
|
952
|
<xsl:text>Endterm points to nonexistent ID: </xsl:text>
|
953
|
<xsl:value-of select="@endterm"/>
|
954
|
</xsl:message>
|
955
|
<xsl:text>???</xsl:text>
|
956
|
</xsl:when>
|
957
|
<xsl:otherwise>
|
958
|
<xsl:apply-templates select="$etarget" mode="endterm"/>
|
959
|
</xsl:otherwise>
|
960
|
</xsl:choose>
|
961
|
</xsl:when>
|
962
|
<!-- Use the xlink:href if no other text -->
|
963
|
<xsl:when test="@xlink:href">
|
964
|
<xsl:value-of select="@xlink:href"/>
|
965
|
</xsl:when>
|
966
|
<xsl:otherwise>
|
967
|
<xsl:message>
|
968
|
<xsl:text>Link element has no content and no Endterm. </xsl:text>
|
969
|
<xsl:text>Nothing to show in the link to </xsl:text>
|
970
|
<xsl:value-of select="(@xlink:href|@linkend)[1]"/>
|
971
|
</xsl:message>
|
972
|
<xsl:text>???</xsl:text>
|
973
|
</xsl:otherwise>
|
974
|
</xsl:choose>
|
975
|
</xsl:variable>
|
976
|
|
977
|
<xsl:call-template name="simple.xlink">
|
978
|
<xsl:with-param name="node" select="."/>
|
979
|
<xsl:with-param name="linkend" select="$linkend"/>
|
980
|
<xsl:with-param name="content" select="$content"/>
|
981
|
<xsl:with-param name="a.target" select="$a.target"/>
|
982
|
<xsl:with-param name="xhref" select="$xhref"/>
|
983
|
</xsl:call-template>
|
984
|
|
985
|
</xsl:template>
|
986
|
|
987
|
<xsl:template match="ulink" name="ulink">
|
988
|
<xsl:param name="url" select="@url"/>
|
989
|
<xsl:variable name="link">
|
990
|
<a>
|
991
|
<xsl:apply-templates select="." mode="common.html.attributes"/>
|
992
|
<xsl:if test="@id or @xml:id">
|
993
|
<xsl:attribute name="name">
|
994
|
<xsl:value-of select="(@id|@xml:id)[1]"/>
|
995
|
</xsl:attribute>
|
996
|
</xsl:if>
|
997
|
<xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
|
998
|
<xsl:if test="$ulink.target != ''">
|
999
|
<xsl:attribute name="target">
|
1000
|
<xsl:value-of select="$ulink.target"/>
|
1001
|
</xsl:attribute>
|
1002
|
</xsl:if>
|
1003
|
<xsl:choose>
|
1004
|
<xsl:when test="count(child::node())=0">
|
1005
|
<xsl:value-of select="$url"/>
|
1006
|
</xsl:when>
|
1007
|
<xsl:otherwise>
|
1008
|
<xsl:apply-templates/>
|
1009
|
</xsl:otherwise>
|
1010
|
</xsl:choose>
|
1011
|
</a>
|
1012
|
</xsl:variable>
|
1013
|
|
1014
|
<xsl:choose>
|
1015
|
<xsl:when test="function-available('suwl:unwrapLinks')">
|
1016
|
<xsl:copy-of select="suwl:unwrapLinks($link)"/>
|
1017
|
</xsl:when>
|
1018
|
<xsl:otherwise>
|
1019
|
<xsl:copy-of select="$link"/>
|
1020
|
</xsl:otherwise>
|
1021
|
</xsl:choose>
|
1022
|
</xsl:template>
|
1023
|
|
1024
|
<xsl:template match="olink" name="olink">
|
1025
|
<!-- olink content may be passed in from xlink olink -->
|
1026
|
<xsl:param name="content" select="NOTANELEMENT"/>
|
1027
|
|
1028
|
<xsl:call-template name="anchor"/>
|
1029
|
|
1030
|
<xsl:variable name="localinfo" select="@localinfo"/>
|
1031
|
|
1032
|
<xsl:choose>
|
1033
|
<!-- olinks resolved by stylesheet and target database -->
|
1034
|
<xsl:when test="@targetdoc or @targetptr or
|
1035
|
(@xlink:role=$xolink.role and
|
1036
|
contains(@xlink:href, '#') )" >
|
1037
|
|
1038
|
<xsl:variable name="targetdoc.att">
|
1039
|
<xsl:choose>
|
1040
|
<xsl:when test="@targetdoc != ''">
|
1041
|
<xsl:value-of select="@targetdoc"/>
|
1042
|
</xsl:when>
|
1043
|
<xsl:when test="@xlink:role=$xolink.role and
|
1044
|
contains(@xlink:href, '#')" >
|
1045
|
<xsl:value-of select="substring-before(@xlink:href, '#')"/>
|
1046
|
</xsl:when>
|
1047
|
</xsl:choose>
|
1048
|
</xsl:variable>
|
1049
|
|
1050
|
<xsl:variable name="targetptr.att">
|
1051
|
<xsl:choose>
|
1052
|
<xsl:when test="@targetptr != ''">
|
1053
|
<xsl:value-of select="@targetptr"/>
|
1054
|
</xsl:when>
|
1055
|
<xsl:when test="@xlink:role=$xolink.role and
|
1056
|
contains(@xlink:href, '#')" >
|
1057
|
<xsl:value-of select="substring-after(@xlink:href, '#')"/>
|
1058
|
</xsl:when>
|
1059
|
</xsl:choose>
|
1060
|
</xsl:variable>
|
1061
|
|
1062
|
<xsl:variable name="olink.lang">
|
1063
|
<xsl:call-template name="l10n.language">
|
1064
|
<xsl:with-param name="xref-context" select="true()"/>
|
1065
|
</xsl:call-template>
|
1066
|
</xsl:variable>
|
1067
|
|
1068
|
<xsl:variable name="target.database.filename">
|
1069
|
<xsl:call-template name="select.target.database">
|
1070
|
<xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
|
1071
|
<xsl:with-param name="targetptr.att" select="$targetptr.att"/>
|
1072
|
<xsl:with-param name="olink.lang" select="$olink.lang"/>
|
1073
|
</xsl:call-template>
|
1074
|
</xsl:variable>
|
1075
|
|
1076
|
<xsl:variable name="target.database"
|
1077
|
select="document($target.database.filename,/)"/>
|
1078
|
|
1079
|
<xsl:if test="$olink.debug != 0">
|
1080
|
<xsl:message>
|
1081
|
<xsl:text>Olink debug: root element of target.database '</xsl:text>
|
1082
|
<xsl:value-of select="$target.database.filename"/>
|
1083
|
<xsl:text>' is '</xsl:text>
|
1084
|
<xsl:value-of select="local-name($target.database/*[1])"/>
|
1085
|
<xsl:text>'.</xsl:text>
|
1086
|
</xsl:message>
|
1087
|
</xsl:if>
|
1088
|
|
1089
|
<xsl:variable name="olink.key">
|
1090
|
<xsl:call-template name="select.olink.key">
|
1091
|
<xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
|
1092
|
<xsl:with-param name="targetptr.att" select="$targetptr.att"/>
|
1093
|
<xsl:with-param name="olink.lang" select="$olink.lang"/>
|
1094
|
<xsl:with-param name="target.database" select="$target.database"/>
|
1095
|
</xsl:call-template>
|
1096
|
</xsl:variable>
|
1097
|
|
1098
|
<xsl:if test="string-length($olink.key) = 0">
|
1099
|
<xsl:message>
|
1100
|
<xsl:text>Error: unresolved olink: </xsl:text>
|
1101
|
<xsl:text>targetdoc/targetptr = '</xsl:text>
|
1102
|
<xsl:value-of select="$targetdoc.att"/>
|
1103
|
<xsl:text>/</xsl:text>
|
1104
|
<xsl:value-of select="$targetptr.att"/>
|
1105
|
<xsl:text>'.</xsl:text>
|
1106
|
</xsl:message>
|
1107
|
</xsl:if>
|
1108
|
|
1109
|
<xsl:variable name="href">
|
1110
|
<xsl:call-template name="make.olink.href">
|
1111
|
<xsl:with-param name="olink.key" select="$olink.key"/>
|
1112
|
<xsl:with-param name="target.database" select="$target.database"/>
|
1113
|
</xsl:call-template>
|
1114
|
</xsl:variable>
|
1115
|
|
1116
|
<xsl:variable name="hottext">
|
1117
|
<xsl:choose>
|
1118
|
<xsl:when test="string-length($content) != 0">
|
1119
|
<xsl:copy-of select="$content"/>
|
1120
|
</xsl:when>
|
1121
|
<xsl:otherwise>
|
1122
|
<xsl:call-template name="olink.hottext">
|
1123
|
<xsl:with-param name="olink.key" select="$olink.key"/>
|
1124
|
<xsl:with-param name="olink.lang" select="$olink.lang"/>
|
1125
|
<xsl:with-param name="target.database" select="$target.database"/>
|
1126
|
</xsl:call-template>
|
1127
|
</xsl:otherwise>
|
1128
|
</xsl:choose>
|
1129
|
</xsl:variable>
|
1130
|
|
1131
|
<xsl:variable name="olink.docname.citation">
|
1132
|
<xsl:call-template name="olink.document.citation">
|
1133
|
<xsl:with-param name="olink.key" select="$olink.key"/>
|
1134
|
<xsl:with-param name="target.database" select="$target.database"/>
|
1135
|
<xsl:with-param name="olink.lang" select="$olink.lang"/>
|
1136
|
</xsl:call-template>
|
1137
|
</xsl:variable>
|
1138
|
|
1139
|
<xsl:variable name="olink.page.citation">
|
1140
|
<xsl:call-template name="olink.page.citation">
|
1141
|
<xsl:with-param name="olink.key" select="$olink.key"/>
|
1142
|
<xsl:with-param name="target.database" select="$target.database"/>
|
1143
|
<xsl:with-param name="olink.lang" select="$olink.lang"/>
|
1144
|
</xsl:call-template>
|
1145
|
</xsl:variable>
|
1146
|
|
1147
|
<xsl:choose>
|
1148
|
<xsl:when test="$href != ''">
|
1149
|
<a href="{$href}">
|
1150
|
<xsl:apply-templates select="." mode="common.html.attributes"/>
|
1151
|
<xsl:copy-of select="$hottext"/>
|
1152
|
</a>
|
1153
|
<xsl:copy-of select="$olink.page.citation"/>
|
1154
|
<xsl:copy-of select="$olink.docname.citation"/>
|
1155
|
</xsl:when>
|
1156
|
<xsl:otherwise>
|
1157
|
<span class="olink"><xsl:copy-of select="$hottext"/></span>
|
1158
|
<xsl:copy-of select="$olink.page.citation"/>
|
1159
|
<xsl:copy-of select="$olink.docname.citation"/>
|
1160
|
</xsl:otherwise>
|
1161
|
</xsl:choose>
|
1162
|
|
1163
|
</xsl:when>
|
1164
|
|
1165
|
<!-- Or use old olink mechanism -->
|
1166
|
<xsl:otherwise>
|
1167
|
<xsl:variable name="href">
|
1168
|
<xsl:choose>
|
1169
|
<xsl:when test="@linkmode">
|
1170
|
<!-- use the linkmode to get the base URI, use localinfo as fragid -->
|
1171
|
<xsl:variable name="modespec" select="key('id',@linkmode)"/>
|
1172
|
<xsl:if test="count($modespec) != 1
|
1173
|
or local-name($modespec) != 'modespec'">
|
1174
|
<xsl:message>Warning: olink linkmode pointer is wrong.</xsl:message>
|
1175
|
</xsl:if>
|
1176
|
<xsl:value-of select="$modespec"/>
|
1177
|
<xsl:if test="@localinfo">
|
1178
|
<xsl:text>#</xsl:text>
|
1179
|
<xsl:value-of select="@localinfo"/>
|
1180
|
</xsl:if>
|
1181
|
</xsl:when>
|
1182
|
<xsl:when test="@type = 'href'">
|
1183
|
<xsl:call-template name="olink.outline">
|
1184
|
<xsl:with-param name="outline.base.uri"
|
1185
|
select="unparsed-entity-uri(@targetdocent)"/>
|
1186
|
<xsl:with-param name="localinfo" select="@localinfo"/>
|
1187
|
<xsl:with-param name="return" select="'href'"/>
|
1188
|
</xsl:call-template>
|
1189
|
</xsl:when>
|
1190
|
<xsl:otherwise>
|
1191
|
<xsl:value-of select="$olink.resolver"/>
|
1192
|
<xsl:text>?</xsl:text>
|
1193
|
<xsl:value-of select="$olink.sysid"/>
|
1194
|
<xsl:value-of select="unparsed-entity-uri(@targetdocent)"/>
|
1195
|
<!-- XSL gives no access to the public identifier (grumble...) -->
|
1196
|
<xsl:if test="@localinfo">
|
1197
|
<xsl:text>&</xsl:text>
|
1198
|
<xsl:value-of select="$olink.fragid"/>
|
1199
|
<xsl:value-of select="@localinfo"/>
|
1200
|
</xsl:if>
|
1201
|
</xsl:otherwise>
|
1202
|
</xsl:choose>
|
1203
|
</xsl:variable>
|
1204
|
|
1205
|
<xsl:choose>
|
1206
|
<xsl:when test="$href != ''">
|
1207
|
<a href="{$href}">
|
1208
|
<xsl:apply-templates select="." mode="common.html.attributes"/>
|
1209
|
<xsl:call-template name="olink.hottext"/>
|
1210
|
</a>
|
1211
|
</xsl:when>
|
1212
|
<xsl:otherwise>
|
1213
|
<xsl:call-template name="olink.hottext"/>
|
1214
|
</xsl:otherwise>
|
1215
|
</xsl:choose>
|
1216
|
</xsl:otherwise>
|
1217
|
</xsl:choose>
|
1218
|
</xsl:template>
|
1219
|
|
1220
|
<xsl:template match="*" mode="pagenumber.markup">
|
1221
|
<!-- no-op in HTML -->
|
1222
|
</xsl:template>
|
1223
|
|
1224
|
|
1225
|
<xsl:template name="olink.outline">
|
1226
|
<xsl:param name="outline.base.uri"/>
|
1227
|
<xsl:param name="localinfo"/>
|
1228
|
<xsl:param name="return" select="href"/>
|
1229
|
|
1230
|
<xsl:variable name="outline-file"
|
1231
|
select="concat($outline.base.uri,
|
1232
|
$olink.outline.ext)"/>
|
1233
|
|
1234
|
<xsl:variable name="outline" select="document($outline-file,.)/div"/>
|
1235
|
|
1236
|
<xsl:variable name="node-href">
|
1237
|
<xsl:choose>
|
1238
|
<xsl:when test="$localinfo != ''">
|
1239
|
<xsl:variable name="node" select="$outline//
|
1240
|
*[@id=$localinfo or @xml:id=$localinfo]"/>
|
1241
|
<xsl:value-of select="$node/@href"/>
|
1242
|
</xsl:when>
|
1243
|
<xsl:otherwise>
|
1244
|
<xsl:value-of select="$outline/@href"/>
|
1245
|
</xsl:otherwise>
|
1246
|
</xsl:choose>
|
1247
|
</xsl:variable>
|
1248
|
|
1249
|
<xsl:variable name="node-xref">
|
1250
|
<xsl:choose>
|
1251
|
<xsl:when test="$localinfo != ''">
|
1252
|
<xsl:variable name="node" select="$outline//
|
1253
|
*[@id=$localinfo or @xml:id=$localinfo]"/>
|
1254
|
<xsl:copy-of select="$node/xref"/>
|
1255
|
</xsl:when>
|
1256
|
<xsl:otherwise>
|
1257
|
<xsl:value-of select="$outline/xref"/>
|
1258
|
</xsl:otherwise>
|
1259
|
</xsl:choose>
|
1260
|
</xsl:variable>
|
1261
|
|
1262
|
<xsl:choose>
|
1263
|
<xsl:when test="$return = 'href'">
|
1264
|
<xsl:value-of select="$node-href"/>
|
1265
|
</xsl:when>
|
1266
|
<xsl:when test="$return = 'xref'">
|
1267
|
<xsl:value-of select="$node-xref"/>
|
1268
|
</xsl:when>
|
1269
|
<xsl:otherwise>
|
1270
|
<xsl:copy-of select="$node-xref"/>
|
1271
|
</xsl:otherwise>
|
1272
|
</xsl:choose>
|
1273
|
</xsl:template>
|
1274
|
|
1275
|
<!-- ==================================================================== -->
|
1276
|
|
1277
|
<xsl:template name="xref.xreflabel">
|
1278
|
<!-- called to process an xreflabel...you might use this to make -->
|
1279
|
<!-- xreflabels come out in the right font for different targets, -->
|
1280
|
<!-- for example. -->
|
1281
|
<xsl:param name="target" select="."/>
|
1282
|
<xsl:value-of select="$target/@xreflabel"/>
|
1283
|
</xsl:template>
|
1284
|
|
1285
|
<!-- ==================================================================== -->
|
1286
|
|
1287
|
<xsl:template match="title" mode="xref">
|
1288
|
<xsl:apply-templates/>
|
1289
|
</xsl:template>
|
1290
|
|
1291
|
<xsl:template match="command" mode="xref">
|
1292
|
<xsl:call-template name="inline.boldseq"/>
|
1293
|
</xsl:template>
|
1294
|
|
1295
|
<xsl:template match="function" mode="xref">
|
1296
|
<xsl:call-template name="inline.monoseq"/>
|
1297
|
</xsl:template>
|
1298
|
|
1299
|
<!-- ==================================================================== -->
|
1300
|
|
1301
|
<xsl:template match="*" mode="insert.title.markup">
|
1302
|
<xsl:param name="purpose"/>
|
1303
|
<xsl:param name="xrefstyle"/>
|
1304
|
<xsl:param name="title"/>
|
1305
|
|
1306
|
<xsl:choose>
|
1307
|
<!-- FIXME: what about the case where titleabbrev is inside the info? -->
|
1308
|
<xsl:when test="$purpose = 'xref' and titleabbrev">
|
1309
|
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
1310
|
</xsl:when>
|
1311
|
<xsl:otherwise>
|
1312
|
<xsl:copy-of select="$title"/>
|
1313
|
</xsl:otherwise>
|
1314
|
</xsl:choose>
|
1315
|
</xsl:template>
|
1316
|
|
1317
|
<xsl:template match="chapter|appendix" mode="insert.title.markup">
|
1318
|
<xsl:param name="purpose"/>
|
1319
|
<xsl:param name="xrefstyle"/>
|
1320
|
<xsl:param name="title"/>
|
1321
|
|
1322
|
<xsl:choose>
|
1323
|
<xsl:when test="$purpose = 'xref'">
|
1324
|
<i>
|
1325
|
<xsl:copy-of select="$title"/>
|
1326
|
</i>
|
1327
|
</xsl:when>
|
1328
|
<xsl:otherwise>
|
1329
|
<xsl:copy-of select="$title"/>
|
1330
|
</xsl:otherwise>
|
1331
|
</xsl:choose>
|
1332
|
</xsl:template>
|
1333
|
|
1334
|
<xsl:template match="*" mode="insert.subtitle.markup">
|
1335
|
<xsl:param name="purpose"/>
|
1336
|
<xsl:param name="xrefstyle"/>
|
1337
|
<xsl:param name="subtitle"/>
|
1338
|
|
1339
|
<xsl:copy-of select="$subtitle"/>
|
1340
|
</xsl:template>
|
1341
|
|
1342
|
<xsl:template match="*" mode="insert.label.markup">
|
1343
|
<xsl:param name="purpose"/>
|
1344
|
<xsl:param name="xrefstyle"/>
|
1345
|
<xsl:param name="label"/>
|
1346
|
|
1347
|
<xsl:copy-of select="$label"/>
|
1348
|
</xsl:template>
|
1349
|
|
1350
|
<xsl:template match="*" mode="insert.pagenumber.markup">
|
1351
|
<xsl:param name="purpose"/>
|
1352
|
<xsl:param name="xrefstyle"/>
|
1353
|
<xsl:param name="pagenumber"/>
|
1354
|
|
1355
|
<xsl:copy-of select="$pagenumber"/>
|
1356
|
</xsl:template>
|
1357
|
|
1358
|
<xsl:template match="*" mode="insert.direction.markup">
|
1359
|
<xsl:param name="purpose"/>
|
1360
|
<xsl:param name="xrefstyle"/>
|
1361
|
<xsl:param name="direction"/>
|
1362
|
|
1363
|
<xsl:copy-of select="$direction"/>
|
1364
|
</xsl:template>
|
1365
|
|
1366
|
<xsl:template match="*" mode="insert.olink.docname.markup">
|
1367
|
<xsl:param name="purpose"/>
|
1368
|
<xsl:param name="xrefstyle"/>
|
1369
|
<xsl:param name="docname"/>
|
1370
|
|
1371
|
<span class="olinkdocname">
|
1372
|
<xsl:copy-of select="$docname"/>
|
1373
|
</span>
|
1374
|
|
1375
|
</xsl:template>
|
1376
|
|
1377
|
</xsl:stylesheet>
|