source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/common/titles.xsl@ d3ca804

sysvinit
Last change on this file since d3ca804 was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

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