2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:d="http://docbook.org/ns/docbook"
4 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
5 xmlns:xlink="http://www.w3.org/1999/xlink"
6 exclude-result-prefixes="doc d"
9 <!-- ********************************************************************
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://cdn.docbook.org/release/xsl/current/ for
13 copyright and other information.
15 ******************************************************************** -->
17 <!-- ==================================================================== -->
21 <doc:mode mode="title.markup" xmlns="">
22 <refpurpose>Provides access to element titles</refpurpose>
23 <refdescription id="title.markup-desc">
24 <para>Processing an element in the
25 <literal role="mode">title.markup</literal> mode produces the
26 title of the element. This does not include the label.
31 <xsl:template match="*" mode="title.markup">
32 <xsl:param name="allow-anchors" select="0"/>
33 <xsl:param name="verbose" select="1"/>
35 <!-- * FIXME: this should handle other *info elements as well -->
36 <!-- * but this is good enough for now. -->
37 <xsl:when test="d:title|d:info/d:title">
38 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
39 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
40 </xsl:apply-templates>
42 <xsl:when test="local-name(.) = 'partintro'">
43 <!-- partintro's don't have titles, use the parent (part or reference)
45 <xsl:apply-templates select="parent::*" mode="title.markup"/>
48 <xsl:if test="$verbose != 0">
50 <xsl:text>Request for title of element with no title: </xsl:text>
51 <xsl:value-of select="local-name(.)"/>
54 <xsl:text> (id="</xsl:text>
55 <xsl:value-of select="@id"/>
56 <xsl:text>")</xsl:text>
58 <xsl:when test="@xml:id">
59 <xsl:text> (xml:id="</xsl:text>
60 <xsl:value-of select="@xml:id"/>
61 <xsl:text>")</xsl:text>
64 <xsl:text> (contained in </xsl:text>
65 <xsl:value-of select="local-name(..)"/>
66 <xsl:if test="../@id or ../@xml:id">
67 <xsl:text> with id </xsl:text>
68 <xsl:value-of select="../@id | ../@xml:id"/>
70 <xsl:text>)</xsl:text>
75 <xsl:text>???TITLE???</xsl:text>
80 <xsl:template match="d:title" mode="title.markup">
81 <xsl:param name="allow-anchors" select="0"/>
84 <xsl:when test="$allow-anchors != 0">
85 <xsl:apply-templates/>
88 <xsl:apply-templates mode="no.anchor.mode"/>
93 <!-- only occurs in HTML Tables! -->
94 <xsl:template match="d:caption" mode="title.markup">
95 <xsl:param name="allow-anchors" select="0"/>
98 <xsl:when test="$allow-anchors != 0">
99 <xsl:apply-templates/>
102 <xsl:apply-templates mode="no.anchor.mode"/>
107 <xsl:template match="d:set" mode="title.markup">
108 <xsl:param name="allow-anchors" select="0"/>
109 <xsl:apply-templates select="(d:setinfo/d:title|d:info/d:title|d:title)[1]"
111 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
112 </xsl:apply-templates>
115 <xsl:template match="d:book" mode="title.markup">
116 <xsl:param name="allow-anchors" select="0"/>
117 <xsl:apply-templates select="(d:bookinfo/d:title|d:info/d:title|d:title)[1]"
119 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
120 </xsl:apply-templates>
123 <xsl:template match="d:part" mode="title.markup">
124 <xsl:param name="allow-anchors" select="0"/>
125 <xsl:apply-templates select="(d:partinfo/d:title|d:info/d:title|d:docinfo/d:title|d:title)[1]"
127 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
128 </xsl:apply-templates>
131 <xsl:template match="d:preface|d:chapter|d:appendix" mode="title.markup">
132 <xsl:param name="allow-anchors" select="0"/>
136 <xsl:value-of select="local-name(.)"/>
137 <xsl:text> </xsl:text>
138 <xsl:value-of select="$allow-anchors"/>
142 <xsl:variable name="title" select="(d:docinfo/d:title
144 |d:prefaceinfo/d:title
145 |d:chapterinfo/d:title
146 |d:appendixinfo/d:title
148 <xsl:apply-templates select="$title" mode="title.markup">
149 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
150 </xsl:apply-templates>
153 <xsl:template match="d:dedication" mode="title.markup">
154 <xsl:param name="allow-anchors" select="0"/>
156 <xsl:when test="d:title|d:info/d:title">
157 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
158 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
159 </xsl:apply-templates>
162 <xsl:call-template name="gentext">
163 <xsl:with-param name="key" select="'Dedication'"/>
169 <xsl:template match="d:acknowledgements" mode="title.markup">
170 <xsl:param name="allow-anchors" select="0"/>
172 <xsl:when test="d:title|d:info/d:title">
173 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
174 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
175 </xsl:apply-templates>
178 <xsl:call-template name="gentext">
179 <xsl:with-param name="key" select="'Acknowledgements'"/>
185 <xsl:template match="d:colophon" mode="title.markup">
186 <xsl:param name="allow-anchors" select="0"/>
188 <xsl:when test="d:title|d:info/d:title">
189 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
190 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
191 </xsl:apply-templates>
194 <xsl:call-template name="gentext">
195 <xsl:with-param name="key" select="'Colophon'"/>
201 <xsl:template match="d:article" mode="title.markup">
202 <xsl:param name="allow-anchors" select="0"/>
203 <xsl:variable name="title" select="(d:artheader/d:title
204 |d:articleinfo/d:title
208 <xsl:apply-templates select="$title" mode="title.markup">
209 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
210 </xsl:apply-templates>
213 <xsl:template match="d:reference" mode="title.markup">
214 <xsl:param name="allow-anchors" select="0"/>
215 <xsl:apply-templates select="(d:referenceinfo/d:title|d:docinfo/d:title|d:info/d:title|d:title)[1]"
217 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
218 </xsl:apply-templates>
221 <xsl:template match="d:refentry" mode="title.markup">
222 <xsl:param name="allow-anchors" select="0"/>
223 <xsl:variable name="refmeta" select=".//d:refmeta"/>
224 <xsl:variable name="refentrytitle" select="$refmeta//d:refentrytitle"/>
225 <xsl:variable name="refnamediv" select=".//d:refnamediv"/>
226 <xsl:variable name="refname" select="$refnamediv//d:refname"/>
227 <xsl:variable name="refdesc" select="$refnamediv//d:refdescriptor"/>
229 <xsl:variable name="title">
231 <xsl:when test="$refentrytitle">
232 <xsl:apply-templates select="$refentrytitle[1]" mode="title.markup"/>
234 <xsl:when test="$refdesc">
235 <xsl:apply-templates select="$refdesc" mode="title.markup"/>
237 <xsl:when test="$refname">
238 <xsl:apply-templates select="$refname[1]" mode="title.markup"/>
240 <xsl:otherwise>REFENTRY WITHOUT TITLE???</xsl:otherwise>
244 <xsl:copy-of select="$title"/>
247 <xsl:template match="d:refentrytitle|d:refname|d:refdescriptor" mode="title.markup">
248 <xsl:param name="allow-anchors" select="0"/>
250 <xsl:when test="$allow-anchors != 0">
251 <xsl:apply-templates/>
254 <xsl:apply-templates mode="no.anchor.mode"/>
259 <xsl:template match="d:section
260 |d:sect1|d:sect2|d:sect3|d:sect4|d:sect5
261 |d:refsect1|d:refsect2|d:refsect3|d:refsection
265 <xsl:param name="allow-anchors" select="0"/>
266 <xsl:variable name="title" select="(d:info/d:title
267 |d:sectioninfo/d:title
273 |d:refsect1info/d:title
274 |d:refsect2info/d:title
275 |d:refsect3info/d:title
276 |d:refsectioninfo/d:title
279 <xsl:apply-templates select="$title" mode="title.markup">
280 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
281 </xsl:apply-templates>
284 <xsl:template match="d:bridgehead" mode="title.markup">
285 <xsl:apply-templates/>
288 <xsl:template match="d:refsynopsisdiv" mode="title.markup">
289 <xsl:param name="allow-anchors" select="0"/>
291 <xsl:when test="d:title|d:info/d:title">
292 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
293 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
294 </xsl:apply-templates>
297 <xsl:call-template name="gentext">
298 <xsl:with-param name="key" select="'RefSynopsisDiv'"/>
304 <xsl:template match="d:bibliography" mode="title.markup">
305 <xsl:param name="allow-anchors" select="0"/>
306 <xsl:variable name="title" select="(d:bibliographyinfo/d:title|d:info/d:title|d:title)[1]"/>
308 <xsl:when test="$title">
309 <xsl:apply-templates select="$title" mode="title.markup">
310 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
311 </xsl:apply-templates>
314 <xsl:call-template name="gentext">
315 <xsl:with-param name="key" select="'Bibliography'"/>
321 <xsl:template match="d:glossary" mode="title.markup">
322 <xsl:param name="allow-anchors" select="0"/>
323 <xsl:variable name="title" select="(d:glossaryinfo/d:title|d:info/d:title|d:title)[1]"/>
325 <xsl:when test="$title">
326 <xsl:apply-templates select="$title" mode="title.markup">
327 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
328 </xsl:apply-templates>
331 <xsl:call-template name="gentext.element.name">
332 <xsl:with-param name="element.name" select="local-name(.)"/>
338 <xsl:template match="d:glossdiv" mode="title.markup">
339 <xsl:param name="allow-anchors" select="0"/>
340 <xsl:variable name="title" select="(d:info/d:title|d:title)[1]"/>
342 <xsl:when test="$title">
343 <xsl:apply-templates select="$title" mode="title.markup">
344 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
345 </xsl:apply-templates>
348 <xsl:message>ERROR: glossdiv missing its required title</xsl:message>
353 <xsl:template match="d:glossentry" mode="title.markup">
354 <xsl:param name="allow-anchors" select="0"/>
355 <xsl:apply-templates select="d:glossterm" mode="title.markup">
356 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
357 </xsl:apply-templates>
360 <xsl:template match="d:glossterm|d:firstterm" mode="title.markup">
361 <xsl:param name="allow-anchors" select="0"/>
364 <xsl:when test="$allow-anchors != 0">
365 <xsl:apply-templates/>
368 <xsl:apply-templates mode="no.anchor.mode"/>
373 <xsl:template match="d:index" mode="title.markup">
374 <xsl:param name="allow-anchors" select="0"/>
375 <xsl:variable name="title" select="(d:indexinfo/d:title|d:info/d:title|d:title)[1]"/>
377 <xsl:when test="$title">
378 <xsl:apply-templates select="$title" mode="title.markup">
379 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
380 </xsl:apply-templates>
383 <xsl:call-template name="gentext">
384 <xsl:with-param name="key" select="'Index'"/>
390 <xsl:template match="d:setindex" mode="title.markup">
391 <xsl:param name="allow-anchors" select="0"/>
392 <xsl:variable name="title" select="(d:setindexinfo/d:title|d:info/d:title|d:title)[1]"/>
394 <xsl:when test="$title">
395 <xsl:apply-templates select="$title" mode="title.markup">
396 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
397 </xsl:apply-templates>
400 <xsl:call-template name="gentext">
401 <xsl:with-param name="key" select="'SetIndex'"/>
407 <xsl:template match="d:figure|d:example|d:equation" mode="title.markup">
408 <xsl:param name="allow-anchors" select="0"/>
409 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
410 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
411 </xsl:apply-templates>
414 <xsl:template match="d:table" mode="title.markup">
415 <xsl:param name="allow-anchors" select="0"/>
416 <xsl:apply-templates select="(d:title|d:info/d:title|d:caption)[1]" mode="title.markup">
417 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
418 </xsl:apply-templates>
421 <xsl:template match="d:procedure" mode="title.markup">
422 <xsl:param name="allow-anchors" select="0"/>
423 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
424 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
425 </xsl:apply-templates>
428 <xsl:template match="d:task" mode="title.markup">
429 <xsl:param name="allow-anchors" select="0"/>
430 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
431 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
432 </xsl:apply-templates>
435 <xsl:template match="d:sidebar" mode="title.markup">
436 <xsl:param name="allow-anchors" select="0"/>
437 <xsl:apply-templates select="(d:info/d:title|d:sidebarinfo/d:title|d:title)[1]"
439 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
440 </xsl:apply-templates>
443 <xsl:template match="d:abstract" mode="title.markup">
444 <xsl:param name="allow-anchors" select="0"/>
446 <xsl:when test="d:title|d:info/d:title">
447 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
448 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
449 </xsl:apply-templates>
452 <xsl:call-template name="gentext">
453 <xsl:with-param name="key" select="'Abstract'"/>
459 <xsl:template match="d:caution|d:tip|d:warning|d:important|d:note" mode="title.markup">
460 <xsl:param name="allow-anchors" select="0"/>
461 <xsl:variable name="title" select="(d:title|d:info/d:title)[1]"/>
463 <xsl:when test="$title">
464 <xsl:apply-templates select="$title" mode="title.markup">
465 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
466 </xsl:apply-templates>
469 <xsl:call-template name="gentext">
470 <xsl:with-param name="key">
472 <xsl:when test="local-name(.)='note'">Note</xsl:when>
473 <xsl:when test="local-name(.)='important'">Important</xsl:when>
474 <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
475 <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
476 <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
484 <xsl:template match="d:question" mode="title.markup">
485 <!-- questions don't have titles -->
486 <xsl:call-template name="gentext">
487 <xsl:with-param name="key">question</xsl:with-param>
491 <xsl:template match="d:answer" mode="title.markup">
492 <!-- answers don't have titles -->
493 <xsl:call-template name="gentext">
494 <xsl:with-param name="key">answer</xsl:with-param>
498 <xsl:template match="d:qandaentry" mode="title.markup">
499 <!-- qandaentrys are represented by the first question in them -->
500 <xsl:apply-templates select="d:question" mode="title.markup"/>
503 <xsl:template match="d:qandaset" mode="title.markup">
504 <xsl:param name="allow-anchors" select="0"/>
505 <xsl:variable name="title" select="(d:info/d:title|
509 <xsl:when test="$title">
510 <xsl:apply-templates select="$title" mode="title.markup">
511 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
512 </xsl:apply-templates>
515 <xsl:call-template name="gentext">
516 <xsl:with-param name="key" select="'QandASet'"/>
522 <xsl:template match="d:legalnotice" mode="title.markup">
523 <xsl:param name="allow-anchors" select="0"/>
525 <xsl:when test="d:title|d:info/d:title">
526 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
527 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
528 </xsl:apply-templates>
531 <xsl:call-template name="gentext">
532 <xsl:with-param name="key" select="'LegalNotice'"/>
538 <!-- ============================================================ -->
540 <!-- titleabbrev is always processed in a mode -->
541 <xsl:template match="d:titleabbrev"/>
543 <xsl:template match="*" mode="titleabbrev.markup">
544 <xsl:param name="allow-anchors" select="0"/>
545 <xsl:param name="verbose" select="1"/>
548 <xsl:when test="d:titleabbrev">
549 <xsl:apply-templates select="d:titleabbrev[1]" mode="title.markup">
550 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
551 </xsl:apply-templates>
553 <xsl:when test="d:info/d:titleabbrev">
554 <xsl:apply-templates select="d:info/d:titleabbrev[1]" mode="title.markup">
555 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
556 </xsl:apply-templates>
559 <xsl:apply-templates select="." mode="title.markup">
560 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
561 <xsl:with-param name="verbose" select="$verbose"/>
562 </xsl:apply-templates>
567 <xsl:template match="d:book|d:part|d:set|d:preface|d:chapter|d:appendix" mode="titleabbrev.markup">
568 <xsl:param name="allow-anchors" select="0"/>
569 <xsl:param name="verbose" select="1"/>
571 <xsl:variable name="titleabbrev" select="(d:docinfo/d:titleabbrev
572 |d:bookinfo/d:titleabbrev
573 |d:info/d:titleabbrev
574 |d:prefaceinfo/d:titleabbrev
575 |d:setinfo/d:titleabbrev
576 |d:partinfo/d:titleabbrev
577 |d:chapterinfo/d:titleabbrev
578 |d:appendixinfo/d:titleabbrev
579 |d:titleabbrev)[1]"/>
582 <xsl:when test="$titleabbrev">
583 <xsl:apply-templates select="$titleabbrev" mode="title.markup">
584 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
585 </xsl:apply-templates>
588 <xsl:apply-templates select="." mode="title.markup">
589 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
590 <xsl:with-param name="verbose" select="$verbose"/>
591 </xsl:apply-templates>
596 <xsl:template match="d:article" mode="titleabbrev.markup">
597 <xsl:param name="allow-anchors" select="0"/>
598 <xsl:param name="verbose" select="1"/>
600 <xsl:variable name="titleabbrev" select="(d:artheader/d:titleabbrev
601 |d:articleinfo/d:titleabbrev
602 |d:info/d:titleabbrev
603 |d:titleabbrev)[1]"/>
606 <xsl:when test="$titleabbrev">
607 <xsl:apply-templates select="$titleabbrev" mode="title.markup">
608 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
609 </xsl:apply-templates>
612 <xsl:apply-templates select="." mode="title.markup">
613 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
614 <xsl:with-param name="verbose" select="$verbose"/>
615 </xsl:apply-templates>
620 <xsl:template match="d:section
621 |d:sect1|d:sect2|d:sect3|d:sect4|d:sect5
622 |d:refsect1|d:refsect2|d:refsect3
625 mode="titleabbrev.markup">
626 <xsl:param name="allow-anchors" select="0"/>
627 <xsl:param name="verbose" select="1"/>
629 <xsl:variable name="titleabbrev" select="(d:info/d:titleabbrev
630 |d:sectioninfo/d:titleabbrev
631 |d:sect1info/d:titleabbrev
632 |d:sect2info/d:titleabbrev
633 |d:sect3info/d:titleabbrev
634 |d:sect4info/d:titleabbrev
635 |d:sect5info/d:titleabbrev
636 |d:refsect1info/d:titleabbrev
637 |d:refsect2info/d:titleabbrev
638 |d:refsect3info/d:titleabbrev
639 |d:titleabbrev)[1]"/>
642 <xsl:when test="$titleabbrev">
643 <xsl:apply-templates select="$titleabbrev" mode="title.markup">
644 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
645 </xsl:apply-templates>
648 <xsl:apply-templates select="." mode="title.markup">
649 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
650 <xsl:with-param name="verbose" select="$verbose"/>
651 </xsl:apply-templates>
656 <xsl:template match="d:titleabbrev" mode="title.markup">
657 <xsl:param name="allow-anchors" select="0"/>
660 <xsl:when test="$allow-anchors != 0">
661 <xsl:apply-templates/>
664 <xsl:apply-templates mode="no.anchor.mode"/>
669 <!-- ============================================================ -->
671 <xsl:template match="*" mode="no.anchor.mode">
672 <!-- Switch to normal mode if no links -->
674 <xsl:when test="descendant-or-self::d:footnote or
675 descendant-or-self::d:anchor or
676 descendant-or-self::d:ulink or
677 descendant-or-self::d:link or
678 descendant-or-self::d:olink or
679 descendant-or-self::d:xref or
680 descendant-or-self::d:indexterm or
681 (ancestor::d:title and (@id or @xml:id))">
683 <xsl:apply-templates mode="no.anchor.mode"/>
686 <xsl:apply-templates select="."/>
691 <xsl:template match="d:footnote" mode="no.anchor.mode">
692 <!-- nop, suppressed -->
695 <xsl:template match="d:anchor" mode="no.anchor.mode">
696 <!-- nop, suppressed -->
699 <xsl:template match="d:ulink" mode="no.anchor.mode">
700 <xsl:param name="url" select="@url"/>
702 <xsl:when test="count(child::node())=0">
703 <xsl:value-of select="$url"/>
706 <xsl:apply-templates/>
711 <xsl:template match="d:link" mode="no.anchor.mode">
713 <xsl:when test="count(child::node()) > 0">
714 <!-- If it has content, use it -->
715 <xsl:apply-templates/>
717 <!-- look for an endterm -->
718 <xsl:when test="@endterm">
719 <xsl:variable name="etargets" select="key('id',@endterm)"/>
720 <xsl:variable name="etarget" select="$etargets[1]"/>
722 <xsl:when test="count($etarget) = 0">
724 <xsl:value-of select="count($etargets)"/>
725 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
726 <xsl:value-of select="@endterm"/>
728 <xsl:text>???</xsl:text>
731 <xsl:apply-templates select="$etarget" mode="endterm"/>
736 <xsl:apply-templates/>
741 <xsl:template match="d:olink" mode="no.anchor.mode">
742 <xsl:apply-templates/>
745 <xsl:template match="d:indexterm" mode="no.anchor.mode">
746 <!-- nop, suppressed -->
749 <xsl:template match="d:xref" mode="no.anchor.mode">
750 <xsl:variable name="referrer" select="."/>
751 <xsl:variable name="targets" select="key('id',@linkend)|key('id',substring-after(@xlink:href,'#'))"/>
752 <xsl:variable name="target" select="$targets[1]"/>
753 <xsl:variable name="refelem" select="local-name($target)"/>
754 <xsl:variable name="xrefstyle">
755 <xsl:apply-templates select="." mode="xrefstyle">
756 <xsl:with-param name="target" select="$target"/>
757 <xsl:with-param name="referrer" select="$referrer"/>
758 </xsl:apply-templates>
761 <xsl:call-template name="check.id.unique">
762 <xsl:with-param name="linkend" select="@linkend"/>
766 <xsl:when test="count($target) = 0">
768 <xsl:text>XRef to nonexistent id: </xsl:text>
769 <xsl:value-of select="@linkend"/>
770 <xsl:value-of select="@xlink:href"/>
772 <xsl:text>???</xsl:text>
775 <xsl:when test="@endterm">
776 <xsl:variable name="etargets" select="key('id',@endterm)"/>
777 <xsl:variable name="etarget" select="$etargets[1]"/>
779 <xsl:when test="count($etarget) = 0">
781 <xsl:value-of select="count($etargets)"/>
782 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
783 <xsl:value-of select="@endterm"/>
785 <xsl:text>???</xsl:text>
788 <xsl:apply-templates select="$etarget" mode="endterm"/>
793 <xsl:when test="$target/@xreflabel">
794 <xsl:call-template name="xref.xreflabel">
795 <xsl:with-param name="target" select="$target"/>
802 <!-- Watch out for the case when there is a xref or link inside
803 a title. See bugs #1811721 and #1838136. -->
804 <xsl:when test="not(ancestor::*[@id = $target/@id] or ancestor::*[@xml:id = $target/@xml:id])">
806 <xsl:apply-templates select="$target" mode="xref-to-prefix">
807 <xsl:with-param name="referrer" select="."/>
808 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
809 </xsl:apply-templates>
811 <xsl:apply-templates select="$target" mode="xref-to">
812 <xsl:with-param name="referrer" select="."/>
813 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
814 </xsl:apply-templates>
816 <xsl:apply-templates select="$target" mode="xref-to-suffix">
817 <xsl:with-param name="referrer" select="."/>
818 <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
819 </xsl:apply-templates>
823 <xsl:apply-templates/>
832 <!-- ============================================================ -->
834 <xsl:template mode="title.markup" match="d:toc">
835 <xsl:param name="allow-anchors" select="0"/>
836 <xsl:param name="verbose" select="1"/>
838 <xsl:when test="d:title|d:info/d:title">
839 <xsl:apply-templates select="(d:title|d:info/d:title)[1]" mode="title.markup">
840 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
841 </xsl:apply-templates>
844 <xsl:call-template name="gentext">
845 <xsl:with-param name="key" select="'TableofContents'"/>