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