1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks" xmlns:exsl="http://exslt.org/common" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="suwl exsl xlink" version="1.0">
6 <!-- ********************************************************************
7 $Id: xref.xsl 8421 2009-05-04 07:49:49Z bobstayton $
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
14 ******************************************************************** -->
16 <!-- Use internal variable for olink xlink role for consistency -->
17 <xsl:variable name="xolink.role">http://docbook.org/xlink/role/olink</xsl:variable>
19 <!-- ==================================================================== -->
21 <xsl:template match="anchor">
22 <xsl:call-template name="anchor"/>
25 <!-- ==================================================================== -->
27 <xsl:template match="xref" name="xref">
28 <xsl:param name="xhref" select="@xlink:href"/>
29 <!-- is the @xlink:href a local idref link? -->
30 <xsl:param name="xlink.idref">
31 <xsl:if test="starts-with($xhref,'#') and (not(contains($xhref,'(')) or starts-with($xhref, '#xpointer(id('))">
32 <xsl:call-template name="xpointer.idref">
33 <xsl:with-param name="xpointer" select="$xhref"/>
37 <xsl:param name="xlink.targets" select="key('id',$xlink.idref)"/>
38 <xsl:param name="linkend.targets" select="key('id',@linkend)"/>
39 <xsl:param name="target" select="($xlink.targets | $linkend.targets)[1]"/>
41 <xsl:variable name="xrefstyle">
43 <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
44 <xsl:value-of select="@role"/>
47 <xsl:value-of select="@xrefstyle"/>
52 <xsl:call-template name="anchor"/>
54 <xsl:variable name="content">
57 <xsl:when test="@endterm">
58 <xsl:variable name="etargets" select="key('id',@endterm)"/>
59 <xsl:variable name="etarget" select="$etargets[1]"/>
61 <xsl:when test="count($etarget) = 0">
63 <xsl:value-of select="count($etargets)"/>
64 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
65 <xsl:value-of select="@endterm"/>
67 <xsl:text>???</xsl:text>
70 <xsl:apply-templates select="$etarget" mode="endterm"/>
75 <xsl:when test="$target/@xreflabel">
76 <xsl:call-template name="xref.xreflabel">
77 <xsl:with-param name="target" select="$target"/>
81 <xsl:when test="$target">
82 <xsl:if test="not(parent::citation)">
83 <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
86 <xsl:apply-templates select="$target" mode="xref-to">
87 <xsl:with-param name="referrer" select="."/>
88 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
89 </xsl:apply-templates>
91 <xsl:if test="not(parent::citation)">
92 <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
98 <xsl:text>ERROR: xref linking to </xsl:text>
99 <xsl:value-of select="@linkend|@xlink:href"/>
100 <xsl:text> has no generated link text.</xsl:text>
102 <xsl:text>???</xsl:text>
107 <xsl:call-template name="simple.xlink">
108 <xsl:with-param name="content" select="$content"/>
113 <!-- ==================================================================== -->
115 <!-- biblioref handled largely like an xref -->
116 <!-- To be done: add support for begin, end, and units attributes -->
117 <xsl:template match="biblioref">
118 <xsl:variable name="targets" select="key('id',@linkend)"/>
119 <xsl:variable name="target" select="$targets[1]"/>
120 <xsl:variable name="refelem" select="local-name($target)"/>
122 <xsl:call-template name="check.id.unique">
123 <xsl:with-param name="linkend" select="@linkend"/>
126 <xsl:call-template name="anchor"/>
129 <xsl:when test="count($target) = 0">
131 <xsl:text>XRef to nonexistent id: </xsl:text>
132 <xsl:value-of select="@linkend"/>
134 <xsl:text>???</xsl:text>
137 <xsl:when test="@endterm">
138 <xsl:variable name="href">
139 <xsl:call-template name="href.target">
140 <xsl:with-param name="object" select="$target"/>
144 <xsl:variable name="etargets" select="key('id',@endterm)"/>
145 <xsl:variable name="etarget" select="$etargets[1]"/>
147 <xsl:when test="count($etarget) = 0">
149 <xsl:value-of select="count($etargets)"/>
150 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
151 <xsl:value-of select="@endterm"/>
154 <xsl:apply-templates select="." mode="common.html.attributes"/>
155 <xsl:text>???</xsl:text>
160 <xsl:apply-templates select="." mode="common.html.attributes"/>
161 <xsl:apply-templates select="$etarget" mode="endterm"/>
167 <xsl:when test="$target/@xreflabel">
169 <xsl:apply-templates select="." mode="common.html.attributes"/>
170 <xsl:attribute name="href">
171 <xsl:call-template name="href.target">
172 <xsl:with-param name="object" select="$target"/>
175 <xsl:call-template name="xref.xreflabel">
176 <xsl:with-param name="target" select="$target"/>
182 <xsl:variable name="href">
183 <xsl:call-template name="href.target">
184 <xsl:with-param name="object" select="$target"/>
188 <xsl:if test="not(parent::citation)">
189 <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
193 <xsl:apply-templates select="." mode="class.attribute"/>
194 <xsl:if test="$target/title or $target/*/title">
195 <xsl:attribute name="title">
196 <xsl:apply-templates select="$target" mode="xref-title"/>
199 <xsl:apply-templates select="$target" mode="xref-to">
200 <xsl:with-param name="referrer" select="."/>
201 <xsl:with-param name="xrefstyle">
203 <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
204 <xsl:value-of select="@role"/>
207 <xsl:value-of select="@xrefstyle"/>
211 </xsl:apply-templates>
214 <xsl:if test="not(parent::citation)">
215 <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
221 <!-- ==================================================================== -->
223 <xsl:template match="*" mode="endterm">
224 <!-- Process the children of the endterm element -->
225 <xsl:variable name="endterm">
226 <xsl:apply-templates select="child::node()"/>
230 <xsl:when test="$exsl.node.set.available != 0">
231 <xsl:apply-templates select="exsl:node-set($endterm)" mode="remove-ids"/>
234 <xsl:copy-of select="$endterm"/>
239 <xsl:template match="*" mode="remove-ids">
241 <!-- handle html or xhtml -->
242 <xsl:when test="local-name(.) = 'a' and (namespace-uri(.) = '' or namespace-uri(.) = 'http://www.w3.org/1999/xhtml')">
244 <xsl:when test="(@name and count(@*) = 1) or (@id and count(@*) = 1) or (@xml:id and count(@*) = 1) or (@xml:id and @name and count(@*) = 2) or (@id and @name and count(@*) = 2)">
245 <xsl:message>suppress anchor</xsl:message>
246 <!-- suppress the whole thing -->
250 <xsl:for-each select="@*">
252 <xsl:when test="local-name(.) != 'name' and local-name(.) != 'id'">
256 <xsl:message>removing <xsl:value-of select="local-name(.)"/></xsl:message>
261 <xsl:apply-templates mode="remove-ids"/>
267 <xsl:for-each select="@*">
269 <xsl:when test="local-name(.) != 'id'">
273 <xsl:message>removing <xsl:value-of select="local-name(.)"/></xsl:message>
277 <xsl:apply-templates mode="remove-ids"/>
283 <!-- ==================================================================== -->
285 <xsl:template match="*" mode="xref-to-prefix"/>
286 <xsl:template match="*" mode="xref-to-suffix"/>
288 <xsl:template match="*" mode="xref-to">
289 <xsl:param name="referrer"/>
290 <xsl:param name="xrefstyle"/>
291 <xsl:param name="verbose" select="1"/>
293 <xsl:if test="$verbose">
295 <xsl:text>Don't know what gentext to create for xref to: "</xsl:text>
296 <xsl:value-of select="name(.)"/>
297 <xsl:text>", ("</xsl:text>
298 <xsl:value-of select="(@id|@xml:id)[1]"/>
299 <xsl:text>")</xsl:text>
302 <xsl:text>???</xsl:text>
305 <xsl:template match="title" mode="xref-to">
306 <xsl:param name="referrer"/>
307 <xsl:param name="xrefstyle"/>
308 <xsl:param name="verbose" select="1"/>
310 <!-- if you xref to a title, xref to the parent... -->
312 <!-- FIXME: how reliable is this? -->
313 <xsl:when test="contains(local-name(parent::*), 'info')">
314 <xsl:apply-templates select="parent::*[2]" mode="xref-to">
315 <xsl:with-param name="referrer" select="$referrer"/>
316 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
317 <xsl:with-param name="verbose" select="$verbose"/>
318 </xsl:apply-templates>
321 <xsl:apply-templates select="parent::*" mode="xref-to">
322 <xsl:with-param name="referrer" select="$referrer"/>
323 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
324 <xsl:with-param name="verbose" select="$verbose"/>
325 </xsl:apply-templates>
330 <xsl:template match="abstract|authorblurb|personblurb|bibliodiv|bibliomset |biblioset|blockquote|calloutlist|caution|colophon |constraintdef|formalpara|glossdiv|important|indexdiv |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain |msgrel|msgset|msgsub|note|orderedlist|partintro |productionset|qandadiv|refsynopsisdiv|segmentedlist |set|setindex|sidebar|tip|toc|variablelist|warning" mode="xref-to">
331 <xsl:param name="referrer"/>
332 <xsl:param name="xrefstyle"/>
333 <xsl:param name="verbose" select="1"/>
335 <!-- catch-all for things with (possibly optional) titles -->
336 <xsl:apply-templates select="." mode="object.xref.markup">
337 <xsl:with-param name="purpose" select="'xref'"/>
338 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
339 <xsl:with-param name="referrer" select="$referrer"/>
340 <xsl:with-param name="verbose" select="$verbose"/>
341 </xsl:apply-templates>
344 <xsl:template match="author|editor|othercredit|personname" mode="xref-to">
345 <xsl:param name="referrer"/>
346 <xsl:param name="xrefstyle"/>
348 <xsl:call-template name="person.name"/>
351 <xsl:template match="authorgroup" mode="xref-to">
352 <xsl:param name="referrer"/>
353 <xsl:param name="xrefstyle"/>
355 <xsl:call-template name="person.name.list"/>
358 <xsl:template match="figure|example|table|equation" mode="xref-to">
359 <xsl:param name="referrer"/>
360 <xsl:param name="xrefstyle"/>
361 <xsl:param name="verbose" select="1"/>
363 <xsl:apply-templates select="." mode="object.xref.markup">
364 <xsl:with-param name="purpose" select="'xref'"/>
365 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
366 <xsl:with-param name="referrer" select="$referrer"/>
367 <xsl:with-param name="verbose" select="$verbose"/>
368 </xsl:apply-templates>
371 <xsl:template match="procedure" mode="xref-to">
372 <xsl:param name="referrer"/>
373 <xsl:param name="xrefstyle"/>
374 <xsl:param name="verbose"/>
376 <xsl:apply-templates select="." mode="object.xref.markup">
377 <xsl:with-param name="purpose" select="'xref'"/>
378 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
379 <xsl:with-param name="referrer" select="$referrer"/>
380 <xsl:with-param name="verbose" select="$verbose"/>
381 </xsl:apply-templates>
384 <xsl:template match="task" mode="xref-to">
385 <xsl:param name="referrer"/>
386 <xsl:param name="xrefstyle"/>
387 <xsl:param name="verbose"/>
389 <xsl:apply-templates select="." mode="object.xref.markup">
390 <xsl:with-param name="purpose" select="'xref'"/>
391 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
392 <xsl:with-param name="referrer" select="$referrer"/>
393 <xsl:with-param name="verbose" select="$verbose"/>
394 </xsl:apply-templates>
397 <xsl:template match="cmdsynopsis" mode="xref-to">
398 <xsl:apply-templates select="(.//command)[1]" mode="xref"/>
401 <xsl:template match="funcsynopsis" mode="xref-to">
402 <xsl:apply-templates select="(.//function)[1]" mode="xref"/>
405 <xsl:template match="dedication|acknowledgements|preface|chapter|appendix|article" mode="xref-to">
406 <xsl:param name="referrer"/>
407 <xsl:param name="xrefstyle"/>
408 <xsl:param name="verbose" select="1"/>
410 <xsl:apply-templates select="." mode="object.xref.markup">
411 <xsl:with-param name="purpose" select="'xref'"/>
412 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
413 <xsl:with-param name="referrer" select="$referrer"/>
414 <xsl:with-param name="verbose" select="$verbose"/>
415 </xsl:apply-templates>
418 <xsl:template match="bibliography" mode="xref-to">
419 <xsl:param name="referrer"/>
420 <xsl:param name="xrefstyle"/>
421 <xsl:param name="verbose" select="1"/>
423 <xsl:apply-templates select="." mode="object.xref.markup">
424 <xsl:with-param name="purpose" select="'xref'"/>
425 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
426 <xsl:with-param name="referrer" select="$referrer"/>
427 <xsl:with-param name="verbose" select="$verbose"/>
428 </xsl:apply-templates>
431 <xsl:template match="biblioentry|bibliomixed" mode="xref-to-prefix">
432 <xsl:text>[</xsl:text>
435 <xsl:template match="biblioentry|bibliomixed" mode="xref-to-suffix">
436 <xsl:text>]</xsl:text>
439 <xsl:template match="biblioentry|bibliomixed" mode="xref-to">
440 <xsl:param name="referrer"/>
441 <xsl:param name="xrefstyle"/>
442 <xsl:param name="verbose" select="1"/>
444 <!-- handles both biblioentry and bibliomixed -->
446 <xsl:when test="string(.) = ''">
447 <xsl:variable name="bib" select="document($bibliography.collection,.)"/>
448 <xsl:variable name="id" select="(@id|@xml:id)[1]"/>
449 <xsl:variable name="entry" select="$bib/bibliography/ *[@id=$id or @xml:id=$id][1]"/>
451 <xsl:when test="$entry">
453 <xsl:when test="$bibliography.numbered != 0">
454 <xsl:number from="bibliography" count="biblioentry|bibliomixed" level="any" format="1"/>
456 <xsl:when test="local-name($entry/*[1]) = 'abbrev'">
457 <xsl:apply-templates select="$entry/*[1]"/>
460 <xsl:value-of select="(@id|@xml:id)[1]"/>
466 <xsl:text>No bibliography entry: </xsl:text>
467 <xsl:value-of select="$id"/>
468 <xsl:text> found in </xsl:text>
469 <xsl:value-of select="$bibliography.collection"/>
471 <xsl:value-of select="(@id|@xml:id)[1]"/>
477 <xsl:when test="$bibliography.numbered != 0">
478 <xsl:number from="bibliography" count="biblioentry|bibliomixed" level="any" format="1"/>
480 <xsl:when test="local-name(*[1]) = 'abbrev'">
481 <xsl:apply-templates select="*[1]"/>
484 <xsl:value-of select="(@id|@xml:id)[1]"/>
491 <xsl:template match="glossary" mode="xref-to">
492 <xsl:param name="referrer"/>
493 <xsl:param name="xrefstyle"/>
494 <xsl:param name="verbose" select="1"/>
496 <xsl:apply-templates select="." mode="object.xref.markup">
497 <xsl:with-param name="purpose" select="'xref'"/>
498 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
499 <xsl:with-param name="referrer" select="$referrer"/>
500 <xsl:with-param name="verbose" select="$verbose"/>
501 </xsl:apply-templates>
504 <xsl:template match="glossentry" mode="xref-to">
505 <xsl:param name="referrer"/>
506 <xsl:param name="xrefstyle"/>
507 <xsl:param name="verbose" select="1"/>
509 <xsl:when test="$glossentry.show.acronym = 'primary'">
511 <xsl:when test="acronym|abbrev">
512 <xsl:apply-templates select="(acronym|abbrev)[1]"/>
515 <xsl:apply-templates select="glossterm[1]" mode="xref-to">
516 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
517 <xsl:with-param name="referrer" select="$referrer"/>
518 <xsl:with-param name="verbose" select="$verbose"/>
519 </xsl:apply-templates>
524 <xsl:apply-templates select="glossterm[1]" mode="xref-to">
525 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
526 <xsl:with-param name="referrer" select="$referrer"/>
527 <xsl:with-param name="verbose" select="$verbose"/>
528 </xsl:apply-templates>
533 <xsl:template match="glossterm|firstterm" mode="xref-to">
534 <xsl:apply-templates/>
537 <xsl:template match="index" mode="xref-to">
538 <xsl:param name="referrer"/>
539 <xsl:param name="xrefstyle"/>
540 <xsl:param name="verbose" select="1"/>
542 <xsl:apply-templates select="." mode="object.xref.markup">
543 <xsl:with-param name="purpose" select="'xref'"/>
544 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
545 <xsl:with-param name="referrer" select="$referrer"/>
546 <xsl:with-param name="verbose" select="$verbose"/>
547 </xsl:apply-templates>
550 <xsl:template match="listitem" mode="xref-to">
551 <xsl:param name="referrer"/>
552 <xsl:param name="xrefstyle"/>
553 <xsl:param name="verbose"/>
555 <xsl:apply-templates select="." mode="object.xref.markup">
556 <xsl:with-param name="purpose" select="'xref'"/>
557 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
558 <xsl:with-param name="referrer" select="$referrer"/>
559 <xsl:with-param name="verbose" select="$verbose"/>
560 </xsl:apply-templates>
563 <xsl:template match="section|simplesect |sect1|sect2|sect3|sect4|sect5 |refsect1|refsect2|refsect3|refsection" mode="xref-to">
564 <xsl:param name="referrer"/>
565 <xsl:param name="xrefstyle"/>
566 <xsl:param name="verbose" select="1"/>
568 <xsl:apply-templates select="." mode="object.xref.markup">
569 <xsl:with-param name="purpose" select="'xref'"/>
570 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
571 <xsl:with-param name="referrer" select="$referrer"/>
572 <xsl:with-param name="verbose" select="$verbose"/>
573 </xsl:apply-templates>
574 <!-- FIXME: What about "in Chapter X"? -->
577 <xsl:template match="bridgehead" mode="xref-to">
578 <xsl:param name="referrer"/>
579 <xsl:param name="xrefstyle"/>
580 <xsl:param name="verbose" select="1"/>
582 <xsl:apply-templates select="." mode="object.xref.markup">
583 <xsl:with-param name="purpose" select="'xref'"/>
584 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
585 <xsl:with-param name="referrer" select="$referrer"/>
586 <xsl:with-param name="verbose" select="$verbose"/>
587 </xsl:apply-templates>
588 <!-- FIXME: What about "in Chapter X"? -->
591 <xsl:template match="qandaset" mode="xref-to">
592 <xsl:param name="referrer"/>
593 <xsl:param name="xrefstyle"/>
594 <xsl:param name="verbose" select="1"/>
596 <xsl:apply-templates select="." mode="object.xref.markup">
597 <xsl:with-param name="purpose" select="'xref'"/>
598 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
599 <xsl:with-param name="referrer" select="$referrer"/>
600 <xsl:with-param name="verbose" select="$verbose"/>
601 </xsl:apply-templates>
604 <xsl:template match="qandadiv" mode="xref-to">
605 <xsl:param name="referrer"/>
606 <xsl:param name="xrefstyle"/>
607 <xsl:param name="verbose" select="1"/>
609 <xsl:apply-templates select="." mode="object.xref.markup">
610 <xsl:with-param name="purpose" select="'xref'"/>
611 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
612 <xsl:with-param name="referrer" select="$referrer"/>
613 <xsl:with-param name="verbose" select="$verbose"/>
614 </xsl:apply-templates>
617 <xsl:template match="qandaentry" mode="xref-to">
618 <xsl:param name="referrer"/>
619 <xsl:param name="xrefstyle"/>
620 <xsl:param name="verbose" select="1"/>
622 <xsl:apply-templates select="question[1]" mode="xref-to">
623 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
624 <xsl:with-param name="referrer" select="$referrer"/>
625 <xsl:with-param name="verbose" select="$verbose"/>
626 </xsl:apply-templates>
629 <xsl:template match="question|answer" mode="xref-to">
630 <xsl:param name="referrer"/>
631 <xsl:param name="xrefstyle"/>
632 <xsl:param name="verbose" select="1"/>
635 <xsl:when test="string-length(label) != 0">
636 <xsl:apply-templates select="." mode="label.markup"/>
639 <xsl:apply-templates select="." mode="object.xref.markup">
640 <xsl:with-param name="purpose" select="'xref'"/>
641 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
642 <xsl:with-param name="referrer" select="$referrer"/>
643 <xsl:with-param name="verbose" select="$verbose"/>
644 </xsl:apply-templates>
649 <xsl:template match="part|reference" mode="xref-to">
650 <xsl:param name="referrer"/>
651 <xsl:param name="xrefstyle"/>
652 <xsl:param name="verbose" select="1"/>
654 <xsl:apply-templates select="." mode="object.xref.markup">
655 <xsl:with-param name="purpose" select="'xref'"/>
656 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
657 <xsl:with-param name="referrer" select="$referrer"/>
658 <xsl:with-param name="verbose" select="$verbose"/>
659 </xsl:apply-templates>
662 <xsl:template match="refentry" mode="xref-to">
663 <xsl:param name="referrer"/>
664 <xsl:param name="xrefstyle"/>
667 <xsl:when test="refmeta/refentrytitle">
668 <xsl:apply-templates select="refmeta/refentrytitle"/>
671 <xsl:apply-templates select="refnamediv/refname[1]"/>
674 <xsl:apply-templates select="refmeta/manvolnum"/>
677 <xsl:template match="refnamediv" mode="xref-to">
678 <xsl:param name="referrer"/>
679 <xsl:param name="xrefstyle"/>
680 <xsl:param name="verbose" select="1"/>
682 <xsl:apply-templates select="refname[1]" mode="xref-to">
683 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
684 <xsl:with-param name="referrer" select="$referrer"/>
685 <xsl:with-param name="verbose" select="$verbose"/>
686 </xsl:apply-templates>
689 <xsl:template match="refname" mode="xref-to">
690 <xsl:param name="referrer"/>
691 <xsl:param name="xrefstyle"/>
692 <xsl:param name="verbose" select="1"/>
694 <xsl:apply-templates mode="xref-to"/>
697 <xsl:template match="step" mode="xref-to">
698 <xsl:param name="referrer"/>
699 <xsl:param name="xrefstyle"/>
701 <xsl:call-template name="gentext">
702 <xsl:with-param name="key" select="'Step'"/>
704 <xsl:text> </xsl:text>
705 <xsl:apply-templates select="." mode="number"/>
708 <xsl:template match="varlistentry" mode="xref-to">
709 <xsl:param name="referrer"/>
710 <xsl:param name="xrefstyle"/>
711 <xsl:param name="verbose" select="1"/>
713 <xsl:apply-templates select="term[1]" mode="xref-to">
714 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
715 <xsl:with-param name="referrer" select="$referrer"/>
716 <xsl:with-param name="verbose" select="$verbose"/>
717 </xsl:apply-templates>
720 <xsl:template match="primary|secondary|tertiary" mode="xref-to">
721 <xsl:value-of select="."/>
724 <xsl:template match="indexterm" mode="xref-to">
725 <xsl:value-of select="primary"/>
728 <xsl:template match="varlistentry/term" mode="xref-to">
729 <xsl:param name="referrer"/>
730 <xsl:param name="xrefstyle"/>
732 <!-- to avoid the comma that will be generated if there are several terms -->
733 <xsl:apply-templates/>
736 <xsl:template match="co" mode="xref-to">
737 <xsl:param name="referrer"/>
738 <xsl:param name="xrefstyle"/>
740 <xsl:apply-templates select="." mode="callout-bug"/>
743 <xsl:template match="area|areaset" mode="xref-to">
744 <xsl:param name="referrer"/>
745 <xsl:param name="xrefstyle"/>
747 <xsl:call-template name="callout-bug">
748 <xsl:with-param name="conum">
749 <xsl:apply-templates select="." mode="conumber"/>
754 <xsl:template match="book" mode="xref-to">
755 <xsl:param name="referrer"/>
756 <xsl:param name="xrefstyle"/>
757 <xsl:param name="verbose" select="1"/>
759 <xsl:apply-templates select="." mode="object.xref.markup">
760 <xsl:with-param name="purpose" select="'xref'"/>
761 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
762 <xsl:with-param name="referrer" select="$referrer"/>
763 <xsl:with-param name="verbose" select="$verbose"/>
764 </xsl:apply-templates>
767 <!-- These are elements for which no link text exists, so an xref to one
768 uses the xrefstyle attribute if specified, or if not it falls back
769 to the container element's link text -->
770 <xsl:template match="para|phrase|simpara|anchor|quote" mode="xref-to">
771 <xsl:param name="referrer"/>
772 <xsl:param name="xrefstyle"/>
773 <xsl:param name="verbose" select="1"/>
775 <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::acknowledgements |ancestor::colophon |ancestor::bibliography |ancestor::index |ancestor::glossary |ancestor::glossentry |ancestor::listitem |ancestor::varlistentry)[last()]"/>
778 <xsl:when test="$xrefstyle != ''">
779 <xsl:apply-templates select="." mode="object.xref.markup">
780 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
781 <xsl:with-param name="referrer" select="$referrer"/>
782 <xsl:with-param name="verbose" select="$verbose"/>
783 </xsl:apply-templates>
786 <xsl:apply-templates select="$context" mode="xref-to">
787 <xsl:with-param name="purpose" select="'xref'"/>
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>
796 <!-- ==================================================================== -->
798 <xsl:template match="*" mode="xref-title">
799 <xsl:variable name="title">
800 <xsl:apply-templates select="." mode="object.title.markup"/>
803 <xsl:value-of select="$title"/>
806 <xsl:template match="author" mode="xref-title">
807 <xsl:variable name="title">
808 <xsl:call-template name="person.name"/>
811 <xsl:value-of select="$title"/>
814 <xsl:template match="authorgroup" mode="xref-title">
815 <xsl:variable name="title">
816 <xsl:call-template name="person.name.list"/>
819 <xsl:value-of select="$title"/>
822 <xsl:template match="cmdsynopsis" mode="xref-title">
823 <xsl:variable name="title">
824 <xsl:apply-templates select="(.//command)[1]" mode="xref"/>
827 <xsl:value-of select="$title"/>
830 <xsl:template match="funcsynopsis" mode="xref-title">
831 <xsl:variable name="title">
832 <xsl:apply-templates select="(.//function)[1]" mode="xref"/>
835 <xsl:value-of select="$title"/>
838 <xsl:template match="biblioentry|bibliomixed" mode="xref-title">
839 <!-- handles both biblioentry and bibliomixed -->
840 <xsl:variable name="title">
841 <xsl:text>[</xsl:text>
843 <xsl:when test="local-name(*[1]) = 'abbrev'">
844 <xsl:apply-templates select="*[1]"/>
847 <xsl:value-of select="(@id|@xml:id)[1]"/>
850 <xsl:text>]</xsl:text>
853 <xsl:value-of select="$title"/>
856 <xsl:template match="step" mode="xref-title">
857 <xsl:call-template name="gentext">
858 <xsl:with-param name="key" select="'Step'"/>
860 <xsl:text> </xsl:text>
861 <xsl:apply-templates select="." mode="number"/>
864 <xsl:template match="step[not(./title)]" mode="title.markup">
865 <xsl:call-template name="gentext">
866 <xsl:with-param name="key" select="'Step'"/>
868 <xsl:text> </xsl:text>
869 <xsl:apply-templates select="." mode="number"/>
872 <xsl:template match="co" mode="xref-title">
873 <xsl:variable name="title">
874 <xsl:apply-templates select="." mode="callout-bug"/>
877 <xsl:value-of select="$title"/>
880 <!-- ==================================================================== -->
882 <xsl:template match="link" name="link">
883 <xsl:param name="linkend" select="@linkend"/>
884 <xsl:param name="a.target"/>
885 <xsl:param name="xhref" select="@xlink:href"/>
887 <xsl:variable name="content">
888 <xsl:call-template name="anchor"/>
890 <xsl:when test="count(child::node()) > 0">
891 <!-- If it has content, use it -->
892 <xsl:apply-templates/>
894 <!-- else look for an endterm -->
895 <xsl:when test="@endterm">
896 <xsl:variable name="etargets" select="key('id',@endterm)"/>
897 <xsl:variable name="etarget" select="$etargets[1]"/>
899 <xsl:when test="count($etarget) = 0">
901 <xsl:value-of select="count($etargets)"/>
902 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
903 <xsl:value-of select="@endterm"/>
905 <xsl:text>???</xsl:text>
908 <xsl:apply-templates select="$etarget" mode="endterm"/>
912 <!-- Use the xlink:href if no other text -->
913 <xsl:when test="@xlink:href">
914 <xsl:value-of select="@xlink:href"/>
918 <xsl:text>Link element has no content and no Endterm. </xsl:text>
919 <xsl:text>Nothing to show in the link to </xsl:text>
920 <xsl:value-of select="(@xlink:href|@linkend)[1]"/>
922 <xsl:text>???</xsl:text>
927 <xsl:call-template name="simple.xlink">
928 <xsl:with-param name="node" select="."/>
929 <xsl:with-param name="linkend" select="$linkend"/>
930 <xsl:with-param name="content" select="$content"/>
931 <xsl:with-param name="a.target" select="$a.target"/>
932 <xsl:with-param name="xhref" select="$xhref"/>
937 <xsl:template match="ulink" name="ulink">
938 <xsl:param name="url" select="@url"/>
939 <xsl:variable name="link">
941 <xsl:apply-templates select="." mode="common.html.attributes"/>
942 <xsl:if test="@id or @xml:id">
943 <xsl:attribute name="id">
944 <xsl:value-of select="(@id|@xml:id)[1]"/>
947 <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
948 <xsl:if test="$ulink.target != ''">
949 <xsl:attribute name="target">
950 <xsl:value-of select="$ulink.target"/>
954 <xsl:when test="count(child::node())=0">
955 <xsl:value-of select="$url"/>
958 <xsl:apply-templates/>
965 <xsl:when test="function-available('suwl:unwrapLinks')">
966 <xsl:copy-of select="suwl:unwrapLinks($link)"/>
969 <xsl:copy-of select="$link"/>
974 <xsl:template match="olink" name="olink">
975 <!-- olink content may be passed in from xlink olink -->
976 <xsl:param name="content" select="NOTANELEMENT"/>
978 <xsl:call-template name="anchor"/>
980 <xsl:variable name="localinfo" select="@localinfo"/>
983 <!-- olinks resolved by stylesheet and target database -->
984 <xsl:when test="@targetdoc or @targetptr or (@xlink:role=$xolink.role and contains(@xlink:href, '#') )">
986 <xsl:variable name="targetdoc.att">
988 <xsl:when test="@targetdoc != ''">
989 <xsl:value-of select="@targetdoc"/>
991 <xsl:when test="@xlink:role=$xolink.role and contains(@xlink:href, '#')">
992 <xsl:value-of select="substring-before(@xlink:href, '#')"/>
997 <xsl:variable name="targetptr.att">
999 <xsl:when test="@targetptr != ''">
1000 <xsl:value-of select="@targetptr"/>
1002 <xsl:when test="@xlink:role=$xolink.role and contains(@xlink:href, '#')">
1003 <xsl:value-of select="substring-after(@xlink:href, '#')"/>
1008 <xsl:variable name="olink.lang">
1009 <xsl:call-template name="l10n.language">
1010 <xsl:with-param name="xref-context" select="true()"/>
1011 </xsl:call-template>
1014 <xsl:variable name="target.database.filename">
1015 <xsl:call-template name="select.target.database">
1016 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1017 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1018 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1019 </xsl:call-template>
1022 <xsl:variable name="target.database" select="document($target.database.filename,/)"/>
1024 <xsl:if test="$olink.debug != 0">
1026 <xsl:text>Olink debug: root element of target.database '</xsl:text>
1027 <xsl:value-of select="$target.database.filename"/>
1028 <xsl:text>' is '</xsl:text>
1029 <xsl:value-of select="local-name($target.database/*[1])"/>
1030 <xsl:text>'.</xsl:text>
1034 <xsl:variable name="olink.key">
1035 <xsl:call-template name="select.olink.key">
1036 <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
1037 <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
1038 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1039 <xsl:with-param name="target.database" select="$target.database"/>
1040 </xsl:call-template>
1043 <xsl:if test="string-length($olink.key) = 0">
1045 <xsl:text>Error: unresolved olink: </xsl:text>
1046 <xsl:text>targetdoc/targetptr = '</xsl:text>
1047 <xsl:value-of select="$targetdoc.att"/>
1048 <xsl:text>/</xsl:text>
1049 <xsl:value-of select="$targetptr.att"/>
1050 <xsl:text>'.</xsl:text>
1054 <xsl:variable name="href">
1055 <xsl:call-template name="make.olink.href">
1056 <xsl:with-param name="olink.key" select="$olink.key"/>
1057 <xsl:with-param name="target.database" select="$target.database"/>
1058 </xsl:call-template>
1061 <xsl:variable name="hottext">
1063 <xsl:when test="string-length($content) != 0">
1064 <xsl:copy-of select="$content"/>
1067 <xsl:call-template name="olink.hottext">
1068 <xsl:with-param name="olink.key" select="$olink.key"/>
1069 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1070 <xsl:with-param name="target.database" select="$target.database"/>
1071 </xsl:call-template>
1076 <xsl:variable name="olink.docname.citation">
1077 <xsl:call-template name="olink.document.citation">
1078 <xsl:with-param name="olink.key" select="$olink.key"/>
1079 <xsl:with-param name="target.database" select="$target.database"/>
1080 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1081 </xsl:call-template>
1084 <xsl:variable name="olink.page.citation">
1085 <xsl:call-template name="olink.page.citation">
1086 <xsl:with-param name="olink.key" select="$olink.key"/>
1087 <xsl:with-param name="target.database" select="$target.database"/>
1088 <xsl:with-param name="olink.lang" select="$olink.lang"/>
1089 </xsl:call-template>
1093 <xsl:when test="$href != ''">
1095 <xsl:apply-templates select="." mode="common.html.attributes"/>
1096 <xsl:copy-of select="$hottext"/>
1098 <xsl:copy-of select="$olink.page.citation"/>
1099 <xsl:copy-of select="$olink.docname.citation"/>
1102 <span class="olink"><xsl:copy-of select="$hottext"/></span>
1103 <xsl:copy-of select="$olink.page.citation"/>
1104 <xsl:copy-of select="$olink.docname.citation"/>
1110 <!-- Or use old olink mechanism -->
1112 <xsl:variable name="href">
1114 <xsl:when test="@linkmode">
1115 <!-- use the linkmode to get the base URI, use localinfo as fragid -->
1116 <xsl:variable name="modespec" select="key('id',@linkmode)"/>
1117 <xsl:if test="count($modespec) != 1 or local-name($modespec) != 'modespec'">
1118 <xsl:message>Warning: olink linkmode pointer is wrong.</xsl:message>
1120 <xsl:value-of select="$modespec"/>
1121 <xsl:if test="@localinfo">
1122 <xsl:text>#</xsl:text>
1123 <xsl:value-of select="@localinfo"/>
1126 <xsl:when test="@type = 'href'">
1127 <xsl:call-template name="olink.outline">
1128 <xsl:with-param name="outline.base.uri" select="unparsed-entity-uri(@targetdocent)"/>
1129 <xsl:with-param name="localinfo" select="@localinfo"/>
1130 <xsl:with-param name="return" select="'href'"/>
1131 </xsl:call-template>
1134 <xsl:value-of select="$olink.resolver"/>
1135 <xsl:text>?</xsl:text>
1136 <xsl:value-of select="$olink.sysid"/>
1137 <xsl:value-of select="unparsed-entity-uri(@targetdocent)"/>
1138 <!-- XSL gives no access to the public identifier (grumble...) -->
1139 <xsl:if test="@localinfo">
1140 <xsl:text>&</xsl:text>
1141 <xsl:value-of select="$olink.fragid"/>
1142 <xsl:value-of select="@localinfo"/>
1149 <xsl:when test="$href != ''">
1151 <xsl:apply-templates select="." mode="common.html.attributes"/>
1152 <xsl:call-template name="olink.hottext"/>
1156 <xsl:call-template name="olink.hottext"/>
1163 <xsl:template match="*" mode="pagenumber.markup">
1164 <!-- no-op in HTML -->
1168 <xsl:template name="olink.outline">
1169 <xsl:param name="outline.base.uri"/>
1170 <xsl:param name="localinfo"/>
1171 <xsl:param name="return" select="href"/>
1173 <xsl:variable name="outline-file" select="concat($outline.base.uri, $olink.outline.ext)"/>
1175 <xsl:variable name="outline" select="document($outline-file,.)/div"/>
1177 <xsl:variable name="node-href">
1179 <xsl:when test="$localinfo != ''">
1180 <xsl:variable name="node" select="$outline// *[@id=$localinfo or @xml:id=$localinfo]"/>
1181 <xsl:value-of select="$node/@href"/>
1184 <xsl:value-of select="$outline/@href"/>
1189 <xsl:variable name="node-xref">
1191 <xsl:when test="$localinfo != ''">
1192 <xsl:variable name="node" select="$outline// *[@id=$localinfo or @xml:id=$localinfo]"/>
1193 <xsl:copy-of select="$node/xref"/>
1196 <xsl:value-of select="$outline/xref"/>
1202 <xsl:when test="$return = 'href'">
1203 <xsl:value-of select="$node-href"/>
1205 <xsl:when test="$return = 'xref'">
1206 <xsl:value-of select="$node-xref"/>
1209 <xsl:copy-of select="$node-xref"/>
1214 <!-- ==================================================================== -->
1216 <xsl:template name="xref.xreflabel">
1217 <!-- called to process an xreflabel...you might use this to make -->
1218 <!-- xreflabels come out in the right font for different targets, -->
1219 <!-- for example. -->
1220 <xsl:param name="target" select="."/>
1221 <xsl:value-of select="$target/@xreflabel"/>
1224 <!-- ==================================================================== -->
1226 <xsl:template match="title" mode="xref">
1227 <xsl:apply-templates/>
1230 <xsl:template match="command" mode="xref">
1231 <xsl:call-template name="inline.boldseq"/>
1234 <xsl:template match="function" mode="xref">
1235 <xsl:call-template name="inline.monoseq"/>
1238 <!-- ==================================================================== -->
1240 <xsl:template match="*" mode="insert.title.markup">
1241 <xsl:param name="purpose"/>
1242 <xsl:param name="xrefstyle"/>
1243 <xsl:param name="title"/>
1246 <!-- FIXME: what about the case where titleabbrev is inside the info? -->
1247 <xsl:when test="$purpose = 'xref' and titleabbrev">
1248 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
1251 <xsl:copy-of select="$title"/>
1256 <xsl:template match="chapter|appendix" mode="insert.title.markup">
1257 <xsl:param name="purpose"/>
1258 <xsl:param name="xrefstyle"/>
1259 <xsl:param name="title"/>
1262 <xsl:when test="$purpose = 'xref'">
1263 <em xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
1264 <xsl:copy-of select="$title"/>
1268 <xsl:copy-of select="$title"/>
1273 <xsl:template match="*" mode="insert.subtitle.markup">
1274 <xsl:param name="purpose"/>
1275 <xsl:param name="xrefstyle"/>
1276 <xsl:param name="subtitle"/>
1278 <xsl:copy-of select="$subtitle"/>
1281 <xsl:template match="*" mode="insert.label.markup">
1282 <xsl:param name="purpose"/>
1283 <xsl:param name="xrefstyle"/>
1284 <xsl:param name="label"/>
1286 <xsl:copy-of select="$label"/>
1289 <xsl:template match="*" mode="insert.pagenumber.markup">
1290 <xsl:param name="purpose"/>
1291 <xsl:param name="xrefstyle"/>
1292 <xsl:param name="pagenumber"/>
1294 <xsl:copy-of select="$pagenumber"/>
1297 <xsl:template match="*" mode="insert.direction.markup">
1298 <xsl:param name="purpose"/>
1299 <xsl:param name="xrefstyle"/>
1300 <xsl:param name="direction"/>
1302 <xsl:copy-of select="$direction"/>
1305 <xsl:template match="*" mode="insert.olink.docname.markup">
1306 <xsl:param name="purpose"/>
1307 <xsl:param name="xrefstyle"/>
1308 <xsl:param name="docname"/>
1310 <span class="olinkdocname">
1311 <xsl:copy-of select="$docname"/>