1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets. Do not edit this file.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="suwl exsl" version="1.0">
6 <!-- ********************************************************************
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
12 and other information.
14 ******************************************************************** -->
16 <!-- ==================================================================== -->
18 <xsl:template match="anchor">
19 <xsl:call-template name="anchor"/>
22 <!-- ==================================================================== -->
24 <xsl:template match="xref" name="xref">
25 <xsl:variable name="targets" select="key('id',@linkend)"/>
26 <xsl:variable name="target" select="$targets[1]"/>
27 <xsl:variable name="refelem" select="local-name($target)"/>
29 <xsl:call-template name="check.id.unique">
30 <xsl:with-param name="linkend" select="@linkend"/>
33 <xsl:call-template name="anchor"/>
36 <xsl:when test="count($target) = 0">
38 <xsl:text>XRef to nonexistent id: </xsl:text>
39 <xsl:value-of select="@linkend"/>
41 <xsl:text>???</xsl:text>
44 <xsl:when test="@endterm">
45 <xsl:variable name="href">
46 <xsl:call-template name="href.target">
47 <xsl:with-param name="object" select="$target"/>
51 <xsl:variable name="etargets" select="key('id',@endterm)"/>
52 <xsl:variable name="etarget" select="$etargets[1]"/>
54 <xsl:when test="count($etarget) = 0">
56 <xsl:value-of select="count($etargets)"/>
57 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
58 <xsl:value-of select="@endterm"/>
61 <xsl:text>???</xsl:text>
66 <xsl:apply-templates select="$etarget" mode="endterm"/>
72 <xsl:when test="$target/@xreflabel">
74 <xsl:attribute name="href">
75 <xsl:call-template name="href.target">
76 <xsl:with-param name="object" select="$target"/>
79 <xsl:call-template name="xref.xreflabel">
80 <xsl:with-param name="target" select="$target"/>
86 <xsl:variable name="href">
87 <xsl:call-template name="href.target">
88 <xsl:with-param name="object" select="$target"/>
92 <xsl:if test="not(parent::citation)">
93 <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
97 <xsl:if test="$target/title or $target/*/title">
98 <xsl:attribute name="title">
99 <xsl:apply-templates select="$target" mode="xref-title"/>
102 <xsl:apply-templates select="$target" mode="xref-to">
103 <xsl:with-param name="referrer" select="."/>
104 <xsl:with-param name="xrefstyle">
106 <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
107 <xsl:value-of select="@role"/>
110 <xsl:value-of select="@xrefstyle"/>
114 </xsl:apply-templates>
117 <xsl:if test="not(parent::citation)">
118 <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
124 <!-- ==================================================================== -->
126 <!-- biblioref handled largely like an xref -->
127 <!-- To be done: add support for begin, end, and units attributes -->
128 <xsl:template match="biblioref">
129 <xsl:variable name="targets" select="key('id',@linkend)"/>
130 <xsl:variable name="target" select="$targets[1]"/>
131 <xsl:variable name="refelem" select="local-name($target)"/>
133 <xsl:call-template name="check.id.unique">
134 <xsl:with-param name="linkend" select="@linkend"/>
137 <xsl:call-template name="anchor"/>
140 <xsl:when test="count($target) = 0">
142 <xsl:text>XRef to nonexistent id: </xsl:text>
143 <xsl:value-of select="@linkend"/>
145 <xsl:text>???</xsl:text>
148 <xsl:when test="@endterm">
149 <xsl:variable name="href">
150 <xsl:call-template name="href.target">
151 <xsl:with-param name="object" select="$target"/>
155 <xsl:variable name="etargets" select="key('id',@endterm)"/>
156 <xsl:variable name="etarget" select="$etargets[1]"/>
158 <xsl:when test="count($etarget) = 0">
160 <xsl:value-of select="count($etargets)"/>
161 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
162 <xsl:value-of select="@endterm"/>
165 <xsl:text>???</xsl:text>
170 <xsl:apply-templates select="$etarget" mode="endterm"/>
176 <xsl:when test="$target/@xreflabel">
178 <xsl:attribute name="href">
179 <xsl:call-template name="href.target">
180 <xsl:with-param name="object" select="$target"/>
183 <xsl:call-template name="xref.xreflabel">
184 <xsl:with-param name="target" select="$target"/>
190 <xsl:variable name="href">
191 <xsl:call-template name="href.target">
192 <xsl:with-param name="object" select="$target"/>
196 <xsl:if test="not(parent::citation)">
197 <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
201 <xsl:if test="$target/title or $target/*/title">
202 <xsl:attribute name="title">
203 <xsl:apply-templates select="$target" mode="xref-title"/>
206 <xsl:apply-templates select="$target" mode="xref-to">
207 <xsl:with-param name="referrer" select="."/>
208 <xsl:with-param name="xrefstyle">
210 <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
211 <xsl:value-of select="@role"/>
214 <xsl:value-of select="@xrefstyle"/>
218 </xsl:apply-templates>
221 <xsl:if test="not(parent::citation)">
222 <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
228 <!-- ==================================================================== -->
230 <xsl:template match="*" mode="endterm">
231 <!-- Process the children of the endterm element -->
232 <xsl:variable name="endterm">
233 <xsl:apply-templates select="child::node()"/>
237 <xsl:when test="function-available('exsl:node-set')">
238 <xsl:apply-templates select="exsl:node-set($endterm)" mode="remove-ids"/>
241 <xsl:copy-of select="$endterm"/>
246 <xsl:template match="*" mode="remove-ids">
248 <!-- handle html or xhtml -->
249 <xsl:when test="local-name(.) = 'a' and (namespace-uri(.) = '' or namespace-uri(.) = 'http://www.w3.org/1999/xhtml')">
251 <xsl:when test="(@name and count(@*) = 1) or (@id and count(@*) = 1) or (@id and @name and count(@*) = 2)">
252 <xsl:message>suppress anchor</xsl:message>
253 <!-- suppress the whole thing -->
257 <xsl:for-each select="@*">
259 <xsl:when test="name(.) != 'name' and name(.) != 'id'">
263 <xsl:message>removing <xsl:value-of select="name(.)"/></xsl:message>
268 <xsl:apply-templates mode="remove-ids"/>
274 <xsl:for-each select="@*">
276 <xsl:when test="name(.) != 'id'">
280 <xsl:message>removing <xsl:value-of select="name(.)"/></xsl:message>
284 <xsl:apply-templates mode="remove-ids"/>
290 <!-- ==================================================================== -->
292 <xsl:template match="*" mode="xref-to-prefix"/>
293 <xsl:template match="*" mode="xref-to-suffix"/>
295 <xsl:template match="*" mode="xref-to">
296 <xsl:param name="referrer"/>
297 <xsl:param name="xrefstyle"/>
298 <xsl:param name="verbose" select="1"/>
300 <xsl:if test="$verbose">
302 <xsl:text>Don't know what gentext to create for xref to: "</xsl:text>
303 <xsl:value-of select="name(.)"/>
304 <xsl:text>", ("</xsl:text>
305 <xsl:value-of select="@id"/>
306 <xsl:text>")</xsl:text>
309 <xsl:text>???</xsl:text>
312 <xsl:template match="title" mode="xref-to">
313 <xsl:param name="referrer"/>
314 <xsl:param name="xrefstyle"/>
315 <xsl:param name="verbose" select="1"/>
317 <!-- if you xref to a title, xref to the parent... -->
319 <!-- FIXME: how reliable is this? -->
320 <xsl:when test="contains(local-name(parent::*), 'info')">
321 <xsl:apply-templates select="parent::*[2]" mode="xref-to">
322 <xsl:with-param name="referrer" select="$referrer"/>
323 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
324 <xsl:with-param name="verbose" select="$verbose"/>
325 </xsl:apply-templates>
328 <xsl:apply-templates select="parent::*" mode="xref-to">
329 <xsl:with-param name="referrer" select="$referrer"/>
330 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
331 <xsl:with-param name="verbose" select="$verbose"/>
332 </xsl:apply-templates>
337 <xsl:template match="abstract|authorblurb|personblurb|bibliodiv|bibliomset |biblioset|blockquote|calloutlist|caution|colophon |constraintdef|formalpara|glossdiv|important|indexdiv |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain |msgrel|msgset|msgsub|note|orderedlist|partintro |productionset|qandadiv|refsynopsisdiv|segmentedlist |set|setindex|sidebar|tip|toc|variablelist|warning" mode="xref-to">
338 <xsl:param name="referrer"/>
339 <xsl:param name="xrefstyle"/>
340 <xsl:param name="verbose" select="1"/>
342 <!-- catch-all for things with (possibly optional) titles -->
343 <xsl:apply-templates select="." mode="object.xref.markup">
344 <xsl:with-param name="purpose" select="'xref'"/>
345 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
346 <xsl:with-param name="referrer" select="$referrer"/>
347 <xsl:with-param name="verbose" select="$verbose"/>
348 </xsl:apply-templates>
351 <xsl:template match="author|editor|othercredit|personname" mode="xref-to">
352 <xsl:param name="referrer"/>
353 <xsl:param name="xrefstyle"/>
355 <xsl:call-template name="person.name"/>
358 <xsl:template match="authorgroup" mode="xref-to">
359 <xsl:param name="referrer"/>
360 <xsl:param name="xrefstyle"/>
362 <xsl:call-template name="person.name.list"/>
365 <xsl:template match="figure|example|table|equation" mode="xref-to">
366 <xsl:param name="referrer"/>
367 <xsl:param name="xrefstyle"/>
368 <xsl:param name="verbose" select="1"/>
370 <xsl:apply-templates select="." mode="object.xref.markup">
371 <xsl:with-param name="purpose" select="'xref'"/>
372 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
373 <xsl:with-param name="referrer" select="$referrer"/>
374 <xsl:with-param name="verbose" select="$verbose"/>
375 </xsl:apply-templates>
378 <xsl:template match="procedure" mode="xref-to">
379 <xsl:param name="referrer"/>
380 <xsl:param name="xrefstyle"/>
381 <xsl:param name="verbose"/>
383 <xsl:apply-templates select="." mode="object.xref.markup">
384 <xsl:with-param name="purpose" select="'xref'"/>
385 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
386 <xsl:with-param name="referrer" select="$referrer"/>
387 <xsl:with-param name="verbose" select="$verbose"/>
388 </xsl:apply-templates>
391 <xsl:template match="cmdsynopsis" mode="xref-to">
392 <xsl:apply-templates select="(.//command)[1]" mode="xref"/>
395 <xsl:template match="funcsynopsis" mode="xref-to">
396 <xsl:apply-templates select="(.//function)[1]" mode="xref"/>
399 <xsl:template match="dedication|preface|chapter|appendix|article" 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"/>
443 <xsl:variable name="entry" select="$bib/bibliography/*[@id=$id][1]"/>
445 <xsl:when test="$entry">
447 <xsl:when test="$bibliography.numbered != 0">
448 <xsl:number from="bibliography" count="biblioentry|bibliomixed" level="any" format="1"/>
450 <xsl:when test="local-name($entry/*[1]) = 'abbrev'">
451 <xsl:apply-templates select="$entry/*[1]"/>
454 <xsl:value-of select="@id"/>
460 <xsl:text>No bibliography entry: </xsl:text>
461 <xsl:value-of select="$id"/>
462 <xsl:text> found in </xsl:text>
463 <xsl:value-of select="$bibliography.collection"/>
465 <xsl:value-of select="@id"/>
471 <xsl:when test="$bibliography.numbered != 0">
472 <xsl:number from="bibliography" count="biblioentry|bibliomixed" level="any" format="1"/>
474 <xsl:when test="local-name(*[1]) = 'abbrev'">
475 <xsl:apply-templates select="*[1]"/>
478 <xsl:value-of select="@id"/>
485 <xsl:template match="glossary" mode="xref-to">
486 <xsl:param name="referrer"/>
487 <xsl:param name="xrefstyle"/>
488 <xsl:param name="verbose" select="1"/>
490 <xsl:apply-templates select="." mode="object.xref.markup">
491 <xsl:with-param name="purpose" select="'xref'"/>
492 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
493 <xsl:with-param name="referrer" select="$referrer"/>
494 <xsl:with-param name="verbose" select="$verbose"/>
495 </xsl:apply-templates>
498 <xsl:template match="glossentry" mode="xref-to">
499 <xsl:param name="referrer"/>
500 <xsl:param name="xrefstyle"/>
501 <xsl:param name="verbose" select="1"/>
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">
510 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
511 <xsl:with-param name="referrer" select="$referrer"/>
512 <xsl:with-param name="verbose" select="$verbose"/>
513 </xsl:apply-templates>
518 <xsl:apply-templates select="glossterm[1]" mode="xref-to">
519 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
520 <xsl:with-param name="referrer" select="$referrer"/>
521 <xsl:with-param name="verbose" select="$verbose"/>
522 </xsl:apply-templates>
527 <xsl:template match="glossterm" mode="xref-to">
528 <xsl:apply-templates/>
531 <xsl:template match="index" mode="xref-to">
532 <xsl:param name="referrer"/>
533 <xsl:param name="xrefstyle"/>
534 <xsl:param name="verbose" select="1"/>
536 <xsl:apply-templates select="." mode="object.xref.markup">
537 <xsl:with-param name="purpose" select="'xref'"/>
538 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
539 <xsl:with-param name="referrer" select="$referrer"/>
540 <xsl:with-param name="verbose" select="$verbose"/>
541 </xsl:apply-templates>
544 <xsl:template match="listitem" mode="xref-to">
545 <xsl:param name="referrer"/>
546 <xsl:param name="xrefstyle"/>
547 <xsl:param name="verbose"/>
549 <xsl:apply-templates select="." mode="object.xref.markup">
550 <xsl:with-param name="purpose" select="'xref'"/>
551 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
552 <xsl:with-param name="referrer" select="$referrer"/>
553 <xsl:with-param name="verbose" select="$verbose"/>
554 </xsl:apply-templates>
557 <xsl:template match="section|simplesect |sect1|sect2|sect3|sect4|sect5 |refsect1|refsect2|refsect3|refsection" mode="xref-to">
558 <xsl:param name="referrer"/>
559 <xsl:param name="xrefstyle"/>
560 <xsl:param name="verbose" select="1"/>
562 <xsl:apply-templates select="." mode="object.xref.markup">
563 <xsl:with-param name="purpose" select="'xref'"/>
564 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
565 <xsl:with-param name="referrer" select="$referrer"/>
566 <xsl:with-param name="verbose" select="$verbose"/>
567 </xsl:apply-templates>
568 <!-- FIXME: What about "in Chapter X"? -->
571 <xsl:template match="bridgehead" mode="xref-to">
572 <xsl:param name="referrer"/>
573 <xsl:param name="xrefstyle"/>
574 <xsl:param name="verbose" select="1"/>
576 <xsl:apply-templates select="." mode="object.xref.markup">
577 <xsl:with-param name="purpose" select="'xref'"/>
578 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
579 <xsl:with-param name="referrer" select="$referrer"/>
580 <xsl:with-param name="verbose" select="$verbose"/>
581 </xsl:apply-templates>
582 <!-- FIXME: What about "in Chapter X"? -->
585 <xsl:template match="qandaset" mode="xref-to">
586 <xsl:param name="referrer"/>
587 <xsl:param name="xrefstyle"/>
588 <xsl:param name="verbose" select="1"/>
590 <xsl:apply-templates select="." mode="object.xref.markup">
591 <xsl:with-param name="purpose" select="'xref'"/>
592 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
593 <xsl:with-param name="referrer" select="$referrer"/>
594 <xsl:with-param name="verbose" select="$verbose"/>
595 </xsl:apply-templates>
598 <xsl:template match="qandadiv" mode="xref-to">
599 <xsl:param name="referrer"/>
600 <xsl:param name="xrefstyle"/>
601 <xsl:param name="verbose" select="1"/>
603 <xsl:apply-templates select="." mode="object.xref.markup">
604 <xsl:with-param name="purpose" select="'xref'"/>
605 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
606 <xsl:with-param name="referrer" select="$referrer"/>
607 <xsl:with-param name="verbose" select="$verbose"/>
608 </xsl:apply-templates>
611 <xsl:template match="qandaentry" mode="xref-to">
612 <xsl:param name="referrer"/>
613 <xsl:param name="xrefstyle"/>
614 <xsl:param name="verbose" select="1"/>
616 <xsl:apply-templates select="question[1]" mode="object.xref.markup">
617 <xsl:with-param name="purpose" select="'xref'"/>
618 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
619 <xsl:with-param name="referrer" select="$referrer"/>
620 <xsl:with-param name="verbose" select="$verbose"/>
621 </xsl:apply-templates>
624 <xsl:template match="question|answer" mode="xref-to">
625 <xsl:param name="referrer"/>
626 <xsl:param name="xrefstyle"/>
627 <xsl:param name="verbose" select="1"/>
629 <xsl:apply-templates select="." mode="object.xref.markup">
630 <xsl:with-param name="purpose" select="'xref'"/>
631 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
632 <xsl:with-param name="referrer" select="$referrer"/>
633 <xsl:with-param name="verbose" select="$verbose"/>
634 </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"/>
655 <xsl:when test="refmeta/refentrytitle">
656 <xsl:apply-templates select="refmeta/refentrytitle"/>
659 <xsl:apply-templates select="refnamediv/refname[1]"/>
662 <xsl:apply-templates select="refmeta/manvolnum"/>
665 <xsl:template match="refnamediv" mode="xref-to">
666 <xsl:param name="referrer"/>
667 <xsl:param name="xrefstyle"/>
668 <xsl:param name="verbose" select="1"/>
670 <xsl:apply-templates select="refname[1]" mode="xref-to">
671 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
672 <xsl:with-param name="referrer" select="$referrer"/>
673 <xsl:with-param name="verbose" select="$verbose"/>
674 </xsl:apply-templates>
677 <xsl:template match="refname" mode="xref-to">
678 <xsl:param name="referrer"/>
679 <xsl:param name="xrefstyle"/>
680 <xsl:param name="verbose" select="1"/>
682 <xsl:apply-templates mode="xref-to"/>
685 <xsl:template match="step" mode="xref-to">
686 <xsl:param name="referrer"/>
687 <xsl:param name="xrefstyle"/>
689 <xsl:call-template name="gentext">
690 <xsl:with-param name="key" select="'Step'"/>
692 <xsl:text> </xsl:text>
693 <xsl:apply-templates select="." mode="number"/>
696 <xsl:template match="varlistentry" mode="xref-to">
697 <xsl:param name="referrer"/>
698 <xsl:param name="xrefstyle"/>
699 <xsl:param name="verbose" select="1"/>
701 <xsl:apply-templates select="term[1]" mode="xref-to">
702 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
703 <xsl:with-param name="referrer" select="$referrer"/>
704 <xsl:with-param name="verbose" select="$verbose"/>
705 </xsl:apply-templates>
708 <xsl:template match="varlistentry/term" mode="xref-to">
709 <xsl:param name="referrer"/>
710 <xsl:param name="xrefstyle"/>
712 <!-- to avoid the comma that will be generated if there are several terms -->
713 <xsl:apply-templates/>
716 <xsl:template match="co" mode="xref-to">
717 <xsl:param name="referrer"/>
718 <xsl:param name="xrefstyle"/>
720 <xsl:apply-templates select="." mode="callout-bug"/>
723 <xsl:template match="book" mode="xref-to">
724 <xsl:param name="referrer"/>
725 <xsl:param name="xrefstyle"/>
726 <xsl:param name="verbose" select="1"/>
728 <xsl:apply-templates select="." mode="object.xref.markup">
729 <xsl:with-param name="purpose" select="'xref'"/>
730 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
731 <xsl:with-param name="referrer" select="$referrer"/>
732 <xsl:with-param name="verbose" select="$verbose"/>
733 </xsl:apply-templates>
736 <xsl:template match="para" mode="xref-to">
737 <xsl:param name="referrer"/>
738 <xsl:param name="xrefstyle"/>
739 <xsl:param name="verbose" select="1"/>
741 <xsl:variable name="context" select="(ancestor::simplesect |ancestor::section |ancestor::sect1 |ancestor::sect2 |ancestor::sect3 |ancestor::sect4 |ancestor::sect5 |ancestor::refsection |ancestor::refsect1 |ancestor::refsect2 |ancestor::refsect3 |ancestor::chapter |ancestor::appendix |ancestor::preface |ancestor::partintro |ancestor::dedication |ancestor::colophon |ancestor::bibliography |ancestor::index |ancestor::glossary |ancestor::glossentry |ancestor::listitem |ancestor::varlistentry)[last()]"/>
743 <xsl:apply-templates select="$context" mode="xref-to">
744 <xsl:with-param name="purpose" select="'xref'"/>
745 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
746 <xsl:with-param name="referrer" select="$referrer"/>
747 <xsl:with-param name="verbose" select="$verbose"/>
748 </xsl:apply-templates>
751 <!-- ==================================================================== -->
753 <xsl:template match="*" mode="xref-title">
754 <xsl:variable name="title">
755 <xsl:apply-templates select="." mode="object.title.markup"/>
758 <xsl:value-of select="$title"/>
761 <xsl:template match="author" mode="xref-title">
762 <xsl:variable name="title">
763 <xsl:call-template name="person.name"/>
766 <xsl:value-of select="$title"/>
769 <xsl:template match="authorgroup" mode="xref-title">
770 <xsl:variable name="title">
771 <xsl:call-template name="person.name.list"/>
774 <xsl:value-of select="$title"/>
777 <xsl:template match="cmdsynopsis" mode="xref-title">
778 <xsl:variable name="title">
779 <xsl:apply-templates select="(.//command)[1]" mode="xref"/>
782 <xsl:value-of select="$title"/>
785 <xsl:template match="funcsynopsis" mode="xref-title">
786 <xsl:variable name="title">
787 <xsl:apply-templates select="(.//function)[1]" mode="xref"/>
790 <xsl:value-of select="$title"/>
793 <xsl:template match="biblioentry|bibliomixed" mode="xref-title">
794 <!-- handles both biblioentry and bibliomixed -->
795 <xsl:variable name="title">
796 <xsl:text>[</xsl:text>
798 <xsl:when test="local-name(*[1]) = 'abbrev'">
799 <xsl:apply-templates select="*[1]"/>
802 <xsl:value-of select="@id"/>
805 <xsl:text>]</xsl:text>
808 <xsl:value-of select="$title"/>
811 <xsl:template match="step" mode="xref-title">
812 <xsl:call-template name="gentext">
813 <xsl:with-param name="key" select="'Step'"/>
815 <xsl:text> </xsl:text>
816 <xsl:apply-templates select="." mode="number"/>
819 <xsl:template match="co" mode="xref-title">
820 <xsl:variable name="title">
821 <xsl:apply-templates select="." mode="callout-bug"/>
824 <xsl:value-of select="$title"/>
827 <!-- ==================================================================== -->
829 <xsl:template match="link" name="link">
830 <xsl:param name="a.target"/>
832 <xsl:variable name="targets" select="key('id',@linkend)"/>
833 <xsl:variable name="target" select="$targets[1]"/>
835 <xsl:call-template name="check.id.unique">
836 <xsl:with-param name="linkend" select="@linkend"/>
841 <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
844 <xsl:if test="$a.target">
845 <xsl:attribute name="target"><xsl:value-of select="$a.target"/></xsl:attribute>
848 <xsl:attribute name="href">
849 <xsl:call-template name="href.target">
850 <xsl:with-param name="object" select="$target"/>
854 <!-- FIXME: is there a better way to tell what elements have a title? -->
855 <xsl:if test="local-name($target) = 'book' or local-name($target) = 'set' or local-name($target) = 'chapter' or local-name($target) = 'preface' or local-name($target) = 'appendix' or local-name($target) = 'bibliography' or local-name($target) = 'glossary' or local-name($target) = 'index' or local-name($target) = 'part' or local-name($target) = 'refentry' or local-name($target) = 'reference' or local-name($target) = 'example' or local-name($target) = 'equation' or local-name($target) = 'table' or local-name($target) = 'figure' or local-name($target) = 'simplesect' or starts-with(local-name($target),'sect') or starts-with(local-name($target),'refsect')">
856 <xsl:attribute name="title">
857 <xsl:apply-templates select="$target" mode="object.title.markup.textonly"/>
862 <xsl:when test="count(child::node()) > 0">
863 <!-- If it has content, use it -->
864 <xsl:apply-templates/>
867 <!-- else look for an endterm -->
869 <xsl:when test="@endterm">
870 <xsl:variable name="etargets" select="key('id',@endterm)"/>
871 <xsl:variable name="etarget" select="$etargets[1]"/>
873 <xsl:when test="count($etarget) = 0">
875 <xsl:value-of select="count($etargets)"/>
876 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
877 <xsl:value-of select="@endterm"/>
879 <xsl:text>???</xsl:text>
882 <xsl:apply-templates select="$etarget" mode="endterm"/>
889 <xsl:text>Link element has no content and no Endterm. </xsl:text>
890 <xsl:text>Nothing to show in the link to </xsl:text>
891 <xsl:value-of select="$target"/>
893 <xsl:text>???</xsl:text>
901 <xsl:template match="ulink" name="ulink">
902 <xsl:variable name="link">
905 <xsl:attribute name="id">
906 <xsl:value-of select="@id"/>
909 <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
910 <xsl:if test="$ulink.target != ''">
911 <xsl:attribute name="target">
912 <xsl:value-of select="$ulink.target"/>
916 <xsl:when test="count(child::node())=0">
917 <xsl:value-of select="@url"/>
920 <xsl:apply-templates/>
927 <xsl:when test="function-available('suwl:unwrapLinks')">
928 <xsl:copy-of select="suwl:unwrapLinks($link)"/>
931 <xsl:copy-of select="$link"/>
936 <xsl:template match="olink" name="olink">
938 <xsl:call-template name="anchor"/>
940 <xsl:variable name="localinfo" select="@localinfo"/>
943 <!-- olinks resolved by stylesheet and target database -->
944 <xsl:when test="@targetdoc or @targetptr">
945 <xsl:variable name="targetdoc.att" select="@targetdoc"/>
946 <xsl:variable name="targetptr.att" select="@targetptr"/>
948 <xsl:variable name="olink.lang">
949 <xsl:call-template name="l10n.language">
950 <xsl:with-param name="xref-context" select="true()"/>
954 <xsl:variable name="target.database.filename">
955 <xsl:call-template name="select.target.database">
956 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
957 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
958 <xsl:with-param name="olink.lang" select="$olink.lang"/>
962 <xsl:variable name="target.database" select="document($target.database.filename,/)"/>
964 <xsl:if test="$olink.debug != 0">
966 <xsl:text>Olink debug: root element of target.database '</xsl:text>
967 <xsl:value-of select="$target.database.filename"/>
968 <xsl:text>' is '</xsl:text>
969 <xsl:value-of select="local-name($target.database/*[1])"/>
970 <xsl:text>'.</xsl:text>
974 <xsl:variable name="olink.key">
975 <xsl:call-template name="select.olink.key">
976 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
977 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
978 <xsl:with-param name="olink.lang" select="$olink.lang"/>
979 <xsl:with-param name="target.database" select="$target.database"/>
983 <xsl:if test="string-length($olink.key) = 0">
985 <xsl:text>Error: unresolved olink: </xsl:text>
986 <xsl:text>targetdoc/targetptr = '</xsl:text>
987 <xsl:value-of select="$targetdoc.att"/>
988 <xsl:text>/</xsl:text>
989 <xsl:value-of select="$targetptr.att"/>
990 <xsl:text>'.</xsl:text>
994 <xsl:variable name="href">
995 <xsl:call-template name="make.olink.href">
996 <xsl:with-param name="olink.key" select="$olink.key"/>
997 <xsl:with-param name="target.database" select="$target.database"/>
1001 <xsl:variable name="hottext">
1002 <xsl:call-template name="olink.hottext">
1003 <xsl:with-param name="target.database" select="$target.database"/>
1004 <xsl:with-param name="olink.key" select="$olink.key"/>
1005 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1006 </xsl:call-template>
1009 <xsl:variable name="olink.docname.citation">
1010 <xsl:call-template name="olink.document.citation">
1011 <xsl:with-param name="olink.key" select="$olink.key"/>
1012 <xsl:with-param name="target.database" select="$target.database"/>
1013 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1014 </xsl:call-template>
1017 <xsl:variable name="olink.page.citation">
1018 <xsl:call-template name="olink.page.citation">
1019 <xsl:with-param name="olink.key" select="$olink.key"/>
1020 <xsl:with-param name="target.database" select="$target.database"/>
1021 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1022 </xsl:call-template>
1026 <xsl:when test="$href != ''">
1027 <a href="{$href}" class="olink">
1028 <xsl:copy-of select="$hottext"/>
1030 <xsl:copy-of select="$olink.page.citation"/>
1031 <xsl:copy-of select="$olink.docname.citation"/>
1034 <span class="olink"><xsl:copy-of select="$hottext"/></span>
1035 <xsl:copy-of select="$olink.page.citation"/>
1036 <xsl:copy-of select="$olink.docname.citation"/>
1042 <!-- Or use old olink mechanism -->
1044 <xsl:variable name="href">
1046 <xsl:when test="@linkmode">
1047 <!-- use the linkmode to get the base URI, use localinfo as fragid -->
1048 <xsl:variable name="modespec" select="key('id',@linkmode)"/>
1049 <xsl:if test="count($modespec) != 1 or local-name($modespec) != 'modespec'">
1050 <xsl:message>Warning: olink linkmode pointer is wrong.</xsl:message>
1052 <xsl:value-of select="$modespec"/>
1053 <xsl:if test="@localinfo">
1054 <xsl:text>#</xsl:text>
1055 <xsl:value-of select="@localinfo"/>
1058 <xsl:when test="@type = 'href'">
1059 <xsl:call-template name="olink.outline">
1060 <xsl:with-param name="outline.base.uri" select="unparsed-entity-uri(@targetdocent)"/>
1061 <xsl:with-param name="localinfo" select="@localinfo"/>
1062 <xsl:with-param name="return" select="'href'"/>
1063 </xsl:call-template>
1066 <xsl:value-of select="$olink.resolver"/>
1067 <xsl:text>?</xsl:text>
1068 <xsl:value-of select="$olink.sysid"/>
1069 <xsl:value-of select="unparsed-entity-uri(@targetdocent)"/>
1070 <!-- XSL gives no access to the public identifier (grumble...) -->
1071 <xsl:if test="@localinfo">
1072 <xsl:text>&</xsl:text>
1073 <xsl:value-of select="$olink.fragid"/>
1074 <xsl:value-of select="@localinfo"/>
1081 <xsl:when test="$href != ''">
1082 <a href="{$href}" class="olink">
1083 <xsl:call-template name="olink.hottext"/>
1087 <xsl:call-template name="olink.hottext"/>
1094 <xsl:template match="*" mode="pagenumber.markup">
1095 <!-- no-op in HTML -->
1099 <xsl:template name="olink.outline">
1100 <xsl:param name="outline.base.uri"/>
1101 <xsl:param name="localinfo"/>
1102 <xsl:param name="return" select="href"/>
1104 <xsl:variable name="outline-file" select="concat($outline.base.uri, $olink.outline.ext)"/>
1106 <xsl:variable name="outline" select="document($outline-file,.)/div"/>
1108 <xsl:variable name="node-href">
1110 <xsl:when test="$localinfo != ''">
1111 <xsl:variable name="node" select="$outline//*[@id=$localinfo]"/>
1112 <xsl:value-of select="$node/@href"/>
1115 <xsl:value-of select="$outline/@href"/>
1120 <xsl:variable name="node-xref">
1122 <xsl:when test="$localinfo != ''">
1123 <xsl:variable name="node" select="$outline//*[@id=$localinfo]"/>
1124 <xsl:copy-of select="$node/xref"/>
1127 <xsl:value-of select="$outline/xref"/>
1133 <xsl:when test="$return = 'href'">
1134 <xsl:value-of select="$node-href"/>
1136 <xsl:when test="$return = 'xref'">
1137 <xsl:value-of select="$node-xref"/>
1140 <xsl:copy-of select="$node-xref"/>
1145 <!-- ==================================================================== -->
1147 <xsl:template name="xref.xreflabel">
1148 <!-- called to process an xreflabel...you might use this to make -->
1149 <!-- xreflabels come out in the right font for different targets, -->
1150 <!-- for example. -->
1151 <xsl:param name="target" select="."/>
1152 <xsl:value-of select="$target/@xreflabel"/>
1155 <!-- ==================================================================== -->
1157 <xsl:template match="title" mode="xref">
1158 <xsl:apply-templates/>
1161 <xsl:template match="command" mode="xref">
1162 <xsl:call-template name="inline.boldseq"/>
1165 <xsl:template match="function" mode="xref">
1166 <xsl:call-template name="inline.monoseq"/>
1169 <!-- ==================================================================== -->
1171 <xsl:template match="*" mode="insert.title.markup">
1172 <xsl:param name="purpose"/>
1173 <xsl:param name="xrefstyle"/>
1174 <xsl:param name="title"/>
1177 <!-- FIXME: what about the case where titleabbrev is inside the info? -->
1178 <xsl:when test="$purpose = 'xref' and titleabbrev">
1179 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
1182 <xsl:copy-of select="$title"/>
1187 <xsl:template match="chapter|appendix" mode="insert.title.markup">
1188 <xsl:param name="purpose"/>
1189 <xsl:param name="xrefstyle"/>
1190 <xsl:param name="title"/>
1193 <xsl:when test="$purpose = 'xref'">
1195 <xsl:copy-of select="$title"/>
1199 <xsl:copy-of select="$title"/>
1204 <xsl:template match="*" mode="insert.subtitle.markup">
1205 <xsl:param name="purpose"/>
1206 <xsl:param name="xrefstyle"/>
1207 <xsl:param name="subtitle"/>
1209 <xsl:copy-of select="$subtitle"/>
1212 <xsl:template match="*" mode="insert.label.markup">
1213 <xsl:param name="purpose"/>
1214 <xsl:param name="xrefstyle"/>
1215 <xsl:param name="label"/>
1217 <xsl:copy-of select="$label"/>
1220 <xsl:template match="*" mode="insert.pagenumber.markup">
1221 <xsl:param name="purpose"/>
1222 <xsl:param name="xrefstyle"/>
1223 <xsl:param name="pagenumber"/>
1225 <xsl:copy-of select="$pagenumber"/>
1228 <xsl:template match="*" mode="insert.direction.markup">
1229 <xsl:param name="purpose"/>
1230 <xsl:param name="xrefstyle"/>
1231 <xsl:param name="direction"/>
1233 <xsl:copy-of select="$direction"/>
1236 <xsl:template match="*" mode="insert.olink.docname.markup">
1237 <xsl:param name="purpose"/>
1238 <xsl:param name="xrefstyle"/>
1239 <xsl:param name="docname"/>
1241 <span class="olinkdocname">
1242 <xsl:copy-of select="$docname"/>