source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/xref.xsl@ 92669b0

Last change on this file since 92669b0 was 67300de, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Create a clfs-1.1 branch in preperation for a RC.

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