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