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 8913 2010-10-01 04:44:57Z bobstayton $
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:if test="$verbose != 0">
796 <xsl:text>WARNING: xref to <</xsl:text>
797 <xsl:value-of select="local-name()"/>
798 <xsl:text> id="</xsl:text>
799 <xsl:value-of select="@id|@xml:id"/>
800 <xsl:text>"> has no generated text. Trying its ancestor elements.</xsl:text>
803 <xsl:apply-templates select="$context" mode="xref-to">
804 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
805 <xsl:with-param name="referrer" select="$referrer"/>
806 <xsl:with-param name="verbose" select="$verbose"/>
807 </xsl:apply-templates>
812 <xsl:template match="indexterm" mode="xref-to">
813 <xsl:value-of select="primary"/>
816 <xsl:template match="primary|secondary|tertiary" mode="xref-to">
817 <xsl:value-of select="."/>
820 <!-- ==================================================================== -->
822 <xsl:template match="link" name="link">
823 <xsl:param name="linkend" select="@linkend"/>
824 <xsl:param name="targets" select="key('id',$linkend)"/>
825 <xsl:param name="target" select="$targets[1]"/>
827 <xsl:variable name="xrefstyle">
829 <xsl:when test="@role and not(@xrefstyle)
830 and $use.role.as.xrefstyle != 0">
831 <xsl:value-of select="@role"/>
834 <xsl:value-of select="@xrefstyle"/>
839 <xsl:variable name="content">
840 <fo:inline xsl:use-attribute-sets="xref.properties">
842 <xsl:when test="count(child::node()) > 0">
843 <!-- If it has content, use it -->
844 <xsl:apply-templates/>
846 <!-- look for an endterm -->
847 <xsl:when test="@endterm">
848 <xsl:variable name="etargets" select="key('id',@endterm)"/>
849 <xsl:variable name="etarget" select="$etargets[1]"/>
851 <xsl:when test="count($etarget) = 0">
853 <xsl:value-of select="count($etargets)"/>
854 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
855 <xsl:value-of select="@endterm"/>
857 <xsl:text>???</xsl:text>
860 <xsl:apply-templates select="$etarget" mode="endterm"/>
864 <!-- Use the xlink:href if no other text -->
865 <xsl:when test="@xlink:href">
866 <xsl:call-template name="hyphenate-url">
867 <xsl:with-param name="url" select="@xlink:href"/>
872 <xsl:text>Link element has no content and no Endterm. </xsl:text>
873 <xsl:text>Nothing to show in the link to </xsl:text>
874 <xsl:value-of select="$target"/>
876 <xsl:text>???</xsl:text>
882 <xsl:call-template name="simple.xlink">
883 <xsl:with-param name="node" select="."/>
884 <xsl:with-param name="linkend" select="$linkend"/>
885 <xsl:with-param name="content" select="$content"/>
888 <!-- Add standard page reference? -->
890 <!-- page numbering on link only enabled for @linkend -->
891 <!-- There is no link element in DB5 with xlink:href -->
892 <xsl:when test="not($linkend)">
894 <!-- negative xrefstyle in instance turns it off -->
895 <xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')
896 and contains($xrefstyle, 'nopage')">
898 <xsl:when test="(starts-with(normalize-space($xrefstyle), 'select:')
899 and $insert.link.page.number = 'maybe'
900 and (contains($xrefstyle, 'page')
901 or contains($xrefstyle, 'Page')))
902 or ( $insert.link.page.number = 'yes'
903 or $insert.link.page.number = '1')
904 or local-name($target) = 'para'">
905 <xsl:apply-templates select="$target" mode="page.citation">
906 <xsl:with-param name="id" select="$linkend"/>
907 </xsl:apply-templates>
912 <xsl:template match="ulink" name="ulink">
913 <xsl:param name="url" select="@url"/>
915 <xsl:variable name ="ulink.url">
916 <xsl:call-template name="fo-external-image">
917 <xsl:with-param name="filename" select="$url"/>
921 <fo:basic-link xsl:use-attribute-sets="xref.properties"
922 external-destination="{$ulink.url}">
924 <xsl:when test="count(child::node())=0 or (string(.) = $url)">
925 <xsl:call-template name="hyphenate-url">
926 <xsl:with-param name="url" select="$url"/>
930 <xsl:apply-templates/>
934 <!-- * Call the template for determining whether the URL for this -->
935 <!-- * hyperlink is displayed, and how to display it (either inline or -->
936 <!-- * as a numbered footnote). -->
937 <xsl:call-template name="hyperlink.url.display">
938 <xsl:with-param name="url" select="$url"/>
939 <xsl:with-param name="ulink.url" select="$ulink.url"/>
943 <xsl:template name="hyperlink.url.display">
944 <!-- * This template is called for all external hyperlinks (ulinks and -->
945 <!-- * for all simple xlinks); it determines whether the URL for the -->
946 <!-- * hyperlink is displayed, and how to display it (either inline or -->
947 <!-- * as a numbered footnote). -->
948 <xsl:param name="url"/>
949 <xsl:param name="ulink.url">
950 <!-- * ulink.url is just the value of the URL wrapped in 'url(...)' -->
951 <xsl:call-template name="fo-external-image">
952 <xsl:with-param name="filename" select="$url"/>
956 <xsl:if test="count(child::node()) != 0
957 and string(.) != $url
958 and $ulink.show != 0">
959 <!-- * Display the URL for this hyperlink only if it is non-empty, -->
960 <!-- * and the value of its content is not a URL that is the same as -->
961 <!-- * URL it links to, and if ulink.show is non-zero. -->
963 <xsl:when test="$ulink.footnotes != 0 and not(ancestor::footnote)">
964 <!-- * ulink.show and ulink.footnote are both non-zero; that -->
965 <!-- * means we display the URL as a footnote (instead of inline) -->
967 <xsl:call-template name="ulink.footnote.number"/>
968 <fo:footnote-body xsl:use-attribute-sets="footnote.properties">
970 <xsl:call-template name="ulink.footnote.number"/>
971 <xsl:text> </xsl:text>
972 <fo:basic-link external-destination="{$ulink.url}">
973 <xsl:value-of select="$url"/>
980 <!-- * ulink.show is non-zero, but ulink.footnote is not; that -->
981 <!-- * means we display the URL inline -->
982 <fo:inline hyphenate="false">
983 <!-- * put square brackets around the URL -->
984 <xsl:text> [</xsl:text>
985 <fo:basic-link external-destination="{$ulink.url}">
986 <xsl:call-template name="hyphenate-url">
987 <xsl:with-param name="url" select="$url"/>
990 <xsl:text>]</xsl:text>
998 <xsl:template name="ulink.footnote.number">
999 <fo:inline xsl:use-attribute-sets="footnote.mark.properties">
1001 <xsl:when test="$fop.extensions != 0">
1002 <xsl:attribute name="vertical-align">super</xsl:attribute>
1005 <xsl:attribute name="baseline-shift">super</xsl:attribute>
1008 <xsl:variable name="fnum">
1009 <!-- * Determine the footnote number to display for this hyperlink, -->
1010 <!-- * by counting all foonotes, ulinks, and any elements that have -->
1011 <!-- * an xlink:href attribute that meets the following criteria: -->
1013 <!-- * - the content of the element is not a URI that is the same -->
1014 <!-- * URI as the value of the href attribute -->
1015 <!-- * - the href attribute is not an internal ID reference (does -->
1016 <!-- * not start with a hash sign) -->
1017 <!-- * - the href is not part of an olink reference (the element -->
1018 <!-- * - does not have an xlink:role attribute that indicates it is -->
1019 <!-- * an olink, and the href does not contain a hash sign) -->
1020 <!-- * - the element either has no xlink:type attribute or has -->
1021 <!-- * an xlink:type attribute whose value is 'simple' -->
1022 <!-- FIXME: list in @from is probably not complete -->
1023 <xsl:number level="any"
1024 from="chapter|appendix|preface|article|refentry|bibliography[not(parent::article)]"
1025 count="footnote[not(@label)][not(ancestor::tgroup)]
1026 |ulink[node()][@url != .][not(ancestor::footnote)]
1027 |*[node()][@xlink:href][not(@xlink:href = .)][not(starts-with(@xlink:href,'#'))]
1028 [not(contains(@xlink:href,'#') and @xlink:role = $xolink.role)]
1029 [not(@xlink:type) or @xlink:type='simple']
1030 [not(ancestor::footnote)]"
1034 <xsl:when test="string-length($footnote.number.symbols) >= $fnum">
1035 <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
1038 <xsl:number value="$fnum" format="{$footnote.number.format}"/>
1044 <xsl:template name="hyphenate-url">
1045 <xsl:param name="url" select="''"/>
1047 <xsl:when test="$ulink.hyphenate = ''">
1048 <xsl:value-of select="$url"/>
1050 <xsl:when test="string-length($url) > 1">
1051 <xsl:variable name="char" select="substring($url, 1, 1)"/>
1052 <xsl:value-of select="$char"/>
1053 <xsl:if test="contains($ulink.hyphenate.chars, $char)">
1054 <!-- Do not hyphen in-between // -->
1055 <xsl:if test="not($char = '/' and substring($url,2,1) = '/')">
1056 <xsl:copy-of select="$ulink.hyphenate"/>
1059 <!-- recurse to the next character -->
1060 <xsl:call-template name="hyphenate-url">
1061 <xsl:with-param name="url" select="substring($url, 2)"/>
1062 </xsl:call-template>
1065 <xsl:value-of select="$url"/>
1070 <xsl:template match="olink" name="olink">
1071 <!-- olink content may be passed in from xlink olink -->
1072 <xsl:param name="content" select="NOTANELEMENT"/>
1074 <xsl:variable name="localinfo" select="@localinfo"/>
1077 <!-- olinks resolved by stylesheet and target database -->
1078 <xsl:when test="@targetdoc or @targetptr or
1079 (@xlink:role=$xolink.role and
1080 contains(@xlink:href, '#') )" >
1082 <xsl:variable name="targetdoc.att">
1084 <xsl:when test="@targetdoc != ''">
1085 <xsl:value-of select="@targetdoc"/>
1087 <xsl:when test="@xlink:role=$xolink.role and
1088 contains(@xlink:href, '#')" >
1089 <xsl:value-of select="substring-before(@xlink:href, '#')"/>
1094 <xsl:variable name="targetptr.att">
1096 <xsl:when test="@targetptr != ''">
1097 <xsl:value-of select="@targetptr"/>
1099 <xsl:when test="@xlink:role=$xolink.role and
1100 contains(@xlink:href, '#')" >
1101 <xsl:value-of select="substring-after(@xlink:href, '#')"/>
1106 <xsl:variable name="olink.lang">
1107 <xsl:call-template name="l10n.language">
1108 <xsl:with-param name="xref-context" select="true()"/>
1109 </xsl:call-template>
1112 <xsl:variable name="target.database.filename">
1113 <xsl:call-template name="select.target.database">
1114 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1115 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1116 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1117 </xsl:call-template>
1120 <xsl:variable name="target.database"
1121 select="document($target.database.filename, /)"/>
1123 <xsl:if test="$olink.debug != 0">
1125 <xsl:text>Olink debug: root element of target.database is '</xsl:text>
1126 <xsl:value-of select="local-name($target.database/*[1])"/>
1127 <xsl:text>'.</xsl:text>
1131 <xsl:variable name="olink.key">
1132 <xsl:call-template name="select.olink.key">
1133 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1134 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1135 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1136 <xsl:with-param name="target.database" select="$target.database"/>
1137 </xsl:call-template>
1140 <xsl:if test="string-length($olink.key) = 0">
1142 <xsl:text>Error: unresolved olink: </xsl:text>
1143 <xsl:text>targetdoc/targetptr = '</xsl:text>
1144 <xsl:value-of select="$targetdoc.att"/>
1145 <xsl:text>/</xsl:text>
1146 <xsl:value-of select="$targetptr.att"/>
1147 <xsl:text>'.</xsl:text>
1151 <xsl:variable name="href">
1152 <xsl:call-template name="make.olink.href">
1153 <xsl:with-param name="olink.key" select="$olink.key"/>
1154 <xsl:with-param name="target.database" select="$target.database"/>
1155 </xsl:call-template>
1158 <!-- Olink that points to internal id can be a link -->
1159 <xsl:variable name="linkend">
1160 <xsl:call-template name="olink.as.linkend">
1161 <xsl:with-param name="olink.key" select="$olink.key"/>
1162 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1163 <xsl:with-param name="target.database" select="$target.database"/>
1164 </xsl:call-template>
1167 <xsl:variable name="hottext">
1169 <xsl:when test="string-length($content) != 0">
1170 <xsl:copy-of select="$content"/>
1173 <xsl:call-template name="olink.hottext">
1174 <xsl:with-param name="olink.key" select="$olink.key"/>
1175 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1176 <xsl:with-param name="target.database" select="$target.database"/>
1177 </xsl:call-template>
1182 <xsl:variable name="olink.docname.citation">
1183 <xsl:call-template name="olink.document.citation">
1184 <xsl:with-param name="olink.key" select="$olink.key"/>
1185 <xsl:with-param name="target.database" select="$target.database"/>
1186 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1187 </xsl:call-template>
1190 <xsl:variable name="olink.page.citation">
1191 <xsl:call-template name="olink.page.citation">
1192 <xsl:with-param name="olink.key" select="$olink.key"/>
1193 <xsl:with-param name="target.database" select="$target.database"/>
1194 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1195 <xsl:with-param name="linkend" select="$linkend"/>
1196 </xsl:call-template>
1200 <xsl:when test="$linkend != ''">
1201 <fo:basic-link internal-destination="{$linkend}"
1202 xsl:use-attribute-sets="xref.properties">
1203 <xsl:call-template name="anchor"/>
1204 <xsl:copy-of select="$hottext"/>
1205 <xsl:copy-of select="$olink.page.citation"/>
1208 <xsl:when test="$href != ''">
1210 <xsl:when test="$fop1.extensions != 0">
1211 <xsl:variable name="mybeg" select="substring-before($href,'#')"/>
1212 <xsl:variable name="myend" select="substring-after($href,'#')"/>
1213 <fo:basic-link external-destination="url({concat($mybeg,'#dest=',$myend)})"
1214 xsl:use-attribute-sets="olink.properties">
1215 <xsl:copy-of select="$hottext"/>
1217 <xsl:copy-of select="$olink.page.citation"/>
1218 <xsl:copy-of select="$olink.docname.citation"/>
1220 <xsl:when test="$xep.extensions != 0">
1221 <fo:basic-link external-destination="url({$href})"
1222 xsl:use-attribute-sets="olink.properties">
1223 <xsl:call-template name="anchor"/>
1224 <xsl:copy-of select="$hottext"/>
1226 <xsl:copy-of select="$olink.page.citation"/>
1227 <xsl:copy-of select="$olink.docname.citation"/>
1229 <xsl:when test="$axf.extensions != 0">
1230 <fo:basic-link external-destination="{$href}"
1231 xsl:use-attribute-sets="olink.properties">
1232 <xsl:copy-of select="$hottext"/>
1234 <xsl:copy-of select="$olink.page.citation"/>
1235 <xsl:copy-of select="$olink.docname.citation"/>
1238 <fo:basic-link external-destination="{$href}"
1239 xsl:use-attribute-sets="olink.properties">
1240 <xsl:copy-of select="$hottext"/>
1242 <xsl:copy-of select="$olink.page.citation"/>
1243 <xsl:copy-of select="$olink.docname.citation"/>
1248 <xsl:copy-of select="$hottext"/>
1249 <xsl:copy-of select="$olink.page.citation"/>
1250 <xsl:copy-of select="$olink.docname.citation"/>
1255 <!-- olink never implemented in FO for old olink entity syntax -->
1257 <xsl:apply-templates/>
1262 <xsl:template match="*" mode="insert.olink.docname.markup">
1263 <xsl:param name="docname" select="''"/>
1265 <fo:inline font-style="italic">
1266 <xsl:value-of select="$docname"/>
1271 <!-- This prevents error message when processing olinks with xrefstyle -->
1272 <xsl:template match="olink" mode="object.xref.template"/>
1275 <xsl:template name="olink.as.linkend">
1276 <xsl:param name="olink.key" select="''"/>
1277 <xsl:param name="olink.lang" select="''"/>
1278 <xsl:param name="target.database" select="NotANode"/>
1280 <xsl:variable name="targetdoc">
1281 <xsl:value-of select="substring-before($olink.key, '/')"/>
1284 <xsl:variable name="targetptr">
1286 select="substring-before(substring-after($olink.key, '/'), '/')"/>
1289 <xsl:variable name="target.lang">
1290 <xsl:variable name="candidate">
1291 <xsl:for-each select="$target.database" >
1293 select="key('targetptr-key', $olink.key)[1]/@lang" />
1297 <xsl:when test="$candidate != ''">
1298 <xsl:value-of select="$candidate"/>
1301 <xsl:value-of select="$olink.lang"/>
1306 <xsl:if test="$current.docid = $targetdoc and
1307 $olink.lang = $target.lang">
1308 <xsl:variable name="targets" select="key('id',$targetptr)"/>
1309 <xsl:variable name="target" select="$targets[1]"/>
1310 <xsl:if test="$target">
1311 <xsl:value-of select="$targetptr"/>
1318 <xsl:template name="olink.outline">
1319 <xsl:param name="outline.base.uri"/>
1320 <xsl:param name="localinfo"/>
1321 <xsl:param name="return" select="href"/>
1323 <xsl:message terminate="yes">Fatal error: olink.outline template: what is this supposed to do?</xsl:message>
1326 <!-- ==================================================================== -->
1328 <xsl:template name="title.xref">
1329 <xsl:param name="target" select="."/>
1331 <xsl:when test="local-name($target) = 'figure'
1332 or local-name($target) = 'example'
1333 or local-name($target) = 'equation'
1334 or local-name($target) = 'table'
1335 or local-name($target) = 'dedication'
1336 or local-name($target) = 'acknowledgements'
1337 or local-name($target) = 'preface'
1338 or local-name($target) = 'bibliography'
1339 or local-name($target) = 'glossary'
1340 or local-name($target) = 'index'
1341 or local-name($target) = 'setindex'
1342 or local-name($target) = 'colophon'">
1343 <xsl:call-template name="gentext.startquote"/>
1344 <xsl:apply-templates select="$target" mode="title.markup"/>
1345 <xsl:call-template name="gentext.endquote"/>
1348 <fo:inline font-style="italic">
1349 <xsl:apply-templates select="$target" mode="title.markup"/>
1355 <xsl:template name="number.xref">
1356 <xsl:param name="target" select="."/>
1357 <xsl:apply-templates select="$target" mode="label.markup"/>
1360 <!-- ==================================================================== -->
1362 <xsl:template name="xref.xreflabel">
1363 <!-- called to process an xreflabel...you might use this to make -->
1364 <!-- xreflabels come out in the right font for different targets, -->
1365 <!-- for example. -->
1366 <xsl:param name="target" select="."/>
1367 <xsl:value-of select="$target/@xreflabel"/>
1370 <!-- ==================================================================== -->
1372 <xsl:template match="title" mode="xref">
1373 <xsl:apply-templates/>
1376 <xsl:template match="command" mode="xref">
1377 <xsl:call-template name="inline.boldseq"/>
1380 <xsl:template match="function" mode="xref">
1381 <xsl:call-template name="inline.monoseq"/>
1384 <xsl:template match="*" mode="page.citation">
1385 <xsl:param name="id" select="'???'"/>
1387 <fo:basic-link internal-destination="{$id}"
1388 xsl:use-attribute-sets="xref.properties">
1389 <fo:inline keep-together.within-line="always">
1390 <xsl:call-template name="substitute-markup">
1391 <xsl:with-param name="template">
1392 <xsl:call-template name="gentext.template">
1393 <xsl:with-param name="name" select="'page.citation'"/>
1394 <xsl:with-param name="context" select="'xref'"/>
1395 </xsl:call-template>
1397 </xsl:call-template>
1402 <xsl:template match="*" mode="pagenumber.markup">
1403 <xsl:variable name="id">
1404 <xsl:call-template name="object.id"/>
1406 <fo:page-number-citation ref-id="{$id}"/>
1409 <!-- ==================================================================== -->
1411 <xsl:template match="*" mode="insert.title.markup">
1412 <xsl:param name="purpose"/>
1413 <xsl:param name="xrefstyle"/>
1414 <xsl:param name="title"/>
1417 <!-- FIXME: what about the case where titleabbrev is inside the info? -->
1418 <xsl:when test="$purpose = 'xref' and titleabbrev">
1419 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
1422 <xsl:copy-of select="$title"/>
1427 <xsl:template match="chapter|appendix" mode="insert.title.markup">
1428 <xsl:param name="purpose"/>
1429 <xsl:param name="xrefstyle"/>
1430 <xsl:param name="title"/>
1433 <xsl:when test="$purpose = 'xref'">
1434 <fo:inline font-style="italic">
1435 <xsl:copy-of select="$title"/>
1439 <xsl:copy-of select="$title"/>
1444 <xsl:template match="*" mode="insert.subtitle.markup">
1445 <xsl:param name="purpose"/>
1446 <xsl:param name="xrefstyle"/>
1447 <xsl:param name="subtitle"/>
1449 <xsl:copy-of select="$subtitle"/>
1452 <xsl:template match="*" mode="insert.label.markup">
1453 <xsl:param name="purpose"/>
1454 <xsl:param name="xrefstyle"/>
1455 <xsl:param name="label"/>
1457 <xsl:copy-of select="$label"/>
1460 <xsl:template match="*" mode="insert.pagenumber.markup">
1461 <xsl:param name="purpose"/>
1462 <xsl:param name="xrefstyle"/>
1463 <xsl:param name="pagenumber"/>
1465 <xsl:copy-of select="$pagenumber"/>
1468 <xsl:template match="*" mode="insert.direction.markup">
1469 <xsl:param name="purpose"/>
1470 <xsl:param name="xrefstyle"/>
1471 <xsl:param name="direction"/>
1473 <xsl:copy-of select="$direction"/>
1476 <xsl:template match="olink" mode="pagenumber.markup">
1477 <!-- Local olinks can use page-citation -->
1478 <xsl:variable name="targetdoc.att" select="@targetdoc"/>
1479 <xsl:variable name="targetptr.att" select="@targetptr"/>
1481 <xsl:variable name="olink.lang">
1482 <xsl:call-template name="l10n.language">
1483 <xsl:with-param name="xref-context" select="true()"/>
1484 </xsl:call-template>
1487 <xsl:variable name="target.database.filename">
1488 <xsl:call-template name="select.target.database">
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:call-template>
1495 <xsl:variable name="target.database"
1496 select="document($target.database.filename, /)"/>
1498 <xsl:if test="$olink.debug != 0">
1500 <xsl:text>Olink debug: root element of target.database is '</xsl:text>
1501 <xsl:value-of select="local-name($target.database/*[1])"/>
1502 <xsl:text>'.</xsl:text>
1506 <xsl:variable name="olink.key">
1507 <xsl:call-template name="select.olink.key">
1508 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1509 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1510 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1511 <xsl:with-param name="target.database" select="$target.database"/>
1512 </xsl:call-template>
1515 <!-- Olink that points to internal id can be a link -->
1516 <xsl:variable name="linkend">
1517 <xsl:call-template name="olink.as.linkend">
1518 <xsl:with-param name="olink.key" select="$olink.key"/>
1519 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1520 <xsl:with-param name="target.database" select="$target.database"/>
1521 </xsl:call-template>
1525 <xsl:when test="$linkend != ''">
1526 <fo:page-number-citation ref-id="{$linkend}"/>
1530 <xsl:text>Olink error: no page number linkend for local olink '</xsl:text>
1531 <xsl:value-of select="$olink.key"/>
1532 <xsl:text>'</xsl:text>