Debian Codegraph @

xsl/common/titles.xsl

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