Debian Codegraph @

docs/xsl-generic/html/xref.xsl

raw
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 7107 2007-07-22 10:22:06Z xmldoc $
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,'&#40;'))
37 or starts-with($xhref, '#xpointer&#40;id&#40;'))">
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="class.attribute"/>
162 <xsl:text>???</xsl:text>
163 </a>
164 </xsl:when>
165 <xsl:otherwise>
166 <a href="{$href}">
167 <xsl:apply-templates select="." mode="class.attribute"/>
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="class.attribute"/>
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="function-available('exsl:node-set')">
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|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" 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="object.xref.markup">
650 <xsl:with-param name="purpose" select="'xref'"/>
651 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
652 <xsl:with-param name="referrer" select="$referrer"/>
653 <xsl:with-param name="verbose" select="$verbose"/>
654 </xsl:apply-templates>
655 </xsl:template>
656
657 <xsl:template match="question|answer" mode="xref-to">
658 <xsl:param name="referrer"/>
659 <xsl:param name="xrefstyle"/>
660 <xsl:param name="verbose" select="1"/>
661
662 <xsl:apply-templates select="." mode="object.xref.markup">
663 <xsl:with-param name="purpose" select="'xref'"/>
664 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
665 <xsl:with-param name="referrer" select="$referrer"/>
666 <xsl:with-param name="verbose" select="$verbose"/>
667 </xsl:apply-templates>
668 </xsl:template>
669
670 <xsl:template match="part|reference" mode="xref-to">
671 <xsl:param name="referrer"/>
672 <xsl:param name="xrefstyle"/>
673 <xsl:param name="verbose" select="1"/>
674
675 <xsl:apply-templates select="." mode="object.xref.markup">
676 <xsl:with-param name="purpose" select="'xref'"/>
677 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
678 <xsl:with-param name="referrer" select="$referrer"/>
679 <xsl:with-param name="verbose" select="$verbose"/>
680 </xsl:apply-templates>
681 </xsl:template>
682
683 <xsl:template match="refentry" mode="xref-to">
684 <xsl:param name="referrer"/>
685 <xsl:param name="xrefstyle"/>
686
687 <xsl:choose>
688 <xsl:when test="refmeta/refentrytitle">
689 <xsl:apply-templates select="refmeta/refentrytitle"/>
690 </xsl:when>
691 <xsl:otherwise>
692 <xsl:apply-templates select="refnamediv/refname[1]"/>
693 </xsl:otherwise>
694 </xsl:choose>
695 <xsl:apply-templates select="refmeta/manvolnum"/>
696 </xsl:template>
697
698 <xsl:template match="refnamediv" mode="xref-to">
699 <xsl:param name="referrer"/>
700 <xsl:param name="xrefstyle"/>
701 <xsl:param name="verbose" select="1"/>
702
703 <xsl:apply-templates select="refname[1]" mode="xref-to">
704 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
705 <xsl:with-param name="referrer" select="$referrer"/>
706 <xsl:with-param name="verbose" select="$verbose"/>
707 </xsl:apply-templates>
708 </xsl:template>
709
710 <xsl:template match="refname" mode="xref-to">
711 <xsl:param name="referrer"/>
712 <xsl:param name="xrefstyle"/>
713 <xsl:param name="verbose" select="1"/>
714
715 <xsl:apply-templates mode="xref-to"/>
716 </xsl:template>
717
718 <xsl:template match="step" mode="xref-to">
719 <xsl:param name="referrer"/>
720 <xsl:param name="xrefstyle"/>
721
722 <xsl:call-template name="gentext">
723 <xsl:with-param name="key" select="'Step'"/>
724 </xsl:call-template>
725 <xsl:text> </xsl:text>
726 <xsl:apply-templates select="." mode="number"/>
727 </xsl:template>
728
729 <xsl:template match="varlistentry" mode="xref-to">
730 <xsl:param name="referrer"/>
731 <xsl:param name="xrefstyle"/>
732 <xsl:param name="verbose" select="1"/>
733
734 <xsl:apply-templates select="term[1]" mode="xref-to">
735 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
736 <xsl:with-param name="referrer" select="$referrer"/>
737 <xsl:with-param name="verbose" select="$verbose"/>
738 </xsl:apply-templates>
739 </xsl:template>
740
741 <xsl:template match="varlistentry/term" mode="xref-to">
742 <xsl:param name="referrer"/>
743 <xsl:param name="xrefstyle"/>
744
745 <!-- to avoid the comma that will be generated if there are several terms -->
746 <xsl:apply-templates/>
747 </xsl:template>
748
749 <xsl:template match="co" mode="xref-to">
750 <xsl:param name="referrer"/>
751 <xsl:param name="xrefstyle"/>
752
753 <xsl:apply-templates select="." mode="callout-bug"/>
754 </xsl:template>
755
756 <xsl:template match="area|areaset" mode="xref-to">
757 <xsl:param name="referrer"/>
758 <xsl:param name="xrefstyle"/>
759
760 <xsl:call-template name="callout-bug">
761 <xsl:with-param name="conum">
762 <xsl:apply-templates select="." mode="conumber"/>
763 </xsl:with-param>
764 </xsl:call-template>
765 </xsl:template>
766
767 <xsl:template match="book" mode="xref-to">
768 <xsl:param name="referrer"/>
769 <xsl:param name="xrefstyle"/>
770 <xsl:param name="verbose" select="1"/>
771
772 <xsl:apply-templates select="." mode="object.xref.markup">
773 <xsl:with-param name="purpose" select="'xref'"/>
774 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
775 <xsl:with-param name="referrer" select="$referrer"/>
776 <xsl:with-param name="verbose" select="$verbose"/>
777 </xsl:apply-templates>
778 </xsl:template>
779
780 <xsl:template match="para" mode="xref-to">
781 <xsl:param name="referrer"/>
782 <xsl:param name="xrefstyle"/>
783 <xsl:param name="verbose" select="1"/>
784
785 <xsl:variable name="context" select="(ancestor::simplesect
786 |ancestor::section
787 |ancestor::sect1
788 |ancestor::sect2
789 |ancestor::sect3
790 |ancestor::sect4
791 |ancestor::sect5
792 |ancestor::refsection
793 |ancestor::refsect1
794 |ancestor::refsect2
795 |ancestor::refsect3
796 |ancestor::chapter
797 |ancestor::appendix
798 |ancestor::preface
799 |ancestor::partintro
800 |ancestor::dedication
801 |ancestor::colophon
802 |ancestor::bibliography
803 |ancestor::index
804 |ancestor::glossary
805 |ancestor::glossentry
806 |ancestor::listitem
807 |ancestor::varlistentry)[last()]"/>
808
809 <xsl:apply-templates select="$context" mode="xref-to">
810 <xsl:with-param name="purpose" select="'xref'"/>
811 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
812 <xsl:with-param name="referrer" select="$referrer"/>
813 <xsl:with-param name="verbose" select="$verbose"/>
814 </xsl:apply-templates>
815 </xsl:template>
816
817 <!-- ==================================================================== -->
818
819 <xsl:template match="*" mode="xref-title">
820 <xsl:variable name="title">
821 <xsl:apply-templates select="." mode="object.title.markup"/>
822 </xsl:variable>
823
824 <xsl:value-of select="$title"/>
825 </xsl:template>
826
827 <xsl:template match="author" mode="xref-title">
828 <xsl:variable name="title">
829 <xsl:call-template name="person.name"/>
830 </xsl:variable>
831
832 <xsl:value-of select="$title"/>
833 </xsl:template>
834
835 <xsl:template match="authorgroup" mode="xref-title">
836 <xsl:variable name="title">
837 <xsl:call-template name="person.name.list"/>
838 </xsl:variable>
839
840 <xsl:value-of select="$title"/>
841 </xsl:template>
842
843 <xsl:template match="cmdsynopsis" mode="xref-title">
844 <xsl:variable name="title">
845 <xsl:apply-templates select="(.//command)[1]" mode="xref"/>
846 </xsl:variable>
847
848 <xsl:value-of select="$title"/>
849 </xsl:template>
850
851 <xsl:template match="funcsynopsis" mode="xref-title">
852 <xsl:variable name="title">
853 <xsl:apply-templates select="(.//function)[1]" mode="xref"/>
854 </xsl:variable>
855
856 <xsl:value-of select="$title"/>
857 </xsl:template>
858
859 <xsl:template match="biblioentry|bibliomixed" mode="xref-title">
860 <!-- handles both biblioentry and bibliomixed -->
861 <xsl:variable name="title">
862 <xsl:text>[</xsl:text>
863 <xsl:choose>
864 <xsl:when test="local-name(*[1]) = 'abbrev'">
865 <xsl:apply-templates select="*[1]"/>
866 </xsl:when>
867 <xsl:otherwise>
868 <xsl:value-of select="(@id|@xml:id)[1]"/>
869 </xsl:otherwise>
870 </xsl:choose>
871 <xsl:text>]</xsl:text>
872 </xsl:variable>
873
874 <xsl:value-of select="$title"/>
875 </xsl:template>
876
877 <xsl:template match="step" mode="xref-title">
878 <xsl:call-template name="gentext">
879 <xsl:with-param name="key" select="'Step'"/>
880 </xsl:call-template>
881 <xsl:text> </xsl:text>
882 <xsl:apply-templates select="." mode="number"/>
883 </xsl:template>
884
885 <xsl:template match="step[not(./title)]" mode="title.markup">
886 <xsl:call-template name="gentext">
887 <xsl:with-param name="key" select="'Step'"/>
888 </xsl:call-template>
889 <xsl:text> </xsl:text>
890 <xsl:apply-templates select="." mode="number"/>
891 </xsl:template>
892
893 <xsl:template match="co" mode="xref-title">
894 <xsl:variable name="title">
895 <xsl:apply-templates select="." mode="callout-bug"/>
896 </xsl:variable>
897
898 <xsl:value-of select="$title"/>
899 </xsl:template>
900
901 <!-- ==================================================================== -->
902
903 <xsl:template match="link" name="link">
904 <xsl:param name="linkend" select="@linkend"/>
905 <xsl:param name="a.target"/>
906 <xsl:param name="xhref" select="@xlink:href"/>
907
908 <xsl:variable name="content">
909 <xsl:call-template name="anchor"/>
910 <xsl:choose>
911 <xsl:when test="count(child::node()) &gt; 0">
912 <!-- If it has content, use it -->
913 <xsl:apply-templates/>
914 </xsl:when>
915 <!-- else look for an endterm -->
916 <xsl:when test="@endterm">
917 <xsl:variable name="etargets" select="key('id',@endterm)"/>
918 <xsl:variable name="etarget" select="$etargets[1]"/>
919 <xsl:choose>
920 <xsl:when test="count($etarget) = 0">
921 <xsl:message>
922 <xsl:value-of select="count($etargets)"/>
923 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
924 <xsl:value-of select="@endterm"/>
925 </xsl:message>
926 <xsl:text>???</xsl:text>
927 </xsl:when>
928 <xsl:otherwise>
929 <xsl:apply-templates select="$etarget" mode="endterm"/>
930 </xsl:otherwise>
931 </xsl:choose>
932 </xsl:when>
933 <!-- Use the xlink:href if no other text -->
934 <xsl:when test="@xlink:href">
935 <xsl:value-of select="@xlink:href"/>
936 </xsl:when>
937 <xsl:otherwise>
938 <xsl:message>
939 <xsl:text>Link element has no content and no Endterm. </xsl:text>
940 <xsl:text>Nothing to show in the link to </xsl:text>
941 <xsl:value-of select="(@xlink:href|@linkend)[1]"/>
942 </xsl:message>
943 <xsl:text>???</xsl:text>
944 </xsl:otherwise>
945 </xsl:choose>
946 </xsl:variable>
947
948 <xsl:call-template name="simple.xlink">
949 <xsl:with-param name="node" select="."/>
950 <xsl:with-param name="linkend" select="$linkend"/>
951 <xsl:with-param name="content" select="$content"/>
952 <xsl:with-param name="a.target" select="$a.target"/>
953 <xsl:with-param name="xhref" select="$xhref"/>
954 </xsl:call-template>
955
956 </xsl:template>
957
958 <xsl:template match="ulink" name="ulink">
959 <xsl:param name="url" select="@url"/>
960 <xsl:variable name="link">
961 <a>
962 <xsl:apply-templates select="." mode="class.attribute"/>
963 <xsl:if test="@id or @xml:id">
964 <xsl:attribute name="name">
965 <xsl:value-of select="(@id|@xml:id)[1]"/>
966 </xsl:attribute>
967 </xsl:if>
968 <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
969 <xsl:if test="$ulink.target != ''">
970 <xsl:attribute name="target">
971 <xsl:value-of select="$ulink.target"/>
972 </xsl:attribute>
973 </xsl:if>
974 <xsl:choose>
975 <xsl:when test="count(child::node())=0">
976 <xsl:value-of select="$url"/>
977 </xsl:when>
978 <xsl:otherwise>
979 <xsl:apply-templates/>
980 </xsl:otherwise>
981 </xsl:choose>
982 </a>
983 </xsl:variable>
984
985 <xsl:choose>
986 <xsl:when test="function-available('suwl:unwrapLinks')">
987 <xsl:copy-of select="suwl:unwrapLinks($link)"/>
988 </xsl:when>
989 <xsl:otherwise>
990 <xsl:copy-of select="$link"/>
991 </xsl:otherwise>
992 </xsl:choose>
993 </xsl:template>
994
995 <xsl:template match="olink" name="olink">
996 <!-- olink content may be passed in from xlink olink -->
997 <xsl:param name="content" select="NOTANELEMENT"/>
998
999 <xsl:call-template name="anchor"/>
1000
1001 <xsl:variable name="localinfo" select="@localinfo"/>
1002
1003 <xsl:choose>
1004 <!-- olinks resolved by stylesheet and target database -->
1005 <xsl:when test="@targetdoc or @targetptr or
1006 (@xlink:role=$xolink.role and
1007 contains(@xlink:href, '#') )" >
1008
1009 <xsl:variable name="targetdoc.att">
1010 <xsl:choose>
1011 <xsl:when test="@targetdoc != ''">
1012 <xsl:value-of select="@targetdoc"/>
1013 </xsl:when>
1014 <xsl:when test="@xlink:role=$xolink.role and
1015 contains(@xlink:href, '#')" >
1016 <xsl:value-of select="substring-before(@xlink:href, '#')"/>
1017 </xsl:when>
1018 </xsl:choose>
1019 </xsl:variable>
1020
1021 <xsl:variable name="targetptr.att">
1022 <xsl:choose>
1023 <xsl:when test="@targetptr != ''">
1024 <xsl:value-of select="@targetptr"/>
1025 </xsl:when>
1026 <xsl:when test="@xlink:role=$xolink.role and
1027 contains(@xlink:href, '#')" >
1028 <xsl:value-of select="substring-after(@xlink:href, '#')"/>
1029 </xsl:when>
1030 </xsl:choose>
1031 </xsl:variable>
1032
1033 <xsl:variable name="olink.lang">
1034 <xsl:call-template name="l10n.language">
1035 <xsl:with-param name="xref-context" select="true()"/>
1036 </xsl:call-template>
1037 </xsl:variable>
1038
1039 <xsl:variable name="target.database.filename">
1040 <xsl:call-template name="select.target.database">
1041 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1042 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1043 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1044 </xsl:call-template>
1045 </xsl:variable>
1046
1047 <xsl:variable name="target.database"
1048 select="document($target.database.filename,/)"/>
1049
1050 <xsl:if test="$olink.debug != 0">
1051 <xsl:message>
1052 <xsl:text>Olink debug: root element of target.database '</xsl:text>
1053 <xsl:value-of select="$target.database.filename"/>
1054 <xsl:text>' is '</xsl:text>
1055 <xsl:value-of select="local-name($target.database/*[1])"/>
1056 <xsl:text>'.</xsl:text>
1057 </xsl:message>
1058 </xsl:if>
1059
1060 <xsl:variable name="olink.key">
1061 <xsl:call-template name="select.olink.key">
1062 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1063 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1064 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1065 <xsl:with-param name="target.database" select="$target.database"/>
1066 </xsl:call-template>
1067 </xsl:variable>
1068
1069 <xsl:if test="string-length($olink.key) = 0">
1070 <xsl:message>
1071 <xsl:text>Error: unresolved olink: </xsl:text>
1072 <xsl:text>targetdoc/targetptr = '</xsl:text>
1073 <xsl:value-of select="$targetdoc.att"/>
1074 <xsl:text>/</xsl:text>
1075 <xsl:value-of select="$targetptr.att"/>
1076 <xsl:text>'.</xsl:text>
1077 </xsl:message>
1078 </xsl:if>
1079
1080 <xsl:variable name="href">
1081 <xsl:call-template name="make.olink.href">
1082 <xsl:with-param name="olink.key" select="$olink.key"/>
1083 <xsl:with-param name="target.database" select="$target.database"/>
1084 </xsl:call-template>
1085 </xsl:variable>
1086
1087 <xsl:variable name="hottext">
1088 <xsl:choose>
1089 <xsl:when test="$content">
1090 <xsl:copy-of select="$content"/>
1091 </xsl:when>
1092 <xsl:otherwise>
1093 <xsl:call-template name="olink.hottext">
1094 <xsl:with-param name="olink.key" select="$olink.key"/>
1095 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1096 <xsl:with-param name="target.database" select="$target.database"/>
1097 </xsl:call-template>
1098 </xsl:otherwise>
1099 </xsl:choose>
1100 </xsl:variable>
1101
1102 <xsl:variable name="olink.docname.citation">
1103 <xsl:call-template name="olink.document.citation">
1104 <xsl:with-param name="olink.key" select="$olink.key"/>
1105 <xsl:with-param name="target.database" select="$target.database"/>
1106 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1107 </xsl:call-template>
1108 </xsl:variable>
1109
1110 <xsl:variable name="olink.page.citation">
1111 <xsl:call-template name="olink.page.citation">
1112 <xsl:with-param name="olink.key" select="$olink.key"/>
1113 <xsl:with-param name="target.database" select="$target.database"/>
1114 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1115 </xsl:call-template>
1116 </xsl:variable>
1117
1118 <xsl:choose>
1119 <xsl:when test="$href != ''">
1120 <a href="{$href}">
1121 <xsl:apply-templates select="." mode="class.attribute"/>
1122 <xsl:copy-of select="$hottext"/>
1123 </a>
1124 <xsl:copy-of select="$olink.page.citation"/>
1125 <xsl:copy-of select="$olink.docname.citation"/>
1126 </xsl:when>
1127 <xsl:otherwise>
1128 <span class="olink"><xsl:copy-of select="$hottext"/></span>
1129 <xsl:copy-of select="$olink.page.citation"/>
1130 <xsl:copy-of select="$olink.docname.citation"/>
1131 </xsl:otherwise>
1132 </xsl:choose>
1133
1134 </xsl:when>
1135
1136 <!-- Or use old olink mechanism -->
1137 <xsl:otherwise>
1138 <xsl:variable name="href">
1139 <xsl:choose>
1140 <xsl:when test="@linkmode">
1141 <!-- use the linkmode to get the base URI, use localinfo as fragid -->
1142 <xsl:variable name="modespec" select="key('id',@linkmode)"/>
1143 <xsl:if test="count($modespec) != 1
1144 or local-name($modespec) != 'modespec'">
1145 <xsl:message>Warning: olink linkmode pointer is wrong.</xsl:message>
1146 </xsl:if>
1147 <xsl:value-of select="$modespec"/>
1148 <xsl:if test="@localinfo">
1149 <xsl:text>#</xsl:text>
1150 <xsl:value-of select="@localinfo"/>
1151 </xsl:if>
1152 </xsl:when>
1153 <xsl:when test="@type = 'href'">
1154 <xsl:call-template name="olink.outline">
1155 <xsl:with-param name="outline.base.uri"
1156 select="unparsed-entity-uri(@targetdocent)"/>
1157 <xsl:with-param name="localinfo" select="@localinfo"/>
1158 <xsl:with-param name="return" select="'href'"/>
1159 </xsl:call-template>
1160 </xsl:when>
1161 <xsl:otherwise>
1162 <xsl:value-of select="$olink.resolver"/>
1163 <xsl:text>?</xsl:text>
1164 <xsl:value-of select="$olink.sysid"/>
1165 <xsl:value-of select="unparsed-entity-uri(@targetdocent)"/>
1166 <!-- XSL gives no access to the public identifier (grumble...) -->
1167 <xsl:if test="@localinfo">
1168 <xsl:text>&amp;</xsl:text>
1169 <xsl:value-of select="$olink.fragid"/>
1170 <xsl:value-of select="@localinfo"/>
1171 </xsl:if>
1172 </xsl:otherwise>
1173 </xsl:choose>
1174 </xsl:variable>
1175
1176 <xsl:choose>
1177 <xsl:when test="$href != ''">
1178 <a href="{$href}">
1179 <xsl:apply-templates select="." mode="class.attribute"/>
1180 <xsl:call-template name="olink.hottext"/>
1181 </a>
1182 </xsl:when>
1183 <xsl:otherwise>
1184 <xsl:call-template name="olink.hottext"/>
1185 </xsl:otherwise>
1186 </xsl:choose>
1187 </xsl:otherwise>
1188 </xsl:choose>
1189 </xsl:template>
1190
1191 <xsl:template match="*" mode="pagenumber.markup">
1192 <!-- no-op in HTML -->
1193 </xsl:template>
1194
1195
1196 <xsl:template name="olink.outline">
1197 <xsl:param name="outline.base.uri"/>
1198 <xsl:param name="localinfo"/>
1199 <xsl:param name="return" select="href"/>
1200
1201 <xsl:variable name="outline-file"
1202 select="concat($outline.base.uri,
1203 $olink.outline.ext)"/>
1204
1205 <xsl:variable name="outline" select="document($outline-file,.)/div"/>
1206
1207 <xsl:variable name="node-href">
1208 <xsl:choose>
1209 <xsl:when test="$localinfo != ''">
1210 <xsl:variable name="node" select="$outline//
1211 *[@id=$localinfo or @xml:id=$localinfo]"/>
1212 <xsl:value-of select="$node/@href"/>
1213 </xsl:when>
1214 <xsl:otherwise>
1215 <xsl:value-of select="$outline/@href"/>
1216 </xsl:otherwise>
1217 </xsl:choose>
1218 </xsl:variable>
1219
1220 <xsl:variable name="node-xref">
1221 <xsl:choose>
1222 <xsl:when test="$localinfo != ''">
1223 <xsl:variable name="node" select="$outline//
1224 *[@id=$localinfo or @xml:id=$localinfo]"/>
1225 <xsl:copy-of select="$node/xref"/>
1226 </xsl:when>
1227 <xsl:otherwise>
1228 <xsl:value-of select="$outline/xref"/>
1229 </xsl:otherwise>
1230 </xsl:choose>
1231 </xsl:variable>
1232
1233 <xsl:choose>
1234 <xsl:when test="$return = 'href'">
1235 <xsl:value-of select="$node-href"/>
1236 </xsl:when>
1237 <xsl:when test="$return = 'xref'">
1238 <xsl:value-of select="$node-xref"/>
1239 </xsl:when>
1240 <xsl:otherwise>
1241 <xsl:copy-of select="$node-xref"/>
1242 </xsl:otherwise>
1243 </xsl:choose>
1244 </xsl:template>
1245
1246 <!-- ==================================================================== -->
1247
1248 <xsl:template name="xref.xreflabel">
1249 <!-- called to process an xreflabel...you might use this to make -->
1250 <!-- xreflabels come out in the right font for different targets, -->
1251 <!-- for example. -->
1252 <xsl:param name="target" select="."/>
1253 <xsl:value-of select="$target/@xreflabel"/>
1254 </xsl:template>
1255
1256 <!-- ==================================================================== -->
1257
1258 <xsl:template match="title" mode="xref">
1259 <xsl:apply-templates/>
1260 </xsl:template>
1261
1262 <xsl:template match="command" mode="xref">
1263 <xsl:call-template name="inline.boldseq"/>
1264 </xsl:template>
1265
1266 <xsl:template match="function" mode="xref">
1267 <xsl:call-template name="inline.monoseq"/>
1268 </xsl:template>
1269
1270 <!-- ==================================================================== -->
1271
1272 <xsl:template match="*" mode="insert.title.markup">
1273 <xsl:param name="purpose"/>
1274 <xsl:param name="xrefstyle"/>
1275 <xsl:param name="title"/>
1276
1277 <xsl:choose>
1278 <!-- FIXME: what about the case where titleabbrev is inside the info? -->
1279 <xsl:when test="$purpose = 'xref' and titleabbrev">
1280 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
1281 </xsl:when>
1282 <xsl:otherwise>
1283 <xsl:copy-of select="$title"/>
1284 </xsl:otherwise>
1285 </xsl:choose>
1286 </xsl:template>
1287
1288 <xsl:template match="chapter|appendix" mode="insert.title.markup">
1289 <xsl:param name="purpose"/>
1290 <xsl:param name="xrefstyle"/>
1291 <xsl:param name="title"/>
1292
1293 <xsl:choose>
1294 <xsl:when test="$purpose = 'xref'">
1295 <i>
1296 <xsl:copy-of select="$title"/>
1297 </i>
1298 </xsl:when>
1299 <xsl:otherwise>
1300 <xsl:copy-of select="$title"/>
1301 </xsl:otherwise>
1302 </xsl:choose>
1303 </xsl:template>
1304
1305 <xsl:template match="*" mode="insert.subtitle.markup">
1306 <xsl:param name="purpose"/>
1307 <xsl:param name="xrefstyle"/>
1308 <xsl:param name="subtitle"/>
1309
1310 <xsl:copy-of select="$subtitle"/>
1311 </xsl:template>
1312
1313 <xsl:template match="*" mode="insert.label.markup">
1314 <xsl:param name="purpose"/>
1315 <xsl:param name="xrefstyle"/>
1316 <xsl:param name="label"/>
1317
1318 <xsl:copy-of select="$label"/>
1319 </xsl:template>
1320
1321 <xsl:template match="*" mode="insert.pagenumber.markup">
1322 <xsl:param name="purpose"/>
1323 <xsl:param name="xrefstyle"/>
1324 <xsl:param name="pagenumber"/>
1325
1326 <xsl:copy-of select="$pagenumber"/>
1327 </xsl:template>
1328
1329 <xsl:template match="*" mode="insert.direction.markup">
1330 <xsl:param name="purpose"/>
1331 <xsl:param name="xrefstyle"/>
1332 <xsl:param name="direction"/>
1333
1334 <xsl:copy-of select="$direction"/>
1335 </xsl:template>
1336
1337 <xsl:template match="*" mode="insert.olink.docname.markup">
1338 <xsl:param name="purpose"/>
1339 <xsl:param name="xrefstyle"/>
1340 <xsl:param name="docname"/>
1341
1342 <span class="olinkdocname">
1343 <xsl:copy-of select="$docname"/>
1344 </span>
1345
1346 </xsl:template>
1347
1348 </xsl:stylesheet>