source: trunk/Distribution/XSL/xhtml/glossary.xsl@ 3

Last change on this file since 3 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

File size: 12.0 KB
Line 
1<?xml version="1.0" encoding="US-ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets. Do not edit this file.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6<!-- ********************************************************************
7 $Id: glossary.xsl,v 1.19 2005/05/13 17:23:42 bobstayton Exp $
8 ********************************************************************
9
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
12 and other information.
13
14 ******************************************************************** -->
15
16<!-- ==================================================================== -->
17
18<xsl:template match="glossary">
19 <div class="{name(.)}">
20 <xsl:if test="$generate.id.attributes != 0">
21 <xsl:attribute name="id">
22 <xsl:call-template name="object.id"/>
23 </xsl:attribute>
24 </xsl:if>
25
26 <xsl:call-template name="glossary.titlepage"/>
27
28 <xsl:choose>
29 <xsl:when test="glossdiv">
30 <xsl:apply-templates select="(glossdiv[1]/preceding-sibling::*)"/>
31 </xsl:when>
32 <xsl:otherwise>
33 <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
34 </xsl:otherwise>
35 </xsl:choose>
36
37 <xsl:choose>
38 <xsl:when test="glossdiv">
39 <xsl:apply-templates select="glossdiv"/>
40 </xsl:when>
41 <xsl:otherwise>
42 <dl>
43 <xsl:apply-templates select="glossentry"/>
44 </dl>
45 </xsl:otherwise>
46 </xsl:choose>
47
48 <xsl:if test="not(parent::article)">
49 <xsl:call-template name="process.footnotes"/>
50 </xsl:if>
51 </div>
52</xsl:template>
53
54<xsl:template match="glossary/glossaryinfo"/>
55<xsl:template match="glossary/title"/>
56<xsl:template match="glossary/subtitle"/>
57<xsl:template match="glossary/titleabbrev"/>
58
59<!-- ==================================================================== -->
60
61<xsl:template match="glosslist">
62 <div class="{name(.)}">
63 <xsl:call-template name="anchor"/>
64 <xsl:if test="blockinfo/title|title">
65 <xsl:call-template name="formal.object.heading"/>
66 </xsl:if>
67 <dl>
68 <xsl:apply-templates select="glossentry"/>
69 </dl>
70 </div>
71</xsl:template>
72
73<!-- ==================================================================== -->
74
75<xsl:template match="glossdiv">
76 <div class="{name(.)}">
77 <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
78
79 <dl>
80 <xsl:apply-templates select="glossentry"/>
81 </dl>
82 </div>
83</xsl:template>
84
85<xsl:template match="glossdiv/title">
86 <h3 class="{name(.)}">
87 <xsl:apply-templates/>
88 </h3>
89</xsl:template>
90
91<!-- ==================================================================== -->
92
93<!--
94GlossEntry ::=
95 GlossTerm, Acronym?, Abbrev?,
96 (IndexTerm)*,
97 RevHistory?,
98 (GlossSee | GlossDef+)
99-->
100
101<xsl:template match="glossentry">
102 <xsl:choose>
103 <xsl:when test="$glossentry.show.acronym = 'primary'">
104 <dt>
105 <xsl:call-template name="anchor">
106 <xsl:with-param name="conditional">
107 <xsl:choose>
108 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
109 <xsl:otherwise>1</xsl:otherwise>
110 </xsl:choose>
111 </xsl:with-param>
112 </xsl:call-template>
113
114 <xsl:choose>
115 <xsl:when test="acronym|abbrev">
116 <xsl:apply-templates select="acronym|abbrev"/>
117 <xsl:text> (</xsl:text>
118 <xsl:apply-templates select="glossterm"/>
119 <xsl:text>)</xsl:text>
120 </xsl:when>
121 <xsl:otherwise>
122 <xsl:apply-templates select="glossterm"/>
123 </xsl:otherwise>
124 </xsl:choose>
125 </dt>
126 </xsl:when>
127 <xsl:when test="$glossentry.show.acronym = 'yes'">
128 <dt>
129 <xsl:call-template name="anchor">
130 <xsl:with-param name="conditional">
131 <xsl:choose>
132 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
133 <xsl:otherwise>1</xsl:otherwise>
134 </xsl:choose>
135 </xsl:with-param>
136 </xsl:call-template>
137
138 <xsl:apply-templates select="glossterm"/>
139
140 <xsl:if test="acronym|abbrev">
141 <xsl:text> (</xsl:text>
142 <xsl:apply-templates select="acronym|abbrev"/>
143 <xsl:text>)</xsl:text>
144 </xsl:if>
145 </dt>
146 </xsl:when>
147 <xsl:otherwise>
148 <dt>
149 <xsl:call-template name="anchor">
150 <xsl:with-param name="conditional">
151 <xsl:choose>
152 <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
153 <xsl:otherwise>1</xsl:otherwise>
154 </xsl:choose>
155 </xsl:with-param>
156 </xsl:call-template>
157
158 <xsl:apply-templates select="glossterm"/>
159 </dt>
160 </xsl:otherwise>
161 </xsl:choose>
162
163 <xsl:apply-templates select="indexterm|revhistory|glosssee|glossdef"/>
164</xsl:template>
165
166<xsl:template match="glossentry/glossterm">
167 <xsl:apply-templates/>
168 <xsl:if test="following-sibling::glossterm">, </xsl:if>
169</xsl:template>
170
171<xsl:template match="glossentry/acronym">
172 <xsl:apply-templates/>
173 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
174</xsl:template>
175
176<xsl:template match="glossentry/abbrev">
177 <xsl:apply-templates/>
178 <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
179</xsl:template>
180
181<xsl:template match="glossentry/revhistory">
182</xsl:template>
183
184<xsl:template match="glossentry/glosssee">
185 <xsl:variable name="otherterm" select="@otherterm"/>
186 <xsl:variable name="targets" select="//node()[@id=$otherterm]"/>
187 <xsl:variable name="target" select="$targets[1]"/>
188
189 <dd>
190 <p>
191 <xsl:variable name="template">
192 <xsl:call-template name="gentext.template">
193 <xsl:with-param name="context" select="'glossary'"/>
194 <xsl:with-param name="name" select="'see'"/>
195 </xsl:call-template>
196 </xsl:variable>
197
198 <xsl:variable name="title">
199 <xsl:choose>
200 <xsl:when test="$target">
201 <a>
202 <xsl:attribute name="href">
203 <xsl:call-template name="href.target">
204 <xsl:with-param name="object" select="$target"/>
205 </xsl:call-template>
206 </xsl:attribute>
207 <xsl:apply-templates select="$target" mode="xref-to"/>
208 </a>
209 </xsl:when>
210 <xsl:when test="$otherterm != '' and not($target)">
211 <xsl:message>
212 <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
213 <xsl:value-of select="$otherterm"/>
214 </xsl:message>
215 <xsl:apply-templates/>
216 </xsl:when>
217 <xsl:otherwise>
218 <xsl:apply-templates/>
219 </xsl:otherwise>
220 </xsl:choose>
221 </xsl:variable>
222
223 <xsl:call-template name="substitute-markup">
224 <xsl:with-param name="template" select="$template"/>
225 <xsl:with-param name="title" select="$title"/>
226 </xsl:call-template>
227 <xsl:text>.</xsl:text>
228 </p>
229 </dd>
230</xsl:template>
231
232<xsl:template match="glossentry/glossdef">
233 <dd>
234 <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
235 <xsl:if test="glossseealso">
236 <p>
237 <xsl:variable name="template">
238 <xsl:call-template name="gentext.template">
239 <xsl:with-param name="context" select="'glossary'"/>
240 <xsl:with-param name="name" select="'seealso'"/>
241 </xsl:call-template>
242 </xsl:variable>
243 <xsl:variable name="title">
244 <xsl:apply-templates select="glossseealso"/>
245 </xsl:variable>
246 <xsl:call-template name="substitute-markup">
247 <xsl:with-param name="template" select="$template"/>
248 <xsl:with-param name="title" select="$title"/>
249 </xsl:call-template>
250 </p>
251 </xsl:if>
252 </dd>
253</xsl:template>
254
255<xsl:template match="glossseealso">
256 <xsl:variable name="otherterm" select="@otherterm"/>
257 <xsl:variable name="targets" select="//node()[@id=$otherterm]"/>
258 <xsl:variable name="target" select="$targets[1]"/>
259
260 <xsl:choose>
261 <xsl:when test="$target">
262 <a>
263 <xsl:attribute name="href">
264 <xsl:call-template name="href.target">
265 <xsl:with-param name="object" select="$target"/>
266 </xsl:call-template>
267 </xsl:attribute>
268 <xsl:apply-templates select="$target" mode="xref-to"/>
269 </a>
270 </xsl:when>
271 <xsl:when test="$otherterm != '' and not($target)">
272 <xsl:message>
273 <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
274 <xsl:value-of select="$otherterm"/>
275 </xsl:message>
276 <xsl:apply-templates/>
277 </xsl:when>
278 <xsl:otherwise>
279 <xsl:apply-templates/>
280 </xsl:otherwise>
281 </xsl:choose>
282
283 <xsl:choose>
284 <xsl:when test="position() = last()">
285 <xsl:text>.</xsl:text>
286 </xsl:when>
287 <xsl:otherwise>
288 <xsl:text>, </xsl:text>
289 </xsl:otherwise>
290 </xsl:choose>
291</xsl:template>
292
293<!-- ==================================================================== -->
294
295<!-- Glossary collection -->
296
297<xsl:template match="glossary[@role='auto']" priority="2">
298 <xsl:variable name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/>
299 <xsl:variable name="collection" select="document($glossary.collection, .)"/>
300
301 <xsl:if test="$glossary.collection = ''">
302 <xsl:message>
303 <xsl:text>Warning: processing automatic glossary </xsl:text>
304 <xsl:text>without a glossary.collection file.</xsl:text>
305 </xsl:message>
306 </xsl:if>
307
308 <xsl:if test="not($collection) and $glossary.collection != ''">
309 <xsl:message>
310 <xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
311 <xsl:text>open glossary.collection file '</xsl:text>
312 <xsl:value-of select="$glossary.collection"/>
313 <xsl:text>'</xsl:text>
314 </xsl:message>
315 </xsl:if>
316
317 <div class="{name(.)}">
318 <xsl:if test="$generate.id.attributes != 0">
319 <xsl:attribute name="id">
320 <xsl:call-template name="object.id"/>
321 </xsl:attribute>
322 </xsl:if>
323
324 <xsl:call-template name="glossary.titlepage"/>
325
326 <xsl:choose>
327 <xsl:when test="glossdiv and $collection//glossdiv">
328 <xsl:for-each select="$collection//glossdiv">
329 <!-- first see if there are any in this div -->
330 <xsl:variable name="exist.test">
331 <xsl:for-each select="glossentry">
332 <xsl:variable name="cterm" select="glossterm"/>
333 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
334 <xsl:value-of select="glossterm"/>
335 </xsl:if>
336 </xsl:for-each>
337 </xsl:variable>
338
339 <xsl:if test="$exist.test != ''">
340 <xsl:apply-templates select="." mode="auto-glossary">
341 <xsl:with-param name="terms" select="$terms"/>
342 </xsl:apply-templates>
343 </xsl:if>
344 </xsl:for-each>
345 </xsl:when>
346 <xsl:otherwise>
347 <dl>
348 <xsl:for-each select="$collection//glossentry">
349 <xsl:variable name="cterm" select="glossterm"/>
350 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
351 <xsl:apply-templates select="." mode="auto-glossary"/>
352 </xsl:if>
353 </xsl:for-each>
354 </dl>
355 </xsl:otherwise>
356 </xsl:choose>
357
358 <xsl:if test="not(parent::article)">
359 <xsl:call-template name="process.footnotes"/>
360 </xsl:if>
361 </div>
362</xsl:template>
363
364<xsl:template match="*" mode="auto-glossary">
365 <!-- pop back out to the default mode for most elements -->
366 <xsl:apply-templates select="."/>
367</xsl:template>
368
369<xsl:template match="glossdiv" mode="auto-glossary">
370 <xsl:param name="terms" select="."/>
371
372 <div class="{name(.)}">
373 <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
374
375 <dl>
376 <xsl:for-each select="glossentry">
377 <xsl:variable name="cterm" select="glossterm"/>
378 <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
379 <xsl:apply-templates select="." mode="auto-glossary"/>
380 </xsl:if>
381 </xsl:for-each>
382 </dl>
383 </div>
384</xsl:template>
385
386<!-- ==================================================================== -->
387
388</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.