Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: third_party/docbook-xsl-1.78.0/html/glossary.xsl

Issue 1394993002: Doing some cleanup. (Closed) Base URL: https://github.com/dart-lang/www.dartlang.org.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <?xml version='1.0'?>
2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY % common.entities SYSTEM "../common/entities.ent">
4 %common.entities;
5 ]>
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:xlink='http://www.w3.org/1999/xlink'
8 exclude-result-prefixes="xlink"
9 version='1.0'>
10
11 <!-- ********************************************************************
12 $Id: glossary.xsl 9364 2012-05-12 23:43:04Z bobstayton $
13 ********************************************************************
14
15 This file is part of the XSL DocBook Stylesheet distribution.
16 See ../README or http://docbook.sf.net/release/xsl/current/ for
17 copyright and other information.
18
19 ******************************************************************** -->
20
21 <!-- ==================================================================== -->
22
23 <xsl:template match="glossary">
24 &setup-language-variable;
25 <xsl:call-template name="id.warning"/>
26
27 <xsl:element name="{$div.element}">
28 <xsl:apply-templates select="." mode="common.html.attributes"/>
29 <xsl:call-template name="id.attribute">
30 <xsl:with-param name="conditional" select="0"/>
31 </xsl:call-template>
32
33 <xsl:call-template name="glossary.titlepage"/>
34
35 <xsl:choose>
36 <xsl:when test="glossdiv">
37 <xsl:apply-templates select="(glossdiv[1]/preceding-sibling::*)"/>
38 </xsl:when>
39 <xsl:when test="glossentry">
40 <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
41 </xsl:when>
42 <xsl:otherwise>
43 <xsl:apply-templates/>
44 </xsl:otherwise>
45 </xsl:choose>
46
47 <xsl:choose>
48 <xsl:when test="glossdiv">
49 <xsl:apply-templates select="glossdiv"/>
50 </xsl:when>
51 <xsl:when test="glossentry">
52 <dl>
53 <xsl:choose>
54 <xsl:when test="$glossary.sort != 0">
55 <xsl:apply-templates select="glossentry">
56 <xsl:sort lang="{$language}" select="normalize-s pace(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or pare nt::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
57 </xsl:apply-templates>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:apply-templates select="glossentry"/>
61 </xsl:otherwise>
62 </xsl:choose>
63 </dl>
64 </xsl:when>
65 <xsl:otherwise>
66 <!-- empty glossary -->
67 </xsl:otherwise>
68 </xsl:choose>
69
70 <xsl:if test="not(parent::article)">
71 <xsl:call-template name="process.footnotes"/>
72 </xsl:if>
73 </xsl:element>
74 </xsl:template>
75
76 <xsl:template match="glossary/glossaryinfo"></xsl:template>
77 <xsl:template match="glossary/info"></xsl:template>
78 <xsl:template match="glossary/title"></xsl:template>
79 <xsl:template match="glossary/subtitle"></xsl:template>
80 <xsl:template match="glossary/titleabbrev"></xsl:template>
81
82 <!-- ==================================================================== -->
83
84 <xsl:template match="glosslist">
85 &setup-language-variable;
86 <div>
87 <xsl:apply-templates select="." mode="common.html.attributes"/>
88 <xsl:call-template name="id.attribute"/>
89 <xsl:call-template name="anchor"/>
90 <xsl:if test="blockinfo/title|info/title|title">
91 <xsl:call-template name="formal.object.heading"/>
92 </xsl:if>
93 <dl>
94 <xsl:choose>
95 <xsl:when test="$glossary.sort != 0">
96 <xsl:apply-templates select="glossentry">
97 <xsl:sort lang="{$language}" select="normalize-s pace(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or pare nt::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
98 </xsl:apply-templates>
99 </xsl:when>
100 <xsl:otherwise>
101 <xsl:apply-templates select="glossentry"/>
102 </xsl:otherwise>
103 </xsl:choose>
104 </dl>
105 </div>
106 </xsl:template>
107
108 <!-- ==================================================================== -->
109
110 <xsl:template match="glossdiv">
111 &setup-language-variable;
112 <xsl:call-template name="id.warning"/>
113
114 <div>
115 <xsl:apply-templates select="." mode="common.html.attributes"/>
116 <xsl:call-template name="id.attribute">
117 <xsl:with-param name="conditional" select="0"/>
118 </xsl:call-template>
119 <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
120
121 <dl>
122 <xsl:choose>
123 <xsl:when test="$glossary.sort != 0">
124 <xsl:apply-templates select="glossentry">
125 <xsl:sort lang="{$language}"
126 select="translate(glossterm, $lowercase,
127 $uppercase)"/>
128 </xsl:apply-templates>
129 </xsl:when>
130 <xsl:otherwise>
131 <xsl:apply-templates select="glossentry"/>
132 </xsl:otherwise>
133 </xsl:choose>
134 </dl>
135 </div>
136 </xsl:template>
137
138 <xsl:template match="glossdiv/title">
139 <h3>
140 <xsl:apply-templates select="." mode="common.html.attributes"/>
141 <xsl:apply-templates/>
142 </h3>
143 </xsl:template>
144
145 <!-- ==================================================================== -->
146
147 <!--
148 GlossEntry ::=
149 GlossTerm, Acronym?, Abbrev?,
150 (IndexTerm)*,
151 RevHistory?,
152 (GlossSee | GlossDef+)
153 -->
154
155 <xsl:template match="glossentry">
156 <xsl:choose>
157 <xsl:when test="$glossentry.show.acronym = 'primary'">
158 <dt>
159 <xsl:call-template name="id.attribute">
160 <xsl:with-param name="conditional">
161 <xsl:choose>
162 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
163 <xsl:otherwise>1</xsl:otherwise>
164 </xsl:choose>
165 </xsl:with-param>
166 </xsl:call-template>
167 <xsl:call-template name="anchor">
168 <xsl:with-param name="conditional">
169 <xsl:choose>
170 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
171 <xsl:otherwise>1</xsl:otherwise>
172 </xsl:choose>
173 </xsl:with-param>
174 </xsl:call-template>
175
176 <xsl:choose>
177 <xsl:when test="acronym|abbrev">
178 <xsl:apply-templates select="acronym|abbrev"/>
179 <xsl:text> (</xsl:text>
180 <xsl:apply-templates select="glossterm"/>
181 <xsl:text>)</xsl:text>
182 </xsl:when>
183 <xsl:otherwise>
184 <xsl:apply-templates select="glossterm"/>
185 </xsl:otherwise>
186 </xsl:choose>
187 </dt>
188 </xsl:when>
189 <xsl:when test="$glossentry.show.acronym = 'yes'">
190 <dt>
191 <xsl:call-template name="id.attribute">
192 <xsl:with-param name="conditional">
193 <xsl:choose>
194 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
195 <xsl:otherwise>1</xsl:otherwise>
196 </xsl:choose>
197 </xsl:with-param>
198 </xsl:call-template>
199 <xsl:call-template name="anchor">
200 <xsl:with-param name="conditional">
201 <xsl:choose>
202 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
203 <xsl:otherwise>1</xsl:otherwise>
204 </xsl:choose>
205 </xsl:with-param>
206 </xsl:call-template>
207
208 <xsl:apply-templates select="glossterm"/>
209
210 <xsl:if test="acronym|abbrev">
211 <xsl:text> (</xsl:text>
212 <xsl:apply-templates select="acronym|abbrev"/>
213 <xsl:text>)</xsl:text>
214 </xsl:if>
215 </dt>
216 </xsl:when>
217 <xsl:otherwise>
218 <dt>
219 <xsl:call-template name="id.attribute">
220 <xsl:with-param name="conditional">
221 <xsl:choose>
222 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
223 <xsl:otherwise>1</xsl:otherwise>
224 </xsl:choose>
225 </xsl:with-param>
226 </xsl:call-template>
227 <xsl:call-template name="anchor">
228 <xsl:with-param name="conditional">
229 <xsl:choose>
230 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
231 <xsl:otherwise>1</xsl:otherwise>
232 </xsl:choose>
233 </xsl:with-param>
234 </xsl:call-template>
235
236 <xsl:apply-templates select="glossterm"/>
237 </dt>
238 </xsl:otherwise>
239 </xsl:choose>
240
241 <xsl:apply-templates select="indexterm|revhistory|glosssee|glossdef"/>
242 </xsl:template>
243
244 <xsl:template match="glossentry/glossterm">
245 <xsl:apply-templates/>
246 <xsl:if test="following-sibling::glossterm">, </xsl:if>
247 </xsl:template>
248
249 <xsl:template match="glossentry/acronym">
250 <xsl:apply-templates/>
251 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if >
252 </xsl:template>
253
254 <xsl:template match="glossentry/abbrev">
255 <xsl:apply-templates/>
256 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if >
257 </xsl:template>
258
259 <xsl:template match="glossentry/revhistory">
260 </xsl:template>
261
262 <xsl:template match="glossentry/glosssee">
263 <xsl:variable name="otherterm" select="@otherterm"/>
264 <xsl:variable name="targets" select="key('id', $otherterm)"/>
265 <xsl:variable name="target" select="$targets[1]"/>
266 <xsl:variable name="xlink" select="@xlink:href"/>
267
268 <dd>
269 <p>
270 <xsl:variable name="template">
271 <xsl:call-template name="gentext.template">
272 <xsl:with-param name="context" select="'glossary'"/>
273 <xsl:with-param name="name" select="'see'"/>
274 </xsl:call-template>
275 </xsl:variable>
276
277 <xsl:variable name="title">
278 <xsl:choose>
279 <xsl:when test="$target">
280 <a>
281 <xsl:apply-templates select="." mode="common.html.attributes"/>
282 <xsl:call-template name="id.attribute"/>
283 <xsl:attribute name="href">
284 <xsl:call-template name="href.target">
285 <xsl:with-param name="object" select="$target"/>
286 </xsl:call-template>
287 </xsl:attribute>
288 <xsl:apply-templates select="$target" mode="xref-to"/>
289 </a>
290 </xsl:when>
291 <xsl:when test="$xlink">
292 <xsl:call-template name="simple.xlink">
293 <xsl:with-param name="content">
294 <xsl:apply-templates/>
295 </xsl:with-param>
296 </xsl:call-template>
297 </xsl:when>
298 <xsl:when test="$otherterm != '' and not($target)">
299 <xsl:message>
300 <xsl:text>Warning: glosssee @otherterm reference not found: </xsl: text>
301 <xsl:value-of select="$otherterm"/>
302 </xsl:message>
303 <xsl:apply-templates/>
304 </xsl:when>
305 <xsl:otherwise>
306 <xsl:apply-templates/>
307 </xsl:otherwise>
308 </xsl:choose>
309 </xsl:variable>
310
311 <xsl:call-template name="substitute-markup">
312 <xsl:with-param name="template" select="$template"/>
313 <xsl:with-param name="title" select="$title"/>
314 </xsl:call-template>
315 </p>
316 </dd>
317 </xsl:template>
318
319 <xsl:template match="glossentry/glossdef">
320 <dd>
321 <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
322 <xsl:if test="glossseealso">
323 <p>
324 <xsl:variable name="template">
325 <xsl:call-template name="gentext.template">
326 <xsl:with-param name="context" select="'glossary'"/>
327 <xsl:with-param name="name" select="'seealso'"/>
328 </xsl:call-template>
329 </xsl:variable>
330 <xsl:variable name="title">
331 <xsl:apply-templates select="glossseealso"/>
332 </xsl:variable>
333 <xsl:call-template name="substitute-markup">
334 <xsl:with-param name="template" select="$template"/>
335 <xsl:with-param name="title" select="$title"/>
336 </xsl:call-template>
337 </p>
338 </xsl:if>
339 </dd>
340 </xsl:template>
341
342 <xsl:template match="glossseealso">
343 <xsl:variable name="otherterm" select="@otherterm"/>
344 <xsl:variable name="targets" select="key('id', $otherterm)"/>
345 <xsl:variable name="target" select="$targets[1]"/>
346 <xsl:variable name="xlink" select="@xlink:href"/>
347
348 <xsl:choose>
349 <xsl:when test="$target">
350 <a>
351 <xsl:apply-templates select="." mode="common.html.attributes"/>
352 <xsl:call-template name="id.attribute"/>
353 <xsl:attribute name="href">
354 <xsl:call-template name="href.target">
355 <xsl:with-param name="object" select="$target"/>
356 </xsl:call-template>
357 </xsl:attribute>
358 <xsl:apply-templates select="$target" mode="xref-to"/>
359 </a>
360 </xsl:when>
361 <xsl:when test="$xlink">
362 <xsl:call-template name="simple.xlink">
363 <xsl:with-param name="content">
364 <xsl:apply-templates/>
365 </xsl:with-param>
366 </xsl:call-template>
367 </xsl:when>
368 <xsl:when test="$otherterm != '' and not($target)">
369 <xsl:message>
370 <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:te xt>
371 <xsl:value-of select="$otherterm"/>
372 </xsl:message>
373 <xsl:apply-templates/>
374 </xsl:when>
375 <xsl:otherwise>
376 <xsl:apply-templates/>
377 </xsl:otherwise>
378 </xsl:choose>
379
380 <xsl:choose>
381 <xsl:when test="position() = last()"/>
382 <xsl:otherwise>
383 <xsl:call-template name="gentext.template">
384 <xsl:with-param name="context" select="'glossary'"/>
385 <xsl:with-param name="name" select="'seealso-separator'"/>
386 </xsl:call-template>
387 </xsl:otherwise>
388 </xsl:choose>
389 </xsl:template>
390
391 <!-- ==================================================================== -->
392
393 <!-- Glossary collection -->
394
395 <xsl:template match="glossary[@role='auto']" priority="2">
396 &setup-language-variable;
397 <xsl:variable name="terms"
398 select="//glossterm[not(parent::glossdef)]|//firstterm"/>
399 <xsl:variable name="collection" select="document($glossary.collection, .)"/>
400
401 <xsl:call-template name="id.warning"/>
402
403 <xsl:if test="$glossary.collection = ''">
404 <xsl:message>
405 <xsl:text>Warning: processing automatic glossary </xsl:text>
406 <xsl:text>without a glossary.collection file.</xsl:text>
407 </xsl:message>
408 </xsl:if>
409
410 <xsl:if test="not($collection) and $glossary.collection != ''">
411 <xsl:message>
412 <xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
413 <xsl:text>open glossary.collection file '</xsl:text>
414 <xsl:value-of select="$glossary.collection"/>
415 <xsl:text>'</xsl:text>
416 </xsl:message>
417 </xsl:if>
418
419 <div>
420 <xsl:apply-templates select="." mode="common.html.attributes"/>
421 <xsl:call-template name="id.attribute">
422 <xsl:with-param name="conditional" select="0"/>
423 </xsl:call-template>
424
425 <xsl:call-template name="glossary.titlepage"/>
426
427 <xsl:choose>
428 <xsl:when test="glossdiv and $collection//glossdiv">
429 <xsl:for-each select="$collection//glossdiv">
430 <!-- first see if there are any in this div -->
431 <xsl:variable name="exist.test">
432 <xsl:for-each select="glossentry">
433 <xsl:variable name="cterm" select="glossterm"/>
434 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
435 <xsl:value-of select="glossterm"/>
436 </xsl:if>
437 </xsl:for-each>
438 </xsl:variable>
439
440 <xsl:if test="$exist.test != ''">
441 <xsl:apply-templates select="." mode="auto-glossary">
442 <xsl:with-param name="terms" select="$terms"/>
443 </xsl:apply-templates>
444 </xsl:if>
445 </xsl:for-each>
446 </xsl:when>
447 <xsl:otherwise>
448 <dl>
449 <xsl:choose>
450 <xsl:when test="$glossary.sort != 0">
451 <xsl:for-each select="$collection//glossentry">
452 <xsl:sort lang="{$language}" select="normalize-s pace(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or pare nt::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
453 <xsl:variable name="cterm" select="glossterm"/>
454 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
455 <xsl:apply-templates select="." mode="auto-glossary"/>
456 </xsl:if>
457 </xsl:for-each>
458 </xsl:when>
459 <xsl:otherwise>
460 <xsl:for-each select="$collection//glossentry">
461 <xsl:variable name="cterm" select="glossterm"/>
462 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
463 <xsl:apply-templates select="." mode="auto-glossary"/>
464 </xsl:if>
465 </xsl:for-each>
466 </xsl:otherwise>
467 </xsl:choose>
468 </dl>
469 </xsl:otherwise>
470 </xsl:choose>
471
472 <xsl:if test="not(parent::article)">
473 <xsl:call-template name="process.footnotes"/>
474 </xsl:if>
475 </div>
476 </xsl:template>
477
478 <xsl:template match="*" mode="auto-glossary">
479 <!-- pop back out to the default mode for most elements -->
480 <xsl:apply-templates select="."/>
481 </xsl:template>
482
483 <xsl:template match="glossdiv" mode="auto-glossary">
484 <xsl:param name="terms" select="."/>
485
486 &setup-language-variable;
487
488 <div>
489 <xsl:apply-templates select="." mode="common.html.attributes"/>
490 <xsl:call-template name="id.attribute">
491 <xsl:with-param name="conditional" select="0"/>
492 </xsl:call-template>
493 <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
494
495 <dl>
496 <xsl:choose>
497 <xsl:when test="$glossary.sort != 0">
498 <xsl:for-each select="glossentry">
499 <xsl:sort lang="{$language}" select="normalize-s pace(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or pare nt::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
500 <xsl:variable name="cterm" select="glossterm"/>
501 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
502 <xsl:apply-templates select="." mode="auto-glossary"/>
503 </xsl:if>
504 </xsl:for-each>
505 </xsl:when>
506 <xsl:otherwise>
507 <xsl:for-each select="glossentry">
508 <xsl:variable name="cterm" select="glossterm"/>
509 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
510 <xsl:apply-templates select="." mode="auto-glossary"/>
511 </xsl:if>
512 </xsl:for-each>
513 </xsl:otherwise>
514 </xsl:choose>
515 </dl>
516 </div>
517 </xsl:template>
518
519 <!-- ==================================================================== -->
520
521 </xsl:stylesheet>
OLDNEW
« no previous file with comments | « third_party/docbook-xsl-1.78.0/html/formal.xsl ('k') | third_party/docbook-xsl-1.78.0/html/graphics.xsl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698