2 <!DOCTYPE xsl:stylesheet [
<!ENTITY % xsldoc.ent SYSTEM
"./xsldoc.ent"> %xsldoc.ent; ]
>
3 <!--#############################################################################
4 | $Id: xref.mod.xsl,v 1.41 2004/01/28 02:07:08 j-devenish Exp $
5 |- #############################################################################
6 | $Author: j-devenish $
7 + ############################################################################## -->
10 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
11 xmlns:
doc=
"http://nwalsh.com/xsl/documentation/1.0"
12 exclude-result-prefixes=
"doc" version='
1.0'
>
14 <doc:reference id=
"xref" xmlns=
"">
16 <releaseinfo role=
"meta">
17 $Id: xref.mod.xsl,v
1.41 2004/
01/
28 02:
07:
08 j-devenish Exp $
24 <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
25 <holder>Ramon Casellas
</holder>
28 <doc:revision rcasver=
"1.12">&rev_2003_05;</doc:revision>
31 <title>Cross References
<filename>xref.mod.xsl
</filename></title>
35 Portions (c) Norman Walsh, official DocBook XSL stylesheets. See docbook.sf.net
41 <doc:template xmlns=
"">
42 <refpurpose>Process
<doc:db>anchor
</doc:db> elements
</refpurpose>
45 Identify a place in the document for cross references.
53 Inserts a
&LaTeX; <function condition=
"latex">hypertarget
</function>
54 with the current node's id value and no content.
55 <doc:todo>Check to see whether this causes typesetting problems
56 with
<command>latex
</command> (as opposed to
57 <command>pdflatex
</command>) due to insertion of errant
58 <literal>pdfmark
</literal>s.
</doc:todo>
62 <xsl:template match=
"anchor">
63 <xsl:param name=
"id" select=
"@id"/>
64 <xsl:text>\hypertarget{
</xsl:text>
65 <xsl:value-of select=
"$id"/>
66 <xsl:text>}{}
</xsl:text>
69 <xsl:key name=
"cross-refs" match=
"xref|link" use=
"@linkend"/>
70 <doc:template name=
"id.is.xrefed" xmlns=
"">
71 <refpurpose>Auxiliary named template
</refpurpose>
73 <para>This template returns
1 if there exists somewhere an xref
74 or link whose linkend is the target's id.
</para>
77 <xsl:template name=
"id.is.xrefed">
78 <xsl:param name=
"target" select=
"."/>
79 <xsl:variable name=
"id">
80 <xsl:call-template name=
"generate.label.id">
81 <xsl:with-param name=
"object" select=
"$target"/>
85 <xsl:when test=
"count(key('cross-refs', $id))>0">
86 <xsl:text>1</xsl:text>
89 <xsl:text>0</xsl:text>
94 <doc:template name=
"xref.xreflabel" xmlns=
"">
95 <refpurpose>Auxiliary named template
</refpurpose>
97 <para> Called to process an xreflabel...you might use this to make
98 xreflabels come out in the right font for different targets,
102 <xsl:template name=
"xref.xreflabel">
103 <xsl:param name=
"target" select=
"."/>
104 <xsl:value-of select=
"$target/@xreflabel"/>
107 <doc:template match=
"xref|link" xmlns=
"">
108 <refpurpose>Xref and Link XSL Template
</refpurpose>
111 <doc:todo>Undocumented.
</doc:todo>
116 <listitem><simpara><xref linkend=
"param.insert.xref.page.number"/></simpara></listitem>
117 <listitem><simpara><xref linkend=
"param.latex.use.varioref"/></simpara></listitem>
121 <xsl:template match=
"xref|link">
122 <xsl:variable name=
"targets" select=
"key('id',@linkend)"/>
123 <xsl:variable name=
"target" select=
"$targets[1]"/>
124 <xsl:variable name=
"refelem" select=
"local-name($target)"/>
125 <xsl:call-template name=
"check.id.unique"><xsl:with-param name=
"linkend" select=
"@linkend"/></xsl:call-template>
127 <xsl:when test=
"$refelem=''">
128 <xsl:message><xsl:text>XRef to nonexistent id:
</xsl:text><xsl:value-of select=
"@linkend"/></xsl:message>
129 <xsl:text>XrefId[?
</xsl:text>
130 <xsl:if test=
"local-name(.)='link'"><xsl:apply-templates/></xsl:if>
131 <xsl:text>?]
</xsl:text>
134 <!-- This is a link with content ... -->
135 <xsl:when test=
"local-name(.)='link' and .!=''">
136 <xsl:call-template name=
"generate.hyperlink">
137 <xsl:with-param name=
"target" select=
"$target"/>
138 <xsl:with-param name=
"text"><xsl:apply-templates/></xsl:with-param>
144 <xsl:when test=
"@endterm">
145 <xsl:variable name=
"etargets" select=
"key('id',@endterm)"/>
146 <xsl:variable name=
"etarget" select=
"$etargets[1]"/>
148 <xsl:when test=
"count($etarget) = 0">
150 <xsl:value-of select=
"count($etargets)"/>
151 <xsl:text>Endterm points to nonexistent ID:
</xsl:text>
152 <xsl:value-of select=
"@endterm"/>
154 <xsl:text>[NONEXISTENT ID]
</xsl:text>
157 <xsl:call-template name=
"generate.hyperlink">
158 <xsl:with-param name=
"target" select=
"$target"/>
159 <xsl:with-param name=
"text">
160 <xsl:call-template name=
"generate.xref.text">
161 <xsl:with-param name=
"target" select=
"$etarget"/>
168 <!-- If an xreflabel has been specified for the target ... -->
169 <xsl:when test=
"local-name(.)='xref' and $target/@xreflabel">
170 <xsl:call-template name=
"generate.hyperlink">
171 <xsl:with-param name=
"target" select=
"$target"/>
172 <xsl:with-param name=
"text">
173 <xsl:text>{[
</xsl:text>
174 <xsl:call-template name=
"xref.xreflabel">
175 <xsl:with-param name=
"target" select=
"$target"/>
177 <xsl:text>]}
</xsl:text>
182 <xsl:call-template name=
"generate.hyperlink">
183 <xsl:with-param name=
"target" select=
"$target"/>
184 <xsl:with-param name=
"text">
185 <xsl:call-template name=
"generate.xref.text">
186 <xsl:with-param name=
"target" select=
"$target"/>
194 <xsl:if test=
"$insert.xref.page.number=1 and not($latex.use.varioref='1') and $refelem!='' and local-name(.)='xref'">
195 <xsl:variable name=
"xref.text">
196 <xsl:call-template name=
"gentext.template">
197 <xsl:with-param name=
"context" select=
"'xref'"/>
198 <xsl:with-param name=
"name" select=
"'page.citation'"/>
201 <xsl:for-each select=
"$target">
202 <xsl:call-template name=
"substitute-markup">
203 <xsl:with-param name=
"template" select=
"$xref.text"/>
210 <refpurpose> Generate xref text
</refpurpose>
213 <listitem><simpara><xref linkend=
"param.use.role.as.xrefstyle"/></simpara></listitem>
217 <xsl:template name=
"generate.xref.text">
218 <xsl:param name=
"target"/>
219 <xsl:apply-templates select=
"$target" mode=
"xref-to">
220 <xsl:with-param name=
"referrer" select=
"."/>
221 <xsl:with-param name=
"xrefstyle">
223 <xsl:when test=
"@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
224 <xsl:value-of select=
"@role"/>
226 <xsl:when test=
"@xrefstyle">
227 <xsl:value-of select=
"@xrefstyle"/>
229 <xsl:when test=
"local-name($target)='title' or local-name($target)='subtitle'">
230 <xsl:value-of select=
"concat(local-name($target), '-unnumbered')"/>
233 <xsl:text>xref-number
</xsl:text>
237 </xsl:apply-templates>
240 <doc:template name=
"generate.hyperlink" xmlns=
"">
241 <refpurpose> Choose hyperlink syntax
</refpurpose>
243 <para>Will use hyperref, if it is available. Otherwise, just outputs
244 unlinked text. If the destination is a citation, a backreference is
245 emitted (even though it is technically a hyperlink, not a citation).
246 If the 'text' arises from an @endterm, then the 'optional argument'
247 syntax of
<literal>\cite
</literal> is used.
</para>
250 <xsl:template name=
"generate.hyperlink">
251 <xsl:param name=
"target"/>
252 <xsl:param name=
"text"/>
253 <xsl:variable name=
"element" select=
"local-name($target)"/>
254 <xsl:variable name=
"citation" select=
"$element='biblioentry' or $element='bibliomixed'"/>
256 <xsl:when test=
"$citation and @endterm!=''">
257 <xsl:text>\docbooktolatexcite
</xsl:text>
258 <xsl:text>{
</xsl:text>
259 <xsl:value-of select=
"$target/@id"/>
260 <xsl:text>}{
</xsl:text>
261 <xsl:call-template name=
"scape-optionalarg">
262 <xsl:with-param name=
"string" select=
"$text"/>
264 <xsl:text>}
</xsl:text>
267 <xsl:if test=
"$latex.use.hyperref=1 and not(ancestor::title)">
268 <xsl:text>\hyperlink{
</xsl:text>
269 <xsl:value-of select=
"$target/@id"/>
270 <xsl:text>}
</xsl:text>
272 <xsl:text>{
</xsl:text>
273 <xsl:if test=
"$citation">
274 <xsl:text>\docbooktolatexbackcite{
</xsl:text>
275 <xsl:value-of select=
"$target/@id"/>
276 <xsl:text>}
</xsl:text>
278 <xsl:value-of select=
"$text"/>
279 <xsl:text>}
</xsl:text>
284 <doc:template basename=
"insert.label.markup" xmlns=
"">
285 <refpurpose>Numbering template
</refpurpose>
288 Let
&LaTeX; manage the numbering. Otherwise sty files that
289 do specify another numberic (e.g I,II) get messed.
294 <listitem><simpara><xref linkend=
"param.insert.xref.page.number"/></simpara></listitem>
295 <listitem><simpara><xref linkend=
"param.latex.use.varioref"/></simpara></listitem>
299 <xsl:template match=
"*" mode=
"insert.label.markup" name=
"insert.label.markup">
300 <xsl:param name=
"id" select=
"@id"/>
302 <xsl:when test=
"$insert.xref.page.number=1 and $latex.use.varioref='1'">
303 <xsl:text>{\vref{
</xsl:text><xsl:value-of select=
"$id"/><xsl:text>}}
</xsl:text>
306 <xsl:text>{\ref{
</xsl:text><xsl:value-of select=
"$id"/><xsl:text>}}
</xsl:text>
311 <doc:template basename=
"insert.label.markup" xmlns=
"">
312 <refpurpose>Numbering template -- uses parent's @id
</refpurpose>
315 Calls
<xref linkend=
"template.insert.label.markup"/> using parent's @id.
320 <listitem><simpara><xref linkend=
"param.insert.xref.page.number"/></simpara></listitem>
321 <listitem><simpara><xref linkend=
"param.latex.use.varioref"/></simpara></listitem>
325 <xsl:template match=
"title" mode=
"insert.label.markup">
326 <xsl:call-template name=
"insert.label.markup">
327 <xsl:with-param name=
"id">
329 <xsl:when test=
"contains(local-name(..), 'info')">
330 <xsl:call-template name=
"generate.label.id">
331 <xsl:with-param name=
"object" select=
"../.."/>
335 <xsl:call-template name=
"generate.label.id">
336 <xsl:with-param name=
"object" select=
".."/>
344 <doc:template xmlns=
"">
345 <refpurpose> Format titles in xref text
</refpurpose>
350 <listitem><simpara>The text. This is expected to
351 be received from gentext.xsl, in which case it will
352 contain no deliberate
&LaTeX; commands and must be
353 escaped.
</simpara></listitem>
356 <term>is.component
</term>
357 <listitem><simpara>Whether the node is considered
358 to be a
<quote>component
</quote> in the sense of
&DocBook;.
359 If so, the formatting of the title may be different. By default,
360 the determination of component elements is performed by the
361 <literal>is.component
</literal> template in
362 <filename>common.xsl
</filename>.
</simpara></listitem>
368 Calls
<xref linkend=
"template.normalize-scape"/>. If the node
369 is a component type (e.g. appendix, article, chapter, preface,
370 bibliography, glossary or index) then gentext.startquote and
371 gentext.endquote are placed around the title.
375 <xsl:template match=
"*" mode=
"insert.title.markup" name=
"generate.title.markup">
376 <xsl:param name=
"title"/>
377 <xsl:param name=
"is.component">
378 <xsl:call-template name=
"is.component"/>
381 <xsl:when test=
"$is.component=1">
382 <xsl:call-template name=
"gentext.startquote"/>
383 <xsl:call-template name=
"normalize-scape">
384 <xsl:with-param name=
"string" select=
"$title"/>
386 <xsl:call-template name=
"gentext.endquote"/>
389 <xsl:call-template name=
"normalize-scape">
390 <xsl:with-param name=
"string" select=
"$title"/>
396 <doc:template xmlns=
"">
397 <refpurpose> Format titles in xref text
</refpurpose>
402 <listitem><simpara>The text.
</simpara></listitem>
405 <term>is.component
</term>
406 <listitem><simpara>Whether the node's parent is considered
407 to be a
<quote>component
</quote> in the sense of
&DocBook;.
408 </simpara></listitem>
414 Calls
<xref linkend=
"template.generate.title.markup"/>.
418 <xsl:template match=
"title" mode=
"insert.title.markup">
419 <xsl:param name=
"title"/>
420 <xsl:param name=
"is.component">
422 <xsl:when test=
"contains(local-name(..), 'info')">
423 <xsl:call-template name=
"is.component">
424 <xsl:with-param name=
"node" select=
"../.."/>
428 <xsl:call-template name=
"is.component">
429 <xsl:with-param name=
"node" select=
".."/>
434 <xsl:call-template name=
"generate.title.markup">
435 <xsl:with-param name=
"title" select=
"$title"/>
436 <xsl:with-param name=
"is.component" select=
"$is.component"/>
440 <doc:template xmlns=
"">
441 <refpurpose> Format titles in xref text
</refpurpose>
444 Does not add quotation marks around the title
445 but does italicise it.
449 <xsl:template match=
"book" mode=
"insert.title.markup">
450 <xsl:param name=
"title"/>
451 <xsl:text>{\textit{
</xsl:text>
452 <xsl:call-template name=
"normalize-scape">
453 <xsl:with-param name=
"string" select=
"$title"/>
455 <xsl:text>}}
</xsl:text>
458 <xsl:template match=
"*" mode=
"insert.subtitle.markup">
459 <xsl:message>Warning: unexpected insert.subtitle.markup in DB2LaTeX
</xsl:message>
462 <xsl:template match=
"*" mode=
"insert.pagenumber.markup">
463 <xsl:param name=
"target" select=
"."/>
465 <xsl:when test=
"$latex.use.varioref='1'">
466 <xsl:variable name=
"options"><xsl:call-template name=
"latex.vpageref.options"/></xsl:variable>
467 <xsl:text>\vpageref
</xsl:text>
468 <xsl:if test=
"$options!=''">
470 <xsl:when test=
"contains($options,'[')">
471 <xsl:value-of select=
"$options"/>
474 <xsl:text>[
</xsl:text>
475 <xsl:value-of select=
"$options"/>
476 <xsl:text>]
</xsl:text>
480 <xsl:text>{
</xsl:text>
483 <xsl:text>\pageref{
</xsl:text>
486 <xsl:value-of select=
"$target/@id"/>
487 <xsl:text>}
</xsl:text>
490 <xsl:template match=
"*" mode=
"insert.direction.markup">
491 <xsl:message>Warning: unexpected insert.direction.markup in DB2LaTeX
</xsl:message>
494 <doc:template match=
"ulink" xmlns=
"">
495 <refpurpose>A link that addresses its target by means of a URL (Uniform Resource Locator)
</refpurpose>
498 <listitem><simpara><xref linkend=
"param.ulink.show"/></simpara></listitem>
499 <listitem><simpara><xref linkend=
"param.ulink.footnotes"/></simpara></listitem>
500 <listitem><simpara><xref linkend=
"param.latex.ulink.protocols.relaxed"/></simpara></listitem>
501 <listitem><simpara><xref linkend=
"param.latex.hyphenation.tttricks"/></simpara></listitem>
505 <xsl:template match=
"ulink" name=
"ulink">
506 <xsl:param name=
"hyphenation">\docbookhyphenateurl
</xsl:param>
507 <xsl:param name=
"url" select=
"@url"/>
508 <xsl:param name=
"content">
509 <xsl:call-template name=
"trim-outer">
510 <xsl:with-param name=
"string" select=
"."/>
514 <xsl:when test=
"$content = '' or $content = $url">
515 <xsl:call-template name=
"generate.typeset.url">
516 <xsl:with-param name=
"hyphenation" select=
"$hyphenation"/>
517 <xsl:with-param name=
"url" select=
"$url"/>
518 <xsl:with-param name=
"prepend" select=
"''"/>
521 <xsl:when test=
"$latex.ulink.protocols.relaxed='1' and (substring-after($url,':')=$content or substring-after($url,'://')=$content)">
522 <xsl:call-template name=
"generate.typeset.url">
523 <xsl:with-param name=
"hyphenation" select=
"$hyphenation"/>
524 <xsl:with-param name=
"url" select=
"$content"/>
525 <xsl:with-param name=
"prepend" select=
"''"/>
527 <xsl:if test=
"$ulink.footnotes='1' and count(ancestor::footnote)=0">
528 <xsl:call-template name=
"generate.ulink.in.footnote">
529 <xsl:with-param name=
"hyphenation" select=
"$hyphenation"/>
530 <xsl:with-param name=
"url" select=
"$url"/>
534 <xsl:when test=
"$latex.use.tabularx=1 and count(ancestor::table)>0">
535 <xsl:apply-templates/>
536 <xsl:call-template name=
"generate.typeset.url">
537 <xsl:with-param name=
"hyphenation" select=
"$hyphenation"/>
538 <xsl:with-param name=
"url" select=
"$url"/>
541 <xsl:when test=
"$ulink.footnotes='1' or $ulink.show='1'">
542 <xsl:apply-templates/>
543 <xsl:if test=
"$ulink.footnotes='1' and count(ancestor::footnote)=0">
544 <xsl:call-template name=
"generate.ulink.in.footnote">
545 <xsl:with-param name=
"hyphenation" select=
"$hyphenation"/>
546 <xsl:with-param name=
"url" select=
"$url"/>
549 <xsl:if test=
"$ulink.show='1' or ($ulink.footnotes='1' and ancestor::footnote)">
550 <xsl:call-template name=
"generate.typeset.url">
551 <xsl:with-param name=
"hyphenation" select=
"$hyphenation"/>
552 <xsl:with-param name=
"url" select=
"$url"/>
557 <xsl:text>\href{
</xsl:text>
558 <xsl:call-template name=
"scape-href">
559 <xsl:with-param name=
"string" select=
"$url"/>
561 <xsl:text>}
</xsl:text>
562 <xsl:text>{
</xsl:text>
563 <xsl:apply-templates/>
564 <xsl:text>}
</xsl:text><!-- End Of second argument of \href -->
569 <doc:template match=
"olink" xmlns=
"">
570 <refpurpose>OLink XSL template
</refpurpose>
575 <xsl:template match=
"olink">
576 <xsl:apply-templates/>
579 <xsl:template match=
"*" name=
"title.xref">
580 <xsl:param name=
"target" select=
"."/>
582 <xsl:when test=
"name($target) = 'figure'
583 or name($target) = 'example'
584 or name($target) = 'equation'
585 or name($target) = 'table'
586 or name($target) = 'dedication'
587 or name($target) = 'preface'
588 or name($target) = 'bibliography'
589 or name($target) = 'glossary'
590 or name($target) = 'index'
591 or name($target) = 'setindex'
592 or name($target) = 'colophon'">
593 <xsl:call-template name=
"gentext.startquote"/>
594 <xsl:apply-templates select=
"$target" mode=
"title.content"/>
595 <xsl:call-template name=
"gentext.endquote"/>
598 <xsl:text>{\em
</xsl:text><xsl:apply-templates select=
"$target" mode=
"title.content"/><xsl:text>}
</xsl:text>
603 <xsl:template match=
"title" mode=
"xref">
604 <xsl:apply-templates/>
607 <xsl:template match=
"command" mode=
"xref">
608 <xsl:call-template name=
"inline.boldseq"/>
611 <xsl:template match=
"function" mode=
"xref">
612 <xsl:call-template name=
"inline.monoseq"/>
615 <doc:template xmlns=
"">
616 <refpurpose> Typeset a URL using the
<function condition=
"latex">url
</function> or
<function condition=
"latex">href
</function> commands
</refpurpose>
619 <listitem><simpara><xref linkend=
"param.latex.url.quotation"/></simpara></listitem>
623 <para>If
<xref linkend=
"param.latex.url.quotation"/> is set,
624 the
<quote>urlstartquote
</quote> and
<quote>urlendquote
</quote>
625 gentext dingbats will be emitted.
</para>
628 <xsl:template name=
"generate.typeset.url">
629 <xsl:param name=
"hyphenation"/>
630 <xsl:param name=
"url" select=
"@url"/>
631 <xsl:param name=
"prepend" select=
"' '"/>
632 <xsl:value-of select=
"$prepend"/>
633 <xsl:if test=
"$latex.url.quotation=1">
634 <xsl:call-template name=
"gentext.dingbat">
635 <xsl:with-param name=
"dingbat">urlstartquote
</xsl:with-param>
639 <xsl:when test=
"$latex.use.url='1'">
640 <xsl:text>\url{
</xsl:text>
641 <xsl:call-template name=
"scape-url">
642 <xsl:with-param name=
"string" select=
"$url"/>
644 <xsl:text>}
</xsl:text>
647 <xsl:text>\href{
</xsl:text>
648 <xsl:call-template name=
"scape-href">
649 <xsl:with-param name=
"string" select=
"$url"/>
651 <xsl:text>}{\texttt{
</xsl:text>
652 <xsl:call-template name=
"generate.string.url">
653 <xsl:with-param name=
"hyphenation" select=
"$hyphenation"/>
654 <xsl:with-param name=
"string" select=
"$url"/>
656 <xsl:text>}}
</xsl:text>
659 <xsl:if test=
"$latex.url.quotation=1">
660 <xsl:call-template name=
"gentext.dingbat">
661 <xsl:with-param name=
"dingbat">urlendquote
</xsl:with-param>
666 <doc:template name=
"generate.string.url" xmlns=
"">
667 <refpurpose>Escape and hyphenate a string as a teletype URL.
</refpurpose>
670 This template typsets teletype text using slash.hyphen if
671 $latex.hyphenation.tttricks is disabled.
672 Has two parameters: 'hyphenation' and 'string'.
676 <xsl:template name=
"generate.string.url">
677 <xsl:param name=
"hyphenation" />
678 <xsl:param name=
"string" />
679 <xsl:param name=
"url" select=
"$string"/>
681 <xsl:when test=
"$latex.hyphenation.tttricks=1">
682 <xsl:value-of select=
"$hyphenation" />
683 <xsl:text>{
</xsl:text>
684 <xsl:call-template name=
"normalize-scape"><xsl:with-param name=
"string" select=
"$string"/></xsl:call-template>
685 <xsl:text>}
</xsl:text>
688 <!-- LaTeX chars are scaped. Each / except the :// is mapped to a /\- -->
689 <xsl:call-template name=
"scape.slash.hyphen"><xsl:with-param name=
"string" select=
"$url"/></xsl:call-template>
694 <xsl:template name=
"xpath.location">
696 <xsl:param name=
"node" select=
"."/>
697 <xsl:value-of select=
"local-name($node)"/>
700 <xsl:template match=
"*" mode=
"object.xref.template">
701 <xsl:param name=
"purpose"/>
702 <xsl:param name=
"xrefstyle"/>
703 <xsl:param name=
"referrer"/>
705 <xsl:variable name=
"user-template">
706 <xsl:if test=
"$xrefstyle != '' and not(contains($xrefstyle, ':'))">
707 <xsl:call-template name=
"gentext.template.exists">
708 <xsl:with-param name=
"context" select=
"$xrefstyle"/>
709 <xsl:with-param name=
"name">
710 <xsl:call-template name=
"xpath.location"/>
716 <xsl:variable name=
"context">
718 <xsl:when test=
"$user-template = 1">
719 <xsl:value-of select=
"$xrefstyle"/>
722 <xsl:value-of select=
"'xref'"/>
727 <xsl:call-template name=
"gentext.template">
728 <xsl:with-param name=
"context" select=
"$context"/>
729 <xsl:with-param name=
"name">
730 <xsl:call-template name=
"xpath.location"/>
732 <xsl:with-param name=
"purpose" select=
"$purpose"/>
733 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
734 <xsl:with-param name=
"referrer" select=
"$referrer"/>
739 <xsl:template match=
"*" mode=
"xref-to">
740 <xsl:param name=
"referrer"/>
741 <xsl:param name=
"xrefstyle"/>
744 <xsl:text>Don't know what gentext to create for xref to:
"</xsl:text>
745 <xsl:value-of select="name(.)
"/>
746 <xsl:text>"</xsl:text>
748 <xsl:text>?
</xsl:text>
749 <xsl:value-of select=
"$referrer/@linkend"/>
750 <xsl:text>?
</xsl:text>
753 <xsl:template match=
"title" mode=
"xref-to">
754 <xsl:param name=
"referrer"/>
755 <xsl:param name=
"purpose"/>
756 <xsl:param name=
"xrefstyle"/>
757 <xsl:param name=
"name">
759 <xsl:when test=
"contains(local-name(parent::*), 'info')">
760 <xsl:call-template name=
"xpath.location">
761 <xsl:with-param name=
"node" select=
"../.."/>
765 <xsl:call-template name=
"xpath.location">
766 <xsl:with-param name=
"node" select=
".."/>
772 <xsl:variable name=
"template">
773 <xsl:variable name=
"user-template">
774 <xsl:if test=
"$xrefstyle != '' and not(contains($xrefstyle, ':'))">
775 <xsl:call-template name=
"gentext.template.exists">
776 <xsl:with-param name=
"context" select=
"$xrefstyle"/>
777 <xsl:with-param name=
"name" select=
"$name"/>
781 <xsl:variable name=
"context">
783 <xsl:when test=
"$user-template = 1">
784 <xsl:value-of select=
"$xrefstyle"/>
787 <xsl:value-of select=
"'title'"/>
791 <xsl:call-template name=
"gentext.template">
792 <xsl:with-param name=
"context" select=
"$context"/>
793 <xsl:with-param name=
"name" select=
"$name"/>
794 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
795 <xsl:with-param name=
"purpose" select=
"$purpose"/>
796 <xsl:with-param name=
"referrer" select=
"$referrer"/>
800 <xsl:call-template name=
"substitute-markup">
801 <xsl:with-param name=
"purpose" select=
"$purpose"/>
802 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
803 <xsl:with-param name=
"referrer" select=
"$referrer"/>
804 <xsl:with-param name=
"template" select=
"$template"/>
808 <xsl:template match=
"abstract|article|authorblurb|bibliodiv|bibliomset
809 |biblioset|blockquote|calloutlist|caution|colophon
810 |constraintdef|formalpara|glossdiv|important|indexdiv
811 |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain
812 |msgrel|msgset|msgsub|note|orderedlist|partintro
813 |productionset|qandadiv|refsynopsisdiv|segmentedlist
814 |set|setindex|sidebar|tip|toc|variablelist|warning"
816 <xsl:param name=
"referrer"/>
817 <xsl:param name=
"xrefstyle"/>
819 <!-- catch-all for things with (possibly optional) titles -->
820 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
821 <xsl:with-param name=
"purpose" select=
"'xref'"/>
822 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
823 <xsl:with-param name=
"referrer" select=
"$referrer"/>
824 </xsl:apply-templates>
827 <xsl:template match=
"author|editor|othercredit|personname" mode=
"xref-to">
828 <xsl:param name=
"referrer"/>
829 <xsl:param name=
"xrefstyle"/>
831 <xsl:call-template name=
"person.name"/>
834 <xsl:template match=
"authorgroup" mode=
"xref-to">
835 <xsl:param name=
"referrer"/>
836 <xsl:param name=
"xrefstyle"/>
838 <xsl:call-template name=
"person.name.list"/>
841 <xsl:template match=
"figure|example|table|equation" mode=
"xref-to">
842 <xsl:param name=
"referrer"/>
843 <xsl:param name=
"xrefstyle"/>
845 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
846 <xsl:with-param name=
"purpose" select=
"'xref'"/>
847 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
848 <xsl:with-param name=
"referrer" select=
"$referrer"/>
849 </xsl:apply-templates>
852 <xsl:template match=
"procedure" mode=
"xref-to">
853 <xsl:param name=
"referrer"/>
854 <xsl:param name=
"xrefstyle"/>
856 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
857 <xsl:with-param name=
"purpose" select=
"'xref'"/>
858 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
859 <xsl:with-param name=
"referrer" select=
"$referrer"/>
860 </xsl:apply-templates>
863 <xsl:template match=
"cmdsynopsis" mode=
"xref-to">
864 <xsl:param name=
"referrer"/>
865 <xsl:param name=
"xrefstyle"/>
867 <xsl:apply-templates select=
"(.//command)[1]" mode=
"xref"/>
870 <xsl:template match=
"funcsynopsis" mode=
"xref-to">
871 <xsl:param name=
"referrer"/>
872 <xsl:param name=
"xrefstyle"/>
874 <xsl:apply-templates select=
"(.//function)[1]" mode=
"xref"/>
877 <xsl:template match=
"dedication|preface|chapter|appendix" mode=
"xref-to">
878 <xsl:param name=
"referrer"/>
879 <xsl:param name=
"xrefstyle"/>
881 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
882 <xsl:with-param name=
"purpose" select=
"'xref'"/>
883 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
884 <xsl:with-param name=
"referrer" select=
"$referrer"/>
885 </xsl:apply-templates>
888 <xsl:template match=
"bibliography" mode=
"xref-to">
889 <xsl:param name=
"referrer"/>
890 <xsl:param name=
"xrefstyle"/>
892 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
893 <xsl:with-param name=
"purpose" select=
"'xref'"/>
894 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
895 <xsl:with-param name=
"referrer" select=
"$referrer"/>
896 </xsl:apply-templates>
900 <xsl:template match="biblioentry|bibliomixed" mode="xref-to">
901 <xsl:param name="referrer"/>
902 <xsl:param name="xrefstyle"/>
904 <xsl:text>[</xsl:text>
906 <xsl:when test="string(.) = ''">
907 <xsl:variable name="bib" select="document($bibliography.collection)"/>
908 <xsl:variable name="id" select="@id"/>
909 <xsl:variable name="entry" select="$bib/bibliography/*[@id=$id][1]"/>
911 <xsl:when test="$entry">
913 <xsl:when test="$bibliography.numbered != 0">
914 <xsl:number from="bibliography" count="biblioentry|bibliomixed"
915 level="any" format="1"/>
917 <xsl:when test="local-name($entry/*[1]) = 'abbrev'">
918 <xsl:apply-templates select="$entry/*[1]"/>
921 <xsl:value-of select="@id"/>
927 <xsl:text>No bibliography entry: </xsl:text>
928 <xsl:value-of select="$id"/>
929 <xsl:text> found in </xsl:text>
930 <xsl:value-of select="$bibliography.collection"/>
932 <xsl:value-of select="@id"/>
938 <xsl:when test="$bibliography.numbered != 0">
939 <xsl:number from="bibliography" count="biblioentry|bibliomixed"
940 level="any" format="1"/>
942 <xsl:when test="local-name(*[1]) = 'abbrev'">
943 <xsl:apply-templates select="*[1]"/>
946 <xsl:value-of select="@id"/>
951 <xsl:text>]</xsl:text>
955 <xsl:template match=
"glossary" mode=
"xref-to">
956 <xsl:param name=
"referrer"/>
957 <xsl:param name=
"xrefstyle"/>
959 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
960 <xsl:with-param name=
"purpose" select=
"'xref'"/>
961 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
962 <xsl:with-param name=
"referrer" select=
"$referrer"/>
963 </xsl:apply-templates>
966 <xsl:template match=
"glossentry" mode=
"xref-to">
968 <xsl:when test=
"$glossentry.show.acronym = 'primary'">
970 <xsl:when test=
"acronym|abbrev">
971 <xsl:apply-templates select=
"(acronym|abbrev)[1]"/>
974 <xsl:apply-templates select=
"glossterm[1]" mode=
"xref-to"/>
979 <xsl:apply-templates select=
"glossterm[1]" mode=
"xref-to"/>
984 <xsl:template match=
"glossterm" mode=
"xref-to">
985 <xsl:apply-templates/>
988 <xsl:template match=
"index" mode=
"xref-to">
989 <xsl:param name=
"referrer"/>
990 <xsl:param name=
"xrefstyle"/>
992 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
993 <xsl:with-param name=
"purpose" select=
"'xref'"/>
994 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
995 <xsl:with-param name=
"referrer" select=
"$referrer"/>
996 </xsl:apply-templates>
999 <xsl:template match=
"listitem" mode=
"xref-to">
1000 <xsl:param name=
"referrer"/>
1001 <xsl:param name=
"xrefstyle"/>
1003 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
1004 <xsl:with-param name=
"purpose" select=
"'xref'"/>
1005 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1006 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1007 </xsl:apply-templates>
1010 <xsl:template match=
"section|simplesect
1011 |sect1|sect2|sect3|sect4|sect5
1012 |refsect1|refsect2|refsect3" mode=
"xref-to">
1013 <xsl:param name=
"referrer"/>
1014 <xsl:param name=
"xrefstyle"/>
1016 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
1017 <xsl:with-param name=
"purpose" select=
"'xref'"/>
1018 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1019 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1020 </xsl:apply-templates>
1021 <!-- What about "in Chapter X"? -->
1024 <xsl:template match=
"bridgehead" mode=
"xref-to">
1025 <xsl:param name=
"referrer"/>
1026 <xsl:param name=
"xrefstyle"/>
1028 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
1029 <xsl:with-param name=
"purpose" select=
"'xref'"/>
1030 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1031 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1032 </xsl:apply-templates>
1033 <!-- What about "in Chapter X"? -->
1036 <xsl:template match=
"qandaset" mode=
"xref-to">
1037 <xsl:param name=
"referrer"/>
1038 <xsl:param name=
"xrefstyle"/>
1040 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
1041 <xsl:with-param name=
"purpose" select=
"'xref'"/>
1042 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1043 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1044 </xsl:apply-templates>
1047 <xsl:template match=
"qandadiv" mode=
"xref-to">
1048 <xsl:param name=
"referrer"/>
1049 <xsl:param name=
"xrefstyle"/>
1051 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
1052 <xsl:with-param name=
"purpose" select=
"'xref'"/>
1053 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1054 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1055 </xsl:apply-templates>
1058 <xsl:template match=
"qandaentry" mode=
"xref-to">
1059 <xsl:param name=
"referrer"/>
1060 <xsl:param name=
"xrefstyle"/>
1062 <xsl:apply-templates select=
"question[1]" mode=
"object.xref.markup">
1063 <xsl:with-param name=
"purpose" select=
"'xref'"/>
1064 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1065 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1066 </xsl:apply-templates>
1069 <xsl:template match=
"question|answer" mode=
"xref-to">
1070 <xsl:param name=
"referrer"/>
1071 <xsl:param name=
"xrefstyle"/>
1073 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
1074 <xsl:with-param name=
"purpose" select=
"'xref'"/>
1075 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1076 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1077 </xsl:apply-templates>
1080 <xsl:template match=
"part|reference" mode=
"xref-to">
1081 <xsl:param name=
"referrer"/>
1082 <xsl:param name=
"xrefstyle"/>
1084 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
1085 <xsl:with-param name=
"purpose" select=
"'xref'"/>
1086 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1087 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1088 </xsl:apply-templates>
1091 <xsl:template match=
"refentry" mode=
"xref-to">
1092 <xsl:param name=
"referrer"/>
1093 <xsl:param name=
"xrefstyle"/>
1096 <xsl:when test=
"refmeta/refentrytitle">
1097 <xsl:apply-templates select=
"refmeta/refentrytitle"/>
1100 <xsl:apply-templates select=
"refnamediv/refname[1]"/>
1103 <xsl:apply-templates select=
"refmeta/manvolnum"/>
1106 <xsl:template match=
"refnamediv" mode=
"xref-to">
1107 <xsl:param name=
"referrer"/>
1108 <xsl:param name=
"xrefstyle"/>
1110 <xsl:apply-templates select=
"refname[1]" mode=
"xref-to">
1111 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1112 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1113 </xsl:apply-templates>
1116 <xsl:template match=
"refname" mode=
"xref-to">
1117 <xsl:param name=
"referrer"/>
1118 <xsl:param name=
"xrefstyle"/>
1120 <xsl:apply-templates mode=
"xref-to">
1121 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1122 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1123 </xsl:apply-templates>
1126 <xsl:template match=
"step" mode=
"xref-to">
1127 <xsl:param name=
"referrer"/>
1128 <xsl:param name=
"xrefstyle"/>
1130 <xsl:call-template name=
"gentext">
1131 <xsl:with-param name=
"key" select=
"'Step'"/>
1132 </xsl:call-template>
1133 <xsl:text> </xsl:text>
1134 <xsl:apply-templates select=
"." mode=
"number"/>
1137 <xsl:template match=
"varlistentry" mode=
"xref-to">
1138 <xsl:param name=
"referrer"/>
1139 <xsl:param name=
"xrefstyle"/>
1141 <xsl:apply-templates select=
"term[1]" mode=
"xref-to">
1142 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1143 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1144 </xsl:apply-templates>
1147 <xsl:template match=
"varlistentry/term" mode=
"xref-to">
1148 <!-- to avoid the comma that will be generated if there are several terms -->
1149 <xsl:apply-templates/>
1152 <xsl:template match=
"co" mode=
"xref-to">
1153 <xsl:param name=
"referrer"/>
1154 <xsl:param name=
"xrefstyle"/>
1156 <xsl:apply-templates select=
"." mode=
"callout-bug"/>
1159 <xsl:template match=
"book" mode=
"xref-to">
1160 <xsl:param name=
"referrer"/>
1161 <xsl:param name=
"xrefstyle"/>
1163 <xsl:apply-templates select=
"." mode=
"object.xref.markup">
1164 <xsl:with-param name=
"purpose" select=
"'xref'"/>
1165 <xsl:with-param name=
"xrefstyle" select=
"$xrefstyle"/>
1166 <xsl:with-param name=
"referrer" select=
"$referrer"/>
1167 </xsl:apply-templates>
1170 <xsl:template match=
"para" mode=
"xref-to">
1171 <xsl:param name=
"referrer"/>
1172 <xsl:param name=
"xrefstyle"/>
1174 <xsl:variable name=
"context" select=
"(ancestor::simplesect
1181 |ancestor::refsection
1188 |ancestor::partintro
1189 |ancestor::dedication
1191 |ancestor::bibliography
1194 |ancestor::glossentry
1196 |ancestor::varlistentry)[last()]"/>
1198 <xsl:apply-templates select=
"$context" mode=
"xref-to"/>
1200 <xsl:apply-templates select="." mode="object.xref.markup">
1201 <xsl:with-param name="purpose" select="'xref'"/>
1202 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
1203 <xsl:with-param name="referrer" select="$referrer"/>
1204 </xsl:apply-templates>