source: stylesheets/lfs-xsl/docbook-xsl-snapshot/fo/xref.xsl@ fd7e0ed6

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since fd7e0ed6 was fd7e0ed6, checked in by Randy McMurchy <randy@…>, 16 years ago

Changed all lines with nothing but whitespace to blank lines

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@7429 af4574ff-66df-0310-9fd7-8a98e5e911e0

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