1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
4                exclude-result-prefixes="doc"
5                version='1.0'>
6
7<!-- ********************************************************************
8     $Id: titles.xsl,v 1.35 2006/05/07 07:14:44 bobstayton Exp $
9     ********************************************************************
10
11     This file is part of the XSL DocBook Stylesheet distribution.
12     See /README or http://nwalsh.com/docbook/xsl/ for copyright
13     and other information.
14
15     ******************************************************************** -->
16
17<!-- ==================================================================== -->
18
19<!-- title markup -->
20
21<doc:mode mode="title.markup" xmlns="">
22<refpurpose>Provides access to element titles</refpurpose>
23<refdescription>
24<para>Processing an element in the
25<literal role="mode">title.markup</literal> mode produces the
26title of the element. This does not include the label.
27</para>
28</refdescription>
29</doc:mode>
30
31<xsl:template match="*" mode="title.markup">
32  <xsl:param name="allow-anchors" select="0"/>
33  <xsl:param name="verbose" select="1"/>
34
35  <xsl:choose>
36    <xsl:when test="title">
37      <xsl:apply-templates select="title[1]" mode="title.markup">
38        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
39      </xsl:apply-templates>
40    </xsl:when>
41    <xsl:when test="local-name(.) = 'partintro'">
42      <!-- partintro's don't have titles, use the parent (part or reference)
43           title instead. -->
44      <xsl:apply-templates select="parent::*" mode="title.markup"/>
45    </xsl:when>
46    <xsl:otherwise>
47      <xsl:if test="$verbose != 0">
48        <xsl:message>
49          <xsl:text>Request for title of element with no title: </xsl:text>
50          <xsl:value-of select="name(.)"/>
51          <xsl:if test="@id">
52            <xsl:text> (id="</xsl:text>
53            <xsl:value-of select="@id"/>
54            <xsl:text>")</xsl:text>
55          </xsl:if>
56        </xsl:message>
57      </xsl:if>
58      <xsl:text>???TITLE???</xsl:text>
59    </xsl:otherwise>
60  </xsl:choose>
61</xsl:template>
62
63<xsl:template match="title" mode="title.markup">
64  <xsl:param name="allow-anchors" select="0"/>
65
66  <xsl:choose>
67    <xsl:when test="$allow-anchors != 0">
68      <xsl:apply-templates/>
69    </xsl:when>
70    <xsl:otherwise>
71      <xsl:apply-templates mode="no.anchor.mode"/>
72    </xsl:otherwise>
73  </xsl:choose>
74</xsl:template>
75
76<!-- only occurs in HTML Tables! -->
77<xsl:template match="caption" mode="title.markup">
78  <xsl:param name="allow-anchors" select="0"/>
79
80  <xsl:choose>
81    <xsl:when test="$allow-anchors != 0">
82      <xsl:apply-templates/>
83    </xsl:when>
84    <xsl:otherwise>
85      <xsl:apply-templates mode="no.anchor.mode"/>
86    </xsl:otherwise>
87  </xsl:choose>
88</xsl:template>
89
90<xsl:template match="set" mode="title.markup">
91  <xsl:param name="allow-anchors" select="0"/>
92  <xsl:apply-templates select="(setinfo/title|info/title|title)[1]"
93                       mode="title.markup">
94    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
95  </xsl:apply-templates>
96</xsl:template>
97
98<xsl:template match="book" mode="title.markup">
99  <xsl:param name="allow-anchors" select="0"/>
100  <xsl:apply-templates select="(bookinfo/title|info/title|title)[1]"
101                       mode="title.markup">
102    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
103  </xsl:apply-templates>
104</xsl:template>
105
106<xsl:template match="part" mode="title.markup">
107  <xsl:param name="allow-anchors" select="0"/>
108  <xsl:apply-templates select="(partinfo/title|info/title|docinfo/title|title)[1]"
109                       mode="title.markup">
110    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
111  </xsl:apply-templates>
112</xsl:template>
113
114<xsl:template match="preface|chapter|appendix" mode="title.markup">
115  <xsl:param name="allow-anchors" select="0"/>
116
117<!--
118  <xsl:message>
119    <xsl:value-of select="name(.)"/>
120    <xsl:text> </xsl:text>
121    <xsl:value-of select="$allow-anchors"/>
122  </xsl:message>
123-->
124
125  <xsl:variable name="title" select="(docinfo/title
126                                      |info/title
127                                      |prefaceinfo/title
128                                      |chapterinfo/title
129                                      |appendixinfo/title
130                                      |title)[1]"/>
131  <xsl:apply-templates select="$title" mode="title.markup">
132    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
133  </xsl:apply-templates>
134</xsl:template>
135
136<xsl:template match="dedication" mode="title.markup">
137  <xsl:param name="allow-anchors" select="0"/>
138  <xsl:choose>
139    <xsl:when test="title">
140      <xsl:apply-templates select="title" mode="title.markup">
141        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
142      </xsl:apply-templates>
143    </xsl:when>
144    <xsl:otherwise>
145      <xsl:call-template name="gentext">
146        <xsl:with-param name="key" select="'Dedication'"/>
147      </xsl:call-template>
148    </xsl:otherwise>
149  </xsl:choose>
150</xsl:template>
151
152<xsl:template match="colophon" mode="title.markup">
153  <xsl:param name="allow-anchors" select="0"/>
154  <xsl:choose>
155    <xsl:when test="title">
156      <xsl:apply-templates select="title" mode="title.markup">
157        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
158      </xsl:apply-templates>
159    </xsl:when>
160    <xsl:otherwise>
161      <xsl:call-template name="gentext">
162        <xsl:with-param name="key" select="'Colophon'"/>
163      </xsl:call-template>
164    </xsl:otherwise>
165  </xsl:choose>
166</xsl:template>
167
168<xsl:template match="article" mode="title.markup">
169  <xsl:param name="allow-anchors" select="0"/>
170  <xsl:variable name="title" select="(artheader/title
171                                      |articleinfo/title
172                                      |info/title
173                                      |title)[1]"/>
174
175  <xsl:apply-templates select="$title" mode="title.markup">
176    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
177  </xsl:apply-templates>
178</xsl:template>
179
180<xsl:template match="reference" mode="title.markup">
181  <xsl:param name="allow-anchors" select="0"/>
182  <xsl:apply-templates select="(referenceinfo/title|docinfo/title|info/title|title)[1]"
183                       mode="title.markup">
184    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
185  </xsl:apply-templates>
186</xsl:template>
187
188<xsl:template match="refentry" mode="title.markup">
189  <xsl:param name="allow-anchors" select="0"/>
190  <xsl:variable name="refmeta" select=".//refmeta"/>
191  <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
192  <xsl:variable name="refnamediv" select=".//refnamediv"/>
193  <xsl:variable name="refname" select="$refnamediv//refname"/>
194  <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
195
196  <xsl:variable name="title">
197    <xsl:choose>
198      <xsl:when test="$refentrytitle">
199        <xsl:apply-templates select="$refentrytitle[1]" mode="title.markup"/>
200      </xsl:when>
201      <xsl:when test="$refdesc">
202        <xsl:apply-templates select="$refdesc" mode="title.markup"/>
203      </xsl:when>
204      <xsl:when test="$refname">
205        <xsl:apply-templates select="$refname[1]" mode="title.markup"/>
206      </xsl:when>
207      <xsl:otherwise>REFENTRY WITHOUT TITLE???</xsl:otherwise>
208    </xsl:choose>
209  </xsl:variable>
210
211  <xsl:copy-of select="$title"/>
212</xsl:template>
213
214<xsl:template match="refentrytitle|refname|refdescriptor" mode="title.markup">
215  <xsl:param name="allow-anchors" select="0"/>
216  <xsl:choose>
217    <xsl:when test="$allow-anchors != 0">
218      <xsl:apply-templates/>
219    </xsl:when>
220    <xsl:otherwise>
221      <xsl:apply-templates mode="no.anchor.mode"/>
222    </xsl:otherwise>
223  </xsl:choose>
224</xsl:template>
225
226<xsl:template match="section
227                     |sect1|sect2|sect3|sect4|sect5
228                     |refsect1|refsect2|refsect3
229                     |simplesect"
230              mode="title.markup">
231  <xsl:param name="allow-anchors" select="0"/>
232  <xsl:variable name="title" select="(info/title
233		                      |sectioninfo/title
234                                      |sect1info/title
235                                      |sect2info/title
236                                      |sect3info/title
237                                      |sect4info/title
238                                      |sect5info/title
239                                      |refsect1info/title
240                                      |refsect2info/title
241                                      |refsect3info/title
242                                      |title)[1]"/>
243
244  <xsl:apply-templates select="$title" mode="title.markup">
245    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
246  </xsl:apply-templates>
247</xsl:template>
248
249<xsl:template match="bridgehead" mode="title.markup">
250  <xsl:apply-templates mode="title.markup"/>
251</xsl:template>
252
253<xsl:template match="refsynopsisdiv" mode="title.markup">
254  <xsl:param name="allow-anchors" select="0"/>
255  <xsl:choose>
256    <xsl:when test="title">
257      <xsl:apply-templates select="title" mode="title.markup">
258        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
259      </xsl:apply-templates>
260    </xsl:when>
261    <xsl:otherwise>
262      <xsl:call-template name="gentext">
263        <xsl:with-param name="key" select="'RefSynopsisDiv'"/>
264      </xsl:call-template>
265    </xsl:otherwise>
266  </xsl:choose>
267</xsl:template>
268
269<xsl:template match="bibliography" mode="title.markup">
270  <xsl:param name="allow-anchors" select="0"/>
271  <xsl:variable name="title" select="(bibliographyinfo/title|info/title|title)[1]"/>
272  <xsl:choose>
273    <xsl:when test="$title">
274      <xsl:apply-templates select="$title" mode="title.markup">
275        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
276      </xsl:apply-templates>
277    </xsl:when>
278    <xsl:otherwise>
279      <xsl:call-template name="gentext">
280        <xsl:with-param name="key" select="'Bibliography'"/>
281      </xsl:call-template>
282    </xsl:otherwise>
283  </xsl:choose>
284</xsl:template>
285
286<xsl:template match="glossary" mode="title.markup">
287  <xsl:param name="allow-anchors" select="0"/>
288  <xsl:variable name="title" select="(glossaryinfo/title|info/title|title)[1]"/>
289  <xsl:choose>
290    <xsl:when test="$title">
291      <xsl:apply-templates select="$title" mode="title.markup">
292        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
293      </xsl:apply-templates>
294    </xsl:when>
295    <xsl:otherwise>
296      <xsl:call-template name="gentext.element.name">
297        <xsl:with-param name="element.name" select="name(.)"/>
298      </xsl:call-template>
299    </xsl:otherwise>
300  </xsl:choose>
301</xsl:template>
302
303<xsl:template match="glossentry" mode="title.markup">
304  <xsl:param name="allow-anchors" select="0"/>
305  <xsl:apply-templates select="glossterm" mode="title.markup">
306    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
307  </xsl:apply-templates>
308</xsl:template>
309
310<xsl:template match="glossterm" mode="title.markup">
311  <xsl:param name="allow-anchors" select="0"/>
312
313  <xsl:choose>
314    <xsl:when test="$allow-anchors != 0">
315      <xsl:apply-templates/>
316    </xsl:when>
317    <xsl:otherwise>
318      <xsl:apply-templates mode="no.anchor.mode"/>
319    </xsl:otherwise>
320  </xsl:choose>
321</xsl:template>
322
323<xsl:template match="index" mode="title.markup">
324  <xsl:param name="allow-anchors" select="0"/>
325  <xsl:variable name="title" select="(indexinfo/title|info/title|title)[1]"/>
326  <xsl:choose>
327    <xsl:when test="$title">
328      <xsl:apply-templates select="$title" mode="title.markup">
329        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
330      </xsl:apply-templates>
331    </xsl:when>
332    <xsl:otherwise>
333      <xsl:call-template name="gentext">
334        <xsl:with-param name="key" select="'Index'"/>
335      </xsl:call-template>
336    </xsl:otherwise>
337  </xsl:choose>
338</xsl:template>
339
340<xsl:template match="setindex" mode="title.markup">
341  <xsl:param name="allow-anchors" select="0"/>
342  <xsl:variable name="title" select="(setindexinfo/title|info/title|title)[1]"/>
343  <xsl:choose>
344    <xsl:when test="$title">
345      <xsl:apply-templates select="$title" mode="title.markup">
346        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
347      </xsl:apply-templates>
348    </xsl:when>
349    <xsl:otherwise>
350      <xsl:call-template name="gentext">
351        <xsl:with-param name="key" select="'SetIndex'"/>
352      </xsl:call-template>
353    </xsl:otherwise>
354  </xsl:choose>
355</xsl:template>
356
357<xsl:template match="figure|example|equation" mode="title.markup">
358  <xsl:param name="allow-anchors" select="0"/>
359  <xsl:apply-templates select="title|info/title" mode="title.markup">
360    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
361  </xsl:apply-templates>
362</xsl:template>
363
364<xsl:template match="table" mode="title.markup">
365  <xsl:param name="allow-anchors" select="0"/>
366  <xsl:apply-templates select="title|caption" mode="title.markup">
367    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
368  </xsl:apply-templates>
369</xsl:template>
370
371<xsl:template match="procedure" mode="title.markup">
372  <xsl:param name="allow-anchors" select="0"/>
373  <xsl:apply-templates select="title" mode="title.markup">
374    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
375  </xsl:apply-templates>
376</xsl:template>
377
378<xsl:template match="task" mode="title.markup">
379  <xsl:param name="allow-anchors" select="0"/>
380  <xsl:apply-templates select="title" mode="title.markup">
381    <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
382  </xsl:apply-templates>
383</xsl:template>
384
385<xsl:template match="abstract" mode="title.markup">
386  <xsl:param name="allow-anchors" select="0"/>
387  <xsl:choose>
388    <xsl:when test="title">
389      <xsl:apply-templates select="title" mode="title.markup">
390        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
391      </xsl:apply-templates>
392    </xsl:when>
393    <xsl:otherwise>
394      <xsl:call-template name="gentext">
395        <xsl:with-param name="key" select="'Abstract'"/>
396      </xsl:call-template>
397    </xsl:otherwise>
398  </xsl:choose>
399</xsl:template>
400
401<xsl:template match="caution|tip|warning|important|note" mode="title.markup">
402  <xsl:param name="allow-anchors" select="0"/>
403  <xsl:variable name="title" select="title[1]"/>
404  <xsl:choose>
405    <xsl:when test="$title">
406      <xsl:apply-templates select="$title" mode="title.markup">
407        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
408      </xsl:apply-templates>
409    </xsl:when>
410    <xsl:otherwise>
411      <xsl:call-template name="gentext">
412        <xsl:with-param name="key">
413          <xsl:choose>
414            <xsl:when test="local-name(.)='note'">Note</xsl:when>
415            <xsl:when test="local-name(.)='important'">Important</xsl:when>
416            <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
417            <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
418            <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
419          </xsl:choose>
420        </xsl:with-param>
421      </xsl:call-template>
422    </xsl:otherwise>
423  </xsl:choose>
424</xsl:template>
425
426<xsl:template match="question" mode="title.markup">
427  <!-- questions don't have titles -->
428  <xsl:text>Question</xsl:text>
429</xsl:template>
430
431<xsl:template match="answer" mode="title.markup">
432  <!-- answers don't have titles -->
433  <xsl:text>Answer</xsl:text>
434</xsl:template>
435
436<xsl:template match="qandaentry" mode="title.markup">
437  <!-- qandaentrys are represented by the first question in them -->
438  <xsl:text>Question</xsl:text>
439</xsl:template>
440
441<xsl:template match="qandaset" mode="title.markup">
442  <xsl:param name="allow-anchors" select="0"/>
443  <xsl:variable name="title" select="(info/title|
444                                      blockinfo/title|
445				      title)[1]"/>
446  <xsl:choose>
447    <xsl:when test="$title">
448      <xsl:apply-templates select="$title" mode="title.markup">
449        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
450      </xsl:apply-templates>
451    </xsl:when>
452    <xsl:otherwise>
453      <xsl:call-template name="gentext">
454        <xsl:with-param name="key" select="'QandASet'"/>
455      </xsl:call-template>
456    </xsl:otherwise>
457  </xsl:choose>
458</xsl:template>
459
460<xsl:template match="legalnotice" mode="title.markup">
461  <xsl:param name="allow-anchors" select="0"/>
462  <xsl:choose>
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>
467    </xsl:when>
468    <xsl:otherwise>
469      <xsl:call-template name="gentext">
470        <xsl:with-param name="key" select="'LegalNotice'"/>
471      </xsl:call-template>
472    </xsl:otherwise>
473  </xsl:choose>
474</xsl:template>
475
476<!-- ============================================================ -->
477
478<xsl:template match="*" mode="titleabbrev.markup">
479  <xsl:param name="allow-anchors" select="0"/>
480  <xsl:param name="verbose" select="1"/>
481
482  <xsl:choose>
483    <xsl:when test="titleabbrev">
484      <xsl:apply-templates select="titleabbrev[1]" mode="title.markup">
485        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
486      </xsl:apply-templates>
487    </xsl:when>
488    <xsl:otherwise>
489      <xsl:apply-templates select="." mode="title.markup">
490        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
491        <xsl:with-param name="verbose" select="$verbose"/>
492      </xsl:apply-templates>
493    </xsl:otherwise>
494  </xsl:choose>
495</xsl:template>
496
497<xsl:template match="book|preface|chapter|appendix" mode="titleabbrev.markup">
498  <xsl:param name="allow-anchors" select="0"/>
499  <xsl:param name="verbose" select="1"/>
500
501  <xsl:variable name="titleabbrev" select="(docinfo/titleabbrev
502                                           |bookinfo/titleabbrev
503                                           |info/titleabbrev
504                                           |prefaceinfo/titleabbrev
505                                           |chapterinfo/titleabbrev
506                                           |appendixinfo/titleabbrev
507                                           |titleabbrev)[1]"/>
508
509  <xsl:choose>
510    <xsl:when test="$titleabbrev">
511      <xsl:apply-templates select="$titleabbrev" mode="title.markup">
512        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
513      </xsl:apply-templates>
514    </xsl:when>
515    <xsl:otherwise>
516      <xsl:apply-templates select="." mode="title.markup">
517        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
518        <xsl:with-param name="verbose" select="$verbose"/>
519      </xsl:apply-templates>
520    </xsl:otherwise>
521  </xsl:choose>
522</xsl:template>
523
524<xsl:template match="article" mode="titleabbrev.markup">
525  <xsl:param name="allow-anchors" select="0"/>
526  <xsl:param name="verbose" select="1"/>
527
528  <xsl:variable name="titleabbrev" select="(artheader/titleabbrev
529                                           |articleinfo/titleabbrev
530                                           |info/titleabbrev
531                                           |titleabbrev)[1]"/>
532
533  <xsl:choose>
534    <xsl:when test="$titleabbrev">
535      <xsl:apply-templates select="$titleabbrev" mode="title.markup">
536        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
537      </xsl:apply-templates>
538    </xsl:when>
539    <xsl:otherwise>
540      <xsl:apply-templates select="." mode="title.markup">
541        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
542        <xsl:with-param name="verbose" select="$verbose"/>
543      </xsl:apply-templates>
544    </xsl:otherwise>
545  </xsl:choose>
546</xsl:template>
547
548<xsl:template match="section
549                     |sect1|sect2|sect3|sect4|sect5
550                     |refsect1|refsect2|refsect3
551                     |simplesect"
552              mode="titleabbrev.markup">
553  <xsl:param name="allow-anchors" select="0"/>
554  <xsl:param name="verbose" select="1"/>
555
556  <xsl:variable name="titleabbrev" select="(info/titleabbrev
557		                            |sectioninfo/titleabbrev
558		                            |sect1info/titleabbrev
559					    |sect2info/titleabbrev
560					    |sect3info/titleabbrev
561					    |sect4info/titleabbrev
562					    |sect5info/titleabbrev
563					    |refsect1info/titleabbrev
564					    |refsect2info/titleabbrev
565					    |refsect3info/titleabbrev
566					    |titleabbrev)[1]"/>
567
568  <xsl:choose>
569    <xsl:when test="$titleabbrev">
570      <xsl:apply-templates select="$titleabbrev" mode="title.markup">
571        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
572      </xsl:apply-templates>
573    </xsl:when>
574    <xsl:otherwise>
575      <xsl:apply-templates select="." mode="title.markup">
576        <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
577        <xsl:with-param name="verbose" select="$verbose"/>
578      </xsl:apply-templates>
579    </xsl:otherwise>
580  </xsl:choose>
581</xsl:template>
582
583<xsl:template match="titleabbrev" mode="title.markup">
584  <xsl:param name="allow-anchors" select="0"/>
585
586  <xsl:choose>
587    <xsl:when test="$allow-anchors != 0">
588      <xsl:apply-templates/>
589    </xsl:when>
590    <xsl:otherwise>
591      <xsl:apply-templates mode="no.anchor.mode"/>
592    </xsl:otherwise>
593  </xsl:choose>
594</xsl:template>
595
596<!-- ============================================================ -->
597
598<xsl:template match="*" mode="no.anchor.mode">
599  <!-- Switch to normal mode if no links -->
600  <xsl:choose>
601    <xsl:when test="descendant-or-self::footnote or
602                    descendant-or-self::anchor or
603                    descendant-or-self::ulink or
604                    descendant-or-self::link or
605                    descendant-or-self::olink or
606                    descendant-or-self::xref or
607                    descendant-or-self::indexterm">
608
609      <xsl:apply-templates mode="no.anchor.mode"/>
610    </xsl:when>
611    <xsl:otherwise>
612      <xsl:apply-templates select="."/>
613    </xsl:otherwise>
614  </xsl:choose>
615</xsl:template>
616
617<xsl:template match="footnote" mode="no.anchor.mode">
618  <!-- nop, suppressed -->
619</xsl:template>
620
621<xsl:template match="anchor" mode="no.anchor.mode">
622  <!-- nop, suppressed -->
623</xsl:template>
624
625<xsl:template match="ulink" mode="no.anchor.mode">
626  <xsl:apply-templates/>
627</xsl:template>
628
629<xsl:template match="link" mode="no.anchor.mode">
630  <xsl:apply-templates/>
631</xsl:template>
632
633<xsl:template match="olink" mode="no.anchor.mode">
634  <xsl:apply-templates/>
635</xsl:template>
636
637<xsl:template match="indexterm" mode="no.anchor.mode">
638  <!-- nop, suppressed -->
639</xsl:template>
640
641<xsl:template match="xref" mode="no.anchor.mode">
642  <xsl:variable name="targets" select="key('id',@linkend)"/>
643  <xsl:variable name="target" select="$targets[1]"/>
644  <xsl:variable name="refelem" select="local-name($target)"/>
645  
646  <xsl:call-template name="check.id.unique">
647    <xsl:with-param name="linkend" select="@linkend"/>
648  </xsl:call-template>
649
650  <xsl:choose>
651    <xsl:when test="count($target) = 0">
652      <xsl:message>
653        <xsl:text>XRef to nonexistent id: </xsl:text>
654        <xsl:value-of select="@linkend"/>
655      </xsl:message>
656      <xsl:text>???</xsl:text>
657    </xsl:when>
658
659    <xsl:when test="@endterm">
660      <xsl:variable name="etargets" select="key('id',@endterm)"/>
661      <xsl:variable name="etarget" select="$etargets[1]"/>
662      <xsl:choose>
663	<xsl:when test="count($etarget) = 0">
664	  <xsl:message>
665            <xsl:value-of select="count($etargets)"/>
666            <xsl:text>Endterm points to nonexistent ID: </xsl:text>
667            <xsl:value-of select="@endterm"/>
668	  </xsl:message>
669	  <xsl:text>???</xsl:text>
670	</xsl:when>
671	<xsl:otherwise>
672	  <xsl:apply-templates select="$etarget" mode="endterm"/>
673	</xsl:otherwise>
674      </xsl:choose>
675    </xsl:when>
676
677    <xsl:when test="$target/@xreflabel">
678      <xsl:call-template name="xref.xreflabel">
679	<xsl:with-param name="target" select="$target"/>
680      </xsl:call-template>
681    </xsl:when>
682
683    <xsl:otherwise>
684      <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
685
686      <xsl:apply-templates select="$target" mode="xref-to">
687	<xsl:with-param name="referrer" select="."/>
688	<xsl:with-param name="xrefstyle">
689	  <xsl:choose>
690	    <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
691	      <xsl:value-of select="@role"/>
692	    </xsl:when>
693	    <xsl:otherwise>
694	      <xsl:value-of select="@xrefstyle"/>
695	    </xsl:otherwise>
696	  </xsl:choose>
697	</xsl:with-param>
698      </xsl:apply-templates>
699
700      <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
701    </xsl:otherwise>
702  </xsl:choose>
703</xsl:template>
704
705<!-- ============================================================ -->
706
707</xsl:stylesheet>
708
709