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 xlink"
9 <!-- ********************************************************************
10 $Id: xref.xsl 8398 2009-04-07 14:40:25Z dcramer $
11 ********************************************************************
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.
17 ******************************************************************** -->
19 <!-- Use internal variable for olink xlink role for consistency -->
21 name="xolink.role">http://docbook.org/xlink/role/olink</xsl:variable>
23 <!-- ==================================================================== -->
25 <xsl:template match="anchor">
26 <xsl:variable name="id">
27 <xsl:call-template name="object.id"/>
29 <fo:inline id="{$id}"/>
32 <!-- ==================================================================== -->
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 or starts-with($xhref, '#xpointer(id('))">
41 <xsl:call-template name="xpointer.idref">
42 <xsl:with-param name="xpointer" select="$xhref"/>
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)"/>
51 <xsl:variable name="xrefstyle">
53 <xsl:when test="@role and not(@xrefstyle)
54 and $use.role.as.xrefstyle != 0">
55 <xsl:value-of select="@role"/>
58 <xsl:value-of select="@xrefstyle"/>
63 <xsl:variable name="content">
64 <fo:inline xsl:use-attribute-sets="xref.properties">
66 <xsl:when test="@endterm">
67 <xsl:variable name="etargets" select="key('id',@endterm)"/>
68 <xsl:variable name="etarget" select="$etargets[1]"/>
70 <xsl:when test="count($etarget) = 0">
72 <xsl:value-of select="count($etargets)"/>
73 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
74 <xsl:value-of select="@endterm"/>
76 <xsl:text>???</xsl:text>
79 <xsl:apply-templates select="$etarget" mode="endterm"/>
84 <xsl:when test="$target/@xreflabel">
85 <xsl:call-template name="xref.xreflabel">
86 <xsl:with-param name="target" select="$target"/>
90 <xsl:when test="$target">
91 <xsl:if test="not(parent::citation)">
92 <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
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>
100 <xsl:if test="not(parent::citation)">
101 <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
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>
110 <xsl:text>???</xsl:text>
116 <!-- Convert it into an active link -->
117 <xsl:call-template name="simple.xlink">
118 <xsl:with-param name="content" select="$content"/>
121 <!-- Add standard page reference? -->
123 <xsl:when test="not($target)">
124 <!-- page numbers only for local targets -->
126 <xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')
127 and contains($xrefstyle, 'nopage')">
128 <!-- negative xrefstyle in instance turns it off -->
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' and
138 <xsl:apply-templates select="$target" mode="page.citation">
139 <xsl:with-param name="id" select="$target/@id|$target/@xml:id"/>
140 </xsl:apply-templates>
145 <!-- ==================================================================== -->
147 <!-- Handled largely like an xref -->
148 <!-- To be done: add support for begin, end, and units attributes -->
149 <xsl:template match="biblioref" name="biblioref">
150 <xsl:variable name="targets" select="key('id',@linkend)"/>
151 <xsl:variable name="target" select="$targets[1]"/>
152 <xsl:variable name="refelem" select="local-name($target)"/>
154 <xsl:call-template name="check.id.unique">
155 <xsl:with-param name="linkend" select="@linkend"/>
159 <xsl:when test="$refelem=''">
161 <xsl:text>XRef to nonexistent id: </xsl:text>
162 <xsl:value-of select="@linkend"/>
164 <xsl:text>???</xsl:text>
167 <xsl:when test="@endterm">
168 <fo:basic-link internal-destination="{@linkend}"
169 xsl:use-attribute-sets="xref.properties">
170 <xsl:variable name="etargets" select="key('id',@endterm)"/>
171 <xsl:variable name="etarget" select="$etargets[1]"/>
173 <xsl:when test="count($etarget) = 0">
175 <xsl:value-of select="count($etargets)"/>
176 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
177 <xsl:value-of select="@endterm"/>
179 <xsl:text>???</xsl:text>
182 <xsl:apply-templates select="$etarget" mode="endterm"/>
188 <xsl:when test="$target/@xreflabel">
189 <fo:basic-link internal-destination="{@linkend}"
190 xsl:use-attribute-sets="xref.properties">
191 <xsl:call-template name="xref.xreflabel">
192 <xsl:with-param name="target" select="$target"/>
198 <xsl:if test="not(parent::citation)">
199 <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
202 <fo:basic-link internal-destination="{@linkend}"
203 xsl:use-attribute-sets="xref.properties">
204 <xsl:apply-templates select="$target" mode="xref-to">
205 <xsl:with-param name="referrer" select="."/>
206 <xsl:with-param name="xrefstyle">
208 <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
209 <xsl:value-of select="@role"/>
212 <xsl:value-of select="@xrefstyle"/>
216 </xsl:apply-templates>
219 <xsl:if test="not(parent::citation)">
220 <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
227 <!-- ==================================================================== -->
229 <xsl:template match="*" mode="endterm">
230 <!-- Process the children of the endterm element -->
231 <xsl:variable name="endterm">
232 <xsl:apply-templates select="child::node()"/>
236 <xsl:when test="$exsl.node.set.available != 0">
237 <xsl:apply-templates select="exsl:node-set($endterm)" mode="remove-ids"/>
240 <xsl:copy-of select="$endterm"/>
245 <xsl:template match="*" mode="remove-ids">
247 <xsl:for-each select="@*">
249 <xsl:when test="name(.) != 'id'">
253 <xsl:message>removing <xsl:value-of select="name(.)"/></xsl:message>
257 <xsl:apply-templates mode="remove-ids"/>
261 <!--- ==================================================================== -->
263 <xsl:template match="*" mode="xref-to-prefix"/>
264 <xsl:template match="*" mode="xref-to-suffix"/>
266 <xsl:template match="*" mode="xref-to">
267 <xsl:param name="referrer"/>
268 <xsl:param name="xrefstyle"/>
269 <xsl:param name="verbose" select="1"/>
272 <xsl:if test="$verbose != 0">
274 <xsl:text>Don't know what gentext to create for xref to: "</xsl:text>
275 <xsl:value-of select="name(.)"/>
276 <xsl:text>"</xsl:text>
278 <xsl:text>???</xsl:text>
282 <xsl:template match="title" mode="xref-to">
283 <xsl:param name="referrer"/>
284 <xsl:param name="xrefstyle"/>
285 <xsl:param name="verbose" select="1"/>
287 <!-- if you xref to a title, xref to the parent... -->
289 <!-- FIXME: how reliable is this? -->
290 <xsl:when test="contains(local-name(parent::*), 'info')">
291 <xsl:apply-templates select="parent::*[2]" mode="xref-to">
292 <xsl:with-param name="referrer" select="$referrer"/>
293 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
294 <xsl:with-param name="verbose" select="$verbose"/>
295 </xsl:apply-templates>
298 <xsl:apply-templates select="parent::*" mode="xref-to">
299 <xsl:with-param name="referrer" select="$referrer"/>
300 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
301 <xsl:with-param name="verbose" select="$verbose"/>
302 </xsl:apply-templates>
307 <xsl:template match="abstract|article|authorblurb|bibliodiv|bibliomset
308 |biblioset|blockquote|calloutlist|caution|colophon
309 |constraintdef|formalpara|glossdiv|important|indexdiv
310 |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain
311 |msgrel|msgset|msgsub|note|orderedlist|partintro
312 |productionset|qandadiv|refsynopsisdiv|segmentedlist
313 |set|setindex|sidebar|tip|toc|variablelist|warning"
315 <xsl:param name="referrer"/>
316 <xsl:param name="xrefstyle"/>
317 <xsl:param name="verbose" select="1"/>
319 <!-- catch-all for things with (possibly optional) titles -->
320 <xsl:apply-templates select="." mode="object.xref.markup">
321 <xsl:with-param name="purpose" select="'xref'"/>
322 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
323 <xsl:with-param name="referrer" select="$referrer"/>
324 <xsl:with-param name="verbose" select="$verbose"/>
325 </xsl:apply-templates>
328 <xsl:template match="author|editor|othercredit|personname" mode="xref-to">
329 <xsl:param name="referrer"/>
330 <xsl:param name="xrefstyle"/>
331 <xsl:param name="verbose" select="1"/>
333 <xsl:call-template name="person.name"/>
336 <xsl:template match="authorgroup" mode="xref-to">
337 <xsl:param name="referrer"/>
338 <xsl:param name="xrefstyle"/>
339 <xsl:param name="verbose" select="1"/>
341 <xsl:call-template name="person.name.list"/>
344 <xsl:template match="figure|example|table|equation" mode="xref-to">
345 <xsl:param name="referrer"/>
346 <xsl:param name="xrefstyle"/>
347 <xsl:param name="verbose" select="1"/>
349 <xsl:apply-templates select="." mode="object.xref.markup">
350 <xsl:with-param name="purpose" select="'xref'"/>
351 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
352 <xsl:with-param name="referrer" select="$referrer"/>
353 <xsl:with-param name="verbose" select="$verbose"/>
354 </xsl:apply-templates>
357 <xsl:template match="procedure" mode="xref-to">
358 <xsl:param name="referrer"/>
359 <xsl:param name="xrefstyle"/>
360 <xsl:param name="verbose"/>
362 <xsl:apply-templates select="." mode="object.xref.markup">
363 <xsl:with-param name="purpose" select="'xref'"/>
364 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
365 <xsl:with-param name="referrer" select="$referrer"/>
366 <xsl:with-param name="verbose" select="$verbose"/>
367 </xsl:apply-templates>
370 <xsl:template match="task" mode="xref-to">
371 <xsl:param name="referrer"/>
372 <xsl:param name="xrefstyle"/>
373 <xsl:param name="verbose"/>
375 <xsl:apply-templates select="." mode="object.xref.markup">
376 <xsl:with-param name="purpose" select="'xref'"/>
377 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
378 <xsl:with-param name="referrer" select="$referrer"/>
379 <xsl:with-param name="verbose" select="$verbose"/>
380 </xsl:apply-templates>
383 <xsl:template match="cmdsynopsis" mode="xref-to">
384 <xsl:param name="referrer"/>
385 <xsl:param name="xrefstyle"/>
386 <xsl:param name="verbose" select="1"/>
388 <xsl:apply-templates select="(.//command)[1]" mode="xref"/>
391 <xsl:template match="funcsynopsis" mode="xref-to">
392 <xsl:param name="referrer"/>
393 <xsl:param name="xrefstyle"/>
394 <xsl:param name="verbose" select="1"/>
396 <xsl:apply-templates select="(.//function)[1]" mode="xref"/>
399 <xsl:template match="dedication|acknowledgements|preface|chapter|appendix" mode="xref-to">
400 <xsl:param name="referrer"/>
401 <xsl:param name="xrefstyle"/>
402 <xsl:param name="verbose" select="1"/>
404 <xsl:apply-templates select="." mode="object.xref.markup">
405 <xsl:with-param name="purpose" select="'xref'"/>
406 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
407 <xsl:with-param name="referrer" select="$referrer"/>
408 <xsl:with-param name="verbose" select="$verbose"/>
409 </xsl:apply-templates>
412 <xsl:template match="bibliography" mode="xref-to">
413 <xsl:param name="referrer"/>
414 <xsl:param name="xrefstyle"/>
415 <xsl:param name="verbose" select="1"/>
417 <xsl:apply-templates select="." mode="object.xref.markup">
418 <xsl:with-param name="purpose" select="'xref'"/>
419 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
420 <xsl:with-param name="referrer" select="$referrer"/>
421 <xsl:with-param name="verbose" select="$verbose"/>
422 </xsl:apply-templates>
425 <xsl:template match="biblioentry|bibliomixed" mode="xref-to-prefix">
426 <xsl:text>[</xsl:text>
429 <xsl:template match="biblioentry|bibliomixed" mode="xref-to-suffix">
430 <xsl:text>]</xsl:text>
433 <xsl:template match="biblioentry|bibliomixed" mode="xref-to">
434 <xsl:param name="referrer"/>
435 <xsl:param name="xrefstyle"/>
436 <xsl:param name="verbose" select="1"/>
438 <!-- handles both biblioentry and bibliomixed -->
440 <xsl:when test="string(.) = ''">
441 <xsl:variable name="bib" select="document($bibliography.collection,.)"/>
442 <xsl:variable name="id" select="(@id|@xml:id)[1]"/>
443 <xsl:variable name="entry" select="$bib/bibliography/
444 *[@id=$id or @xml:id=$id][1]"/>
446 <xsl:when test="$entry">
448 <xsl:when test="$bibliography.numbered != 0">
449 <xsl:number from="bibliography" count="biblioentry|bibliomixed"
450 level="any" format="1"/>
452 <xsl:when test="local-name($entry/*[1]) = 'abbrev'">
453 <xsl:apply-templates select="$entry/*[1]"/>
456 <xsl:value-of select="(@id|@xml:id)[1]"/>
462 <xsl:text>No bibliography entry: </xsl:text>
463 <xsl:value-of select="$id"/>
464 <xsl:text> found in </xsl:text>
465 <xsl:value-of select="$bibliography.collection"/>
467 <xsl:value-of select="(@id|@xml:id)[1]"/>
473 <xsl:when test="$bibliography.numbered != 0">
474 <xsl:number from="bibliography" count="biblioentry|bibliomixed"
475 level="any" format="1"/>
477 <xsl:when test="local-name(*[1]) = 'abbrev'">
478 <xsl:apply-templates select="*[1]"/>
481 <xsl:value-of select="(@id|@xml:id)[1]"/>
488 <xsl:template match="glossary" mode="xref-to">
489 <xsl:param name="referrer"/>
490 <xsl:param name="xrefstyle"/>
491 <xsl:param name="verbose" select="1"/>
493 <xsl:apply-templates select="." mode="object.xref.markup">
494 <xsl:with-param name="purpose" select="'xref'"/>
495 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
496 <xsl:with-param name="referrer" select="$referrer"/>
497 <xsl:with-param name="verbose" select="$verbose"/>
498 </xsl:apply-templates>
501 <xsl:template match="glossentry" mode="xref-to">
503 <xsl:when test="$glossentry.show.acronym = 'primary'">
505 <xsl:when test="acronym|abbrev">
506 <xsl:apply-templates select="(acronym|abbrev)[1]"/>
509 <xsl:apply-templates select="glossterm[1]" mode="xref-to"/>
514 <xsl:apply-templates select="glossterm[1]" mode="xref-to"/>
519 <xsl:template match="glossterm|firstterm" mode="xref-to">
520 <xsl:apply-templates/>
523 <xsl:template match="index" mode="xref-to">
524 <xsl:param name="referrer"/>
525 <xsl:param name="xrefstyle"/>
526 <xsl:param name="verbose" select="1"/>
528 <xsl:apply-templates select="." mode="object.xref.markup">
529 <xsl:with-param name="purpose" select="'xref'"/>
530 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
531 <xsl:with-param name="referrer" select="$referrer"/>
532 <xsl:with-param name="verbose" select="$verbose"/>
533 </xsl:apply-templates>
536 <xsl:template match="listitem" mode="xref-to">
537 <xsl:param name="referrer"/>
538 <xsl:param name="xrefstyle"/>
539 <xsl:param name="verbose" select="1"/>
541 <xsl:apply-templates select="." mode="object.xref.markup">
542 <xsl:with-param name="purpose" select="'xref'"/>
543 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
544 <xsl:with-param name="referrer" select="$referrer"/>
545 <xsl:with-param name="verbose" select="$verbose"/>
546 </xsl:apply-templates>
549 <xsl:template match="section|simplesect
550 |sect1|sect2|sect3|sect4|sect5
551 |refsect1|refsect2|refsect3|refsection" mode="xref-to">
552 <xsl:param name="referrer"/>
553 <xsl:param name="xrefstyle"/>
554 <xsl:param name="verbose" select="1"/>
556 <xsl:apply-templates select="." mode="object.xref.markup">
557 <xsl:with-param name="purpose" select="'xref'"/>
558 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
559 <xsl:with-param name="referrer" select="$referrer"/>
560 <xsl:with-param name="verbose" select="$verbose"/>
561 </xsl:apply-templates>
562 <!-- What about "in Chapter X"? -->
565 <xsl:template match="bridgehead" mode="xref-to">
566 <xsl:param name="referrer"/>
567 <xsl:param name="xrefstyle"/>
568 <xsl:param name="verbose" select="1"/>
570 <xsl:apply-templates select="." mode="object.xref.markup">
571 <xsl:with-param name="purpose" select="'xref'"/>
572 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
573 <xsl:with-param name="referrer" select="$referrer"/>
574 <xsl:with-param name="verbose" select="$verbose"/>
575 </xsl:apply-templates>
576 <!-- What about "in Chapter X"? -->
579 <xsl:template match="qandaset" mode="xref-to">
580 <xsl:param name="referrer"/>
581 <xsl:param name="xrefstyle"/>
582 <xsl:param name="verbose" select="1"/>
584 <xsl:apply-templates select="." mode="object.xref.markup">
585 <xsl:with-param name="purpose" select="'xref'"/>
586 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
587 <xsl:with-param name="referrer" select="$referrer"/>
588 <xsl:with-param name="verbose" select="$verbose"/>
589 </xsl:apply-templates>
592 <xsl:template match="qandadiv" mode="xref-to">
593 <xsl:param name="referrer"/>
594 <xsl:param name="xrefstyle"/>
595 <xsl:param name="verbose" select="1"/>
597 <xsl:apply-templates select="." mode="object.xref.markup">
598 <xsl:with-param name="purpose" select="'xref'"/>
599 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
600 <xsl:with-param name="referrer" select="$referrer"/>
601 <xsl:with-param name="verbose" select="$verbose"/>
602 </xsl:apply-templates>
605 <xsl:template match="qandaentry" mode="xref-to">
606 <xsl:param name="referrer"/>
607 <xsl:param name="xrefstyle"/>
608 <xsl:param name="verbose" select="1"/>
610 <xsl:apply-templates select="question[1]" mode="xref-to">
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>
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"/>
623 <xsl:when test="string-length(label) != 0">
624 <xsl:apply-templates select="." mode="label.markup"/>
627 <xsl:apply-templates select="." mode="object.xref.markup">
628 <xsl:with-param name="purpose" select="'xref'"/>
629 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
630 <xsl:with-param name="referrer" select="$referrer"/>
631 <xsl:with-param name="verbose" select="$verbose"/>
632 </xsl:apply-templates>
637 <xsl:template match="part|reference" mode="xref-to">
638 <xsl:param name="referrer"/>
639 <xsl:param name="xrefstyle"/>
640 <xsl:param name="verbose" select="1"/>
642 <xsl:apply-templates select="." mode="object.xref.markup">
643 <xsl:with-param name="purpose" select="'xref'"/>
644 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
645 <xsl:with-param name="referrer" select="$referrer"/>
646 <xsl:with-param name="verbose" select="$verbose"/>
647 </xsl:apply-templates>
650 <xsl:template match="refentry" mode="xref-to">
651 <xsl:param name="referrer"/>
652 <xsl:param name="xrefstyle"/>
653 <xsl:param name="verbose" select="1"/>
656 <xsl:when test="refmeta/refentrytitle">
657 <xsl:apply-templates select="refmeta/refentrytitle"/>
660 <xsl:apply-templates select="refnamediv/refname[1]"/>
663 <xsl:apply-templates select="refmeta/manvolnum"/>
666 <xsl:template match="refnamediv" mode="xref-to">
667 <xsl:param name="referrer"/>
668 <xsl:param name="xrefstyle"/>
669 <xsl:param name="verbose" select="1"/>
671 <xsl:apply-templates select="refname[1]" mode="xref-to">
672 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
673 <xsl:with-param name="referrer" select="$referrer"/>
674 <xsl:with-param name="verbose" select="$verbose"/>
675 </xsl:apply-templates>
678 <xsl:template match="refname" mode="xref-to">
679 <xsl:param name="referrer"/>
680 <xsl:param name="xrefstyle"/>
681 <xsl:param name="verbose" select="1"/>
683 <xsl:apply-templates mode="xref-to">
684 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
685 <xsl:with-param name="referrer" select="$referrer"/>
686 <xsl:with-param name="verbose" select="$verbose"/>
687 </xsl:apply-templates>
690 <xsl:template match="step" mode="xref-to">
691 <xsl:param name="referrer"/>
692 <xsl:param name="xrefstyle"/>
693 <xsl:param name="verbose" select="1"/>
695 <xsl:call-template name="gentext">
696 <xsl:with-param name="key" select="'Step'"/>
698 <xsl:text> </xsl:text>
699 <xsl:apply-templates select="." mode="number"/>
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"/>
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>
714 <xsl:template match="varlistentry/term" mode="xref-to">
715 <xsl:param name="verbose" select="1"/>
716 <!-- to avoid the comma that will be generated if there are several terms -->
717 <xsl:apply-templates/>
720 <xsl:template match="co" mode="xref-to">
721 <xsl:param name="referrer"/>
722 <xsl:param name="xrefstyle"/>
723 <xsl:param name="verbose" select="1"/>
725 <xsl:apply-templates select="." mode="callout-bug"/>
728 <xsl:template match="area|areaset" mode="xref-to">
729 <xsl:param name="referrer"/>
730 <xsl:param name="xrefstyle"/>
732 <xsl:call-template name="callout-bug">
733 <xsl:with-param name="conum">
734 <xsl:apply-templates select="." mode="conumber"/>
739 <xsl:template match="book" mode="xref-to">
740 <xsl:param name="referrer"/>
741 <xsl:param name="xrefstyle"/>
742 <xsl:param name="verbose" select="1"/>
744 <xsl:apply-templates select="." mode="object.xref.markup">
745 <xsl:with-param name="purpose" select="'xref'"/>
746 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
747 <xsl:with-param name="referrer" select="$referrer"/>
748 <xsl:with-param name="verbose" select="$verbose"/>
749 </xsl:apply-templates>
752 <!-- These are elements for which no link text exists, so an xref to one
753 uses the xrefstyle attribute if specified, or if not it falls back
754 to the container element's link text -->
755 <xsl:template match="para|phrase|simpara|anchor|quote" mode="xref-to">
756 <xsl:param name="referrer"/>
757 <xsl:param name="xrefstyle"/>
758 <xsl:param name="verbose"/>
760 <xsl:variable name="context" select="(ancestor::simplesect
767 |ancestor::refsection
775 |ancestor::dedication
776 |ancestor::acknowledgements
778 |ancestor::bibliography
781 |ancestor::glossentry
783 |ancestor::varlistentry)[last()]"/>
786 <xsl:when test="$xrefstyle != ''">
787 <xsl:apply-templates select="." mode="object.xref.markup">
788 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
789 <xsl:with-param name="referrer" select="$referrer"/>
790 <xsl:with-param name="verbose" select="$verbose"/>
791 </xsl:apply-templates>
794 <xsl:apply-templates select="$context" mode="xref-to">
795 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
796 <xsl:with-param name="referrer" select="$referrer"/>
797 <xsl:with-param name="verbose" select="$verbose"/>
798 </xsl:apply-templates>
803 <xsl:template match="indexterm" mode="xref-to">
804 <xsl:value-of select="primary"/>
807 <xsl:template match="primary|secondary|tertiary" mode="xref-to">
808 <xsl:value-of select="."/>
811 <!-- ==================================================================== -->
813 <xsl:template match="link" name="link">
814 <xsl:param name="linkend" select="@linkend"/>
815 <xsl:param name="targets" select="key('id',$linkend)"/>
816 <xsl:param name="target" select="$targets[1]"/>
818 <xsl:variable name="xrefstyle">
820 <xsl:when test="@role and not(@xrefstyle)
821 and $use.role.as.xrefstyle != 0">
822 <xsl:value-of select="@role"/>
825 <xsl:value-of select="@xrefstyle"/>
830 <xsl:variable name="content">
831 <fo:inline xsl:use-attribute-sets="xref.properties">
833 <xsl:when test="count(child::node()) > 0">
834 <!-- If it has content, use it -->
835 <xsl:apply-templates/>
837 <!-- look for an endterm -->
838 <xsl:when test="@endterm">
839 <xsl:variable name="etargets" select="key('id',@endterm)"/>
840 <xsl:variable name="etarget" select="$etargets[1]"/>
842 <xsl:when test="count($etarget) = 0">
844 <xsl:value-of select="count($etargets)"/>
845 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
846 <xsl:value-of select="@endterm"/>
848 <xsl:text>???</xsl:text>
851 <xsl:apply-templates select="$etarget" mode="endterm"/>
855 <!-- Use the xlink:href if no other text -->
856 <xsl:when test="@xlink:href">
857 <xsl:call-template name="hyphenate-url">
858 <xsl:with-param name="url" select="@xlink:href"/>
863 <xsl:text>Link element has no content and no Endterm. </xsl:text>
864 <xsl:text>Nothing to show in the link to </xsl:text>
865 <xsl:value-of select="$target"/>
867 <xsl:text>???</xsl:text>
873 <xsl:call-template name="simple.xlink">
874 <xsl:with-param name="node" select="."/>
875 <xsl:with-param name="linkend" select="$linkend"/>
876 <xsl:with-param name="content" select="$content"/>
879 <!-- Add standard page reference? -->
881 <!-- page numbering on link only enabled for @linkend -->
882 <!-- There is no link element in DB5 with xlink:href -->
883 <xsl:when test="not($linkend)">
885 <!-- negative xrefstyle in instance turns it off -->
886 <xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')
887 and contains($xrefstyle, 'nopage')">
889 <xsl:when test="(starts-with(normalize-space($xrefstyle), 'select:')
890 and $insert.link.page.number = 'maybe'
891 and (contains($xrefstyle, 'page')
892 or contains($xrefstyle, 'Page')))
893 or ( $insert.link.page.number = 'yes'
894 or $insert.link.page.number = '1')
895 or local-name($target) = 'para'">
896 <xsl:apply-templates select="$target" mode="page.citation">
897 <xsl:with-param name="id" select="$linkend"/>
898 </xsl:apply-templates>
903 <xsl:template match="ulink" name="ulink">
904 <xsl:param name="url" select="@url"/>
906 <xsl:variable name ="ulink.url">
907 <xsl:call-template name="fo-external-image">
908 <xsl:with-param name="filename" select="$url"/>
912 <fo:basic-link xsl:use-attribute-sets="xref.properties"
913 external-destination="{$ulink.url}">
915 <xsl:when test="count(child::node())=0">
916 <xsl:call-template name="hyphenate-url">
917 <xsl:with-param name="url" select="$url"/>
921 <xsl:apply-templates/>
925 <!-- * Call the template for determining whether the URL for this -->
926 <!-- * hyperlink is displayed, and how to display it (either inline or -->
927 <!-- * as a numbered footnote). -->
928 <xsl:call-template name="hyperlink.url.display">
929 <xsl:with-param name="url" select="$url"/>
930 <xsl:with-param name="ulink.url" select="$ulink.url"/>
934 <xsl:template name="hyperlink.url.display">
935 <!-- * This template is called for all external hyperlinks (ulinks and -->
936 <!-- * for all simple xlinks); it determines whether the URL for the -->
937 <!-- * hyperlink is displayed, and how to display it (either inline or -->
938 <!-- * as a numbered footnote). -->
939 <xsl:param name="url"/>
940 <xsl:param name="ulink.url">
941 <!-- * ulink.url is just the value of the URL wrapped in 'url(...)' -->
942 <xsl:call-template name="fo-external-image">
943 <xsl:with-param name="filename" select="$url"/>
947 <xsl:if test="count(child::node()) != 0
948 and string(.) != $url
949 and $ulink.show != 0">
950 <!-- * Display the URL for this hyperlink only if it is non-empty, -->
951 <!-- * and the value of its content is not a URL that is the same as -->
952 <!-- * URL it links to, and if ulink.show is non-zero. -->
954 <xsl:when test="$ulink.footnotes != 0 and not(ancestor::footnote)">
955 <!-- * ulink.show and ulink.footnote are both non-zero; that -->
956 <!-- * means we display the URL as a footnote (instead of inline) -->
958 <xsl:call-template name="ulink.footnote.number"/>
959 <fo:footnote-body xsl:use-attribute-sets="footnote.properties">
961 <xsl:call-template name="ulink.footnote.number"/>
962 <xsl:text> </xsl:text>
963 <fo:basic-link external-destination="{$ulink.url}">
964 <xsl:value-of select="$url"/>
971 <!-- * ulink.show is non-zero, but ulink.footnote is not; that -->
972 <!-- * means we display the URL inline -->
973 <fo:inline hyphenate="false">
974 <!-- * put square brackets around the URL -->
975 <xsl:text> [</xsl:text>
976 <fo:basic-link external-destination="{$ulink.url}">
977 <xsl:call-template name="hyphenate-url">
978 <xsl:with-param name="url" select="$url"/>
981 <xsl:text>]</xsl:text>
989 <xsl:template name="ulink.footnote.number">
990 <fo:inline xsl:use-attribute-sets="footnote.mark.properties">
992 <xsl:when test="$fop.extensions != 0">
993 <xsl:attribute name="vertical-align">super</xsl:attribute>
996 <xsl:attribute name="baseline-shift">super</xsl:attribute>
999 <xsl:variable name="fnum">
1000 <!-- * Determine the footnote number to display for this hyperlink, -->
1001 <!-- * by counting all foonotes, ulinks, and any elements that have -->
1002 <!-- * an xlink:href attribute that meets the following criteria: -->
1004 <!-- * - the content of the element is not a URI that is the same -->
1005 <!-- * URI as the value of the href attribute -->
1006 <!-- * - the href attribute is not an internal ID reference (does -->
1007 <!-- * not start with a hash sign) -->
1008 <!-- * - the href is not part of an olink reference (the element -->
1009 <!-- * - does not have an xlink:role attribute that indicates it is -->
1010 <!-- * an olink, and the href does not contain a hash sign) -->
1011 <!-- * - the element either has no xlink:type attribute or has -->
1012 <!-- * an xlink:type attribute whose value is 'simple' -->
1013 <!-- FIXME: list in @from is probably not complete -->
1014 <xsl:number level="any"
1015 from="chapter|appendix|preface|article|refentry|bibliography[not(parent::article)]"
1016 count="footnote[not(@label)][not(ancestor::tgroup)]
1017 |ulink[node()][@url != .][not(ancestor::footnote)]
1018 |*[node()][@xlink:href][not(@xlink:href = .)][not(starts-with(@xlink:href,'#'))]
1019 [not(contains(@xlink:href,'#') and @xlink:role = $xolink.role)]
1020 [not(@xlink:type) or @xlink:type='simple']
1021 [not(ancestor::footnote)]"
1025 <xsl:when test="string-length($footnote.number.symbols) >= $fnum">
1026 <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
1029 <xsl:number value="$fnum" format="{$footnote.number.format}"/>
1035 <xsl:template name="hyphenate-url">
1036 <xsl:param name="url" select="''"/>
1038 <xsl:when test="$ulink.hyphenate = ''">
1039 <xsl:value-of select="$url"/>
1041 <xsl:when test="string-length($url) > 1">
1042 <xsl:variable name="char" select="substring($url, 1, 1)"/>
1043 <xsl:value-of select="$char"/>
1044 <xsl:if test="contains($ulink.hyphenate.chars, $char)">
1045 <!-- Do not hyphen in-between // -->
1046 <xsl:if test="not($char = '/' and substring($url,2,1) = '/')">
1047 <xsl:copy-of select="$ulink.hyphenate"/>
1050 <!-- recurse to the next character -->
1051 <xsl:call-template name="hyphenate-url">
1052 <xsl:with-param name="url" select="substring($url, 2)"/>
1053 </xsl:call-template>
1056 <xsl:value-of select="$url"/>
1061 <xsl:template match="olink" name="olink">
1062 <!-- olink content may be passed in from xlink olink -->
1063 <xsl:param name="content" select="NOTANELEMENT"/>
1065 <xsl:call-template name="anchor"/>
1067 <xsl:variable name="localinfo" select="@localinfo"/>
1070 <!-- olinks resolved by stylesheet and target database -->
1071 <xsl:when test="@targetdoc or @targetptr or
1072 (@xlink:role=$xolink.role and
1073 contains(@xlink:href, '#') )" >
1075 <xsl:variable name="targetdoc.att">
1077 <xsl:when test="@targetdoc != ''">
1078 <xsl:value-of select="@targetdoc"/>
1080 <xsl:when test="@xlink:role=$xolink.role and
1081 contains(@xlink:href, '#')" >
1082 <xsl:value-of select="substring-before(@xlink:href, '#')"/>
1087 <xsl:variable name="targetptr.att">
1089 <xsl:when test="@targetptr != ''">
1090 <xsl:value-of select="@targetptr"/>
1092 <xsl:when test="@xlink:role=$xolink.role and
1093 contains(@xlink:href, '#')" >
1094 <xsl:value-of select="substring-after(@xlink:href, '#')"/>
1099 <xsl:variable name="olink.lang">
1100 <xsl:call-template name="l10n.language">
1101 <xsl:with-param name="xref-context" select="true()"/>
1102 </xsl:call-template>
1105 <xsl:variable name="target.database.filename">
1106 <xsl:call-template name="select.target.database">
1107 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1108 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1109 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1110 </xsl:call-template>
1113 <xsl:variable name="target.database"
1114 select="document($target.database.filename, /)"/>
1116 <xsl:if test="$olink.debug != 0">
1118 <xsl:text>Olink debug: root element of target.database is '</xsl:text>
1119 <xsl:value-of select="local-name($target.database/*[1])"/>
1120 <xsl:text>'.</xsl:text>
1124 <xsl:variable name="olink.key">
1125 <xsl:call-template name="select.olink.key">
1126 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1127 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1128 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1129 <xsl:with-param name="target.database" select="$target.database"/>
1130 </xsl:call-template>
1133 <xsl:if test="string-length($olink.key) = 0">
1135 <xsl:text>Error: unresolved olink: </xsl:text>
1136 <xsl:text>targetdoc/targetptr = '</xsl:text>
1137 <xsl:value-of select="$targetdoc.att"/>
1138 <xsl:text>/</xsl:text>
1139 <xsl:value-of select="$targetptr.att"/>
1140 <xsl:text>'.</xsl:text>
1144 <xsl:variable name="href">
1145 <xsl:call-template name="make.olink.href">
1146 <xsl:with-param name="olink.key" select="$olink.key"/>
1147 <xsl:with-param name="target.database" select="$target.database"/>
1148 </xsl:call-template>
1151 <!-- Olink that points to internal id can be a link -->
1152 <xsl:variable name="linkend">
1153 <xsl:call-template name="olink.as.linkend">
1154 <xsl:with-param name="olink.key" select="$olink.key"/>
1155 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1156 <xsl:with-param name="target.database" select="$target.database"/>
1157 </xsl:call-template>
1160 <xsl:variable name="hottext">
1162 <xsl:when test="string-length($content) != 0">
1163 <xsl:copy-of select="$content"/>
1166 <xsl:call-template name="olink.hottext">
1167 <xsl:with-param name="olink.key" select="$olink.key"/>
1168 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1169 <xsl:with-param name="target.database" select="$target.database"/>
1170 </xsl:call-template>
1175 <xsl:variable name="olink.docname.citation">
1176 <xsl:call-template name="olink.document.citation">
1177 <xsl:with-param name="olink.key" select="$olink.key"/>
1178 <xsl:with-param name="target.database" select="$target.database"/>
1179 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1180 </xsl:call-template>
1183 <xsl:variable name="olink.page.citation">
1184 <xsl:call-template name="olink.page.citation">
1185 <xsl:with-param name="olink.key" select="$olink.key"/>
1186 <xsl:with-param name="target.database" select="$target.database"/>
1187 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1188 <xsl:with-param name="linkend" select="$linkend"/>
1189 </xsl:call-template>
1193 <xsl:when test="$linkend != ''">
1194 <fo:basic-link internal-destination="{$linkend}"
1195 xsl:use-attribute-sets="xref.properties">
1196 <xsl:copy-of select="$hottext"/>
1197 <xsl:copy-of select="$olink.page.citation"/>
1200 <xsl:when test="$href != ''">
1202 <xsl:when test="$xep.extensions != 0">
1203 <fo:basic-link external-destination="url({$href})"
1204 xsl:use-attribute-sets="olink.properties">
1205 <xsl:copy-of select="$hottext"/>
1207 <xsl:copy-of select="$olink.page.citation"/>
1208 <xsl:copy-of select="$olink.docname.citation"/>
1210 <xsl:when test="$axf.extensions != 0">
1211 <fo:basic-link external-destination="{$href}"
1212 xsl:use-attribute-sets="olink.properties">
1213 <xsl:copy-of select="$hottext"/>
1215 <xsl:copy-of select="$olink.page.citation"/>
1216 <xsl:copy-of select="$olink.docname.citation"/>
1219 <fo:basic-link external-destination="{$href}"
1220 xsl:use-attribute-sets="olink.properties">
1221 <xsl:copy-of select="$hottext"/>
1223 <xsl:copy-of select="$olink.page.citation"/>
1224 <xsl:copy-of select="$olink.docname.citation"/>
1229 <xsl:copy-of select="$hottext"/>
1230 <xsl:copy-of select="$olink.page.citation"/>
1231 <xsl:copy-of select="$olink.docname.citation"/>
1236 <!-- olink never implemented in FO for old olink entity syntax -->
1238 <xsl:apply-templates/>
1243 <xsl:template match="*" mode="insert.olink.docname.markup">
1244 <xsl:param name="docname" select="''"/>
1246 <fo:inline font-style="italic">
1247 <xsl:value-of select="$docname"/>
1252 <!-- This prevents error message when processing olinks with xrefstyle -->
1253 <xsl:template match="olink" mode="object.xref.template"/>
1256 <xsl:template name="olink.as.linkend">
1257 <xsl:param name="olink.key" select="''"/>
1258 <xsl:param name="olink.lang" select="''"/>
1259 <xsl:param name="target.database" select="NotANode"/>
1261 <xsl:variable name="targetdoc">
1262 <xsl:value-of select="substring-before($olink.key, '/')"/>
1265 <xsl:variable name="targetptr">
1267 select="substring-before(substring-after($olink.key, '/'), '/')"/>
1270 <xsl:variable name="target.lang">
1271 <xsl:variable name="candidate">
1272 <xsl:for-each select="$target.database" >
1274 select="key('targetptr-key', $olink.key)[1]/@lang" />
1278 <xsl:when test="$candidate != ''">
1279 <xsl:value-of select="$candidate"/>
1282 <xsl:value-of select="$olink.lang"/>
1287 <xsl:if test="$current.docid = $targetdoc and
1288 $olink.lang = $target.lang">
1289 <xsl:variable name="targets" select="key('id',$targetptr)"/>
1290 <xsl:variable name="target" select="$targets[1]"/>
1291 <xsl:if test="$target">
1292 <xsl:value-of select="$targetptr"/>
1299 <xsl:template name="olink.outline">
1300 <xsl:param name="outline.base.uri"/>
1301 <xsl:param name="localinfo"/>
1302 <xsl:param name="return" select="href"/>
1304 <xsl:message terminate="yes">Fatal error: olink.outline template: what is this supposed to do?</xsl:message>
1307 <!-- ==================================================================== -->
1309 <xsl:template name="title.xref">
1310 <xsl:param name="target" select="."/>
1312 <xsl:when test="local-name($target) = 'figure'
1313 or local-name($target) = 'example'
1314 or local-name($target) = 'equation'
1315 or local-name($target) = 'table'
1316 or local-name($target) = 'dedication'
1317 or local-name($target) = 'acknowledgements'
1318 or local-name($target) = 'preface'
1319 or local-name($target) = 'bibliography'
1320 or local-name($target) = 'glossary'
1321 or local-name($target) = 'index'
1322 or local-name($target) = 'setindex'
1323 or local-name($target) = 'colophon'">
1324 <xsl:call-template name="gentext.startquote"/>
1325 <xsl:apply-templates select="$target" mode="title.markup"/>
1326 <xsl:call-template name="gentext.endquote"/>
1329 <fo:inline font-style="italic">
1330 <xsl:apply-templates select="$target" mode="title.markup"/>
1336 <xsl:template name="number.xref">
1337 <xsl:param name="target" select="."/>
1338 <xsl:apply-templates select="$target" mode="label.markup"/>
1341 <!-- ==================================================================== -->
1343 <xsl:template name="xref.xreflabel">
1344 <!-- called to process an xreflabel...you might use this to make -->
1345 <!-- xreflabels come out in the right font for different targets, -->
1346 <!-- for example. -->
1347 <xsl:param name="target" select="."/>
1348 <xsl:value-of select="$target/@xreflabel"/>
1351 <!-- ==================================================================== -->
1353 <xsl:template match="title" mode="xref">
1354 <xsl:apply-templates/>
1357 <xsl:template match="command" mode="xref">
1358 <xsl:call-template name="inline.boldseq"/>
1361 <xsl:template match="function" mode="xref">
1362 <xsl:call-template name="inline.monoseq"/>
1365 <xsl:template match="*" mode="page.citation">
1366 <xsl:param name="id" select="'???'"/>
1368 <fo:basic-link internal-destination="{$id}"
1369 xsl:use-attribute-sets="xref.properties">
1370 <fo:inline keep-together.within-line="always">
1371 <xsl:call-template name="substitute-markup">
1372 <xsl:with-param name="template">
1373 <xsl:call-template name="gentext.template">
1374 <xsl:with-param name="name" select="'page.citation'"/>
1375 <xsl:with-param name="context" select="'xref'"/>
1376 </xsl:call-template>
1378 </xsl:call-template>
1383 <xsl:template match="*" mode="pagenumber.markup">
1384 <xsl:variable name="id">
1385 <xsl:call-template name="object.id"/>
1387 <fo:page-number-citation ref-id="{$id}"/>
1390 <!-- ==================================================================== -->
1392 <xsl:template match="*" mode="insert.title.markup">
1393 <xsl:param name="purpose"/>
1394 <xsl:param name="xrefstyle"/>
1395 <xsl:param name="title"/>
1398 <!-- FIXME: what about the case where titleabbrev is inside the info? -->
1399 <xsl:when test="$purpose = 'xref' and titleabbrev">
1400 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
1403 <xsl:copy-of select="$title"/>
1408 <xsl:template match="chapter|appendix" mode="insert.title.markup">
1409 <xsl:param name="purpose"/>
1410 <xsl:param name="xrefstyle"/>
1411 <xsl:param name="title"/>
1414 <xsl:when test="$purpose = 'xref'">
1415 <fo:inline font-style="italic">
1416 <xsl:copy-of select="$title"/>
1420 <xsl:copy-of select="$title"/>
1425 <xsl:template match="*" mode="insert.subtitle.markup">
1426 <xsl:param name="purpose"/>
1427 <xsl:param name="xrefstyle"/>
1428 <xsl:param name="subtitle"/>
1430 <xsl:copy-of select="$subtitle"/>
1433 <xsl:template match="*" mode="insert.label.markup">
1434 <xsl:param name="purpose"/>
1435 <xsl:param name="xrefstyle"/>
1436 <xsl:param name="label"/>
1438 <xsl:copy-of select="$label"/>
1441 <xsl:template match="*" mode="insert.pagenumber.markup">
1442 <xsl:param name="purpose"/>
1443 <xsl:param name="xrefstyle"/>
1444 <xsl:param name="pagenumber"/>
1446 <xsl:copy-of select="$pagenumber"/>
1449 <xsl:template match="*" mode="insert.direction.markup">
1450 <xsl:param name="purpose"/>
1451 <xsl:param name="xrefstyle"/>
1452 <xsl:param name="direction"/>
1454 <xsl:copy-of select="$direction"/>
1457 <xsl:template match="olink" mode="pagenumber.markup">
1458 <!-- Local olinks can use page-citation -->
1459 <xsl:variable name="targetdoc.att" select="@targetdoc"/>
1460 <xsl:variable name="targetptr.att" select="@targetptr"/>
1462 <xsl:variable name="olink.lang">
1463 <xsl:call-template name="l10n.language">
1464 <xsl:with-param name="xref-context" select="true()"/>
1465 </xsl:call-template>
1468 <xsl:variable name="target.database.filename">
1469 <xsl:call-template name="select.target.database">
1470 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1471 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1472 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1473 </xsl:call-template>
1476 <xsl:variable name="target.database"
1477 select="document($target.database.filename, /)"/>
1479 <xsl:if test="$olink.debug != 0">
1481 <xsl:text>Olink debug: root element of target.database is '</xsl:text>
1482 <xsl:value-of select="local-name($target.database/*[1])"/>
1483 <xsl:text>'.</xsl:text>
1487 <xsl:variable name="olink.key">
1488 <xsl:call-template name="select.olink.key">
1489 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1490 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1491 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1492 <xsl:with-param name="target.database" select="$target.database"/>
1493 </xsl:call-template>
1496 <!-- Olink that points to internal id can be a link -->
1497 <xsl:variable name="linkend">
1498 <xsl:call-template name="olink.as.linkend">
1499 <xsl:with-param name="olink.key" select="$olink.key"/>
1500 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1501 <xsl:with-param name="target.database" select="$target.database"/>
1502 </xsl:call-template>
1506 <xsl:when test="$linkend != ''">
1507 <fo:page-number-citation ref-id="{$linkend}"/>
1511 <xsl:text>Olink error: no page number linkend for local olink '</xsl:text>
1512 <xsl:value-of select="$olink.key"/>
1513 <xsl:text>'</xsl:text>