1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
|
<?xml version='1.0'?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
<!--#############################################################################
| $Id: glossary.mod.xsl,v 1.16 2004/01/26 08:58:10 j-devenish Exp $
|- #############################################################################
| $Author: j-devenish $
+ ############################################################################## -->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc" version='1.0'>
<doc:reference id="glossary" xmlns="">
<referenceinfo>
<releaseinfo role="meta">
$Id: glossary.mod.xsl,v 1.16 2004/01/26 08:58:10 j-devenish Exp $
</releaseinfo>
<authorgroup>
&ramon;
&james;
</authorgroup>
<copyright>
<year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
<holder>Ramon Casellas</holder>
</copyright>
<revhistory>
<doc:revision rcasver="1.12">&rev_2003_05;</doc:revision>
</revhistory>
</referenceinfo>
<title>Glossaries <filename>glossary.mod.xsl</filename></title>
<partintro>
<para>
Although &LaTeX; provides some glossary support, the better glossary
management support motivates the bypass of the &LaTeX;
<function condition="latex">makeglossary</function> command.
</para>
</partintro>
</doc:reference>
<doc:template xmlns="">
<refpurpose>Process <doc:db>glossary</doc:db> elements</refpurpose>
<doc:description>
<para>
The <doc:db>glossary</doc:db> element is the entry point to a
&DocBook; glossary. The &DB2LaTeX; processing of the element is
quite straight- forward. First thing is to check whether the
document is a <doc:db>book</doc:db> or <doc:db>article</doc:db>. In
both cases, two new &LaTeX; commands are defined: <function
condition="latex">dbglossary</function> and <function
condition="latex">dbglossdiv</function>. In the former case, they
are mapped to <function condition="latex">chapter*</function> and
<function condition="latex">section*</function>. In the second case
to <function condition="latex">section*</function> and <function
condition="latex">subsection*</function>. The <function
condition="env">description</function> environment is used for
<doc:db basename="glossentry">glossentries</doc:db>.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
<doc:notes>
<itemizedlist>
<listitem><para>Call template map.begin.</para></listitem>
<listitem><para>Apply Templates for Preamble, GlossDivs and GlossEntries (serial).</para></listitem>
<listitem><para>Call template map.end.</para></listitem>
</itemizedlist>
&essential_preamble;
</doc:notes>
<doc:samples>
<simplelist type='inline'>
&test_book;
&test_gloss;
&test_ieeebiblio;
&test_mapping;
</simplelist>
</doc:samples>
<doc:seealso>
<itemizedlist>
<listitem><simpara>&mapping;</simpara></listitem>
</itemizedlist>
</doc:seealso>
</doc:template>
<xsl:template match="glossary">
<xsl:variable name="divs" select="glossdiv"/>
<xsl:variable name="entries" select="glossentry"/>
<xsl:variable name="preamble" select="node()[not(self::glossaryinfo or self::title or self::subtitle or self::titleabbrev or self::glossdiv or self::glossentry or self::bibliography)]"/>
<xsl:call-template name="map.begin"/>
<!--
<xsl:if test="./subtitle"><xsl:apply-templates select="./subtitle" mode="component.title.mode"/> </xsl:if>
-->
<xsl:if test="$preamble"> <xsl:apply-templates select="$preamble"/> </xsl:if>
<xsl:if test="$divs"> <xsl:apply-templates select="$divs"/> </xsl:if>
<xsl:if test="$entries">
<xsl:text>\noindent% </xsl:text>
<xsl:text>\begin{description} </xsl:text>
<xsl:apply-templates select="$entries"/>
<xsl:text>\end{description} </xsl:text>
</xsl:if>
<xsl:call-template name="map.end"/>
</xsl:template>
<doc:template xmlns="">
<refpurpose>Process <doc:db>glossdiv</doc:db> and <doc:db>glosslist</doc:db> elements</refpurpose>
<doc:description>
<para>
Invokes the mapping templates and applies content templates.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
<doc:seealso>
<itemizedlist>
<listitem><simpara>&mapping;</simpara></listitem>
<listitem><simpara><xref linkend="template.content-templates"/></simpara></listitem>
</itemizedlist>
</doc:seealso>
</doc:template>
<xsl:template match="glossdiv|glosslist">
<xsl:call-template name="map.begin"/>
<xsl:call-template name="content-templates"/>
<xsl:call-template name="map.end"/>
</xsl:template>
<!--
<doc:template match="glossentry" xmlns="">
<refpurpose> Glossary Entry XSL template / entry point </refpurpose>
<doc:description>
<para>T.B.D.</para>
</doc:description>
<itemizedlist>
<listitem><para>Apply Templates.</para></listitem>
</itemizedlist>
<formalpara><title>Remarks and Bugs</title>
<itemizedlist>
<listitem><para>Explicit Templates for <literal>glossentry/glossterm</literal></para></listitem>
<listitem><para>Explicit Templates for <literal>glossentry/acronym</literal></para></listitem>
<listitem><para>Explicit Templates for <literal>glossentry/abbrev</literal></para></listitem>
<listitem><para>Explicit Templates for <literal>glossentry/glossdef</literal></para></listitem>
<listitem><para>Explicit Templates for <literal>glossentry/glosssee</literal></para></listitem>
<listitem><para>Explicit Templates for <literal>glossentry/glossseealso</literal></para></listitem>
<listitem><para>Template for glossentry/revhistory is EMPTY.</para></listitem>
</itemizedlist>
</formalpara>
</doc:template>
-->
<doc:template xmlns="">
<refpurpose>Process <doc:db>glossentry</doc:db> elements</refpurpose>
<doc:description>
<para>
Simply applies templates.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
</doc:template>
<xsl:template match="glossentry">
<xsl:apply-templates/>
<xsl:text> </xsl:text>
</xsl:template>
<doc:template xmlns="">
<refpurpose>Process a <doc:db>glossentry</doc:db>'s <doc:db>glossterm</doc:db> elements</refpurpose>
<doc:description>
<para>
Creates a &LaTeX; <function condition="latex">item</function> and
a <function condition="latex">hypertarget</function>, then applies
templates.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
</doc:template>
<xsl:template match="glossentry/glossterm">
<xsl:text>\item[</xsl:text>
<xsl:if test="../@id!=''">
<xsl:text>\hypertarget{</xsl:text>
<xsl:value-of select="../@id"/>
<xsl:text>}</xsl:text>
</xsl:if>
<xsl:text>{</xsl:text>
<xsl:apply-templates/>
<xsl:text>}] </xsl:text>
</xsl:template>
<doc:template basename="acronym" xmlns="">
<refpurpose>Process a <doc:db>glossentry</doc:db>'s <doc:db>acronym</doc:db> elements</refpurpose>
<doc:description>
<para>
Format an acronym as part of a glossentry.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
<doc:notes>
<para>
The <doc:db>acronym</doc:db> is formatted as monospaced text
and delimited by round brackets. It appears in the <quote>body</quote>
(e.g. <doc:db>glossdef</doc:db>) region of the glossary entry, not
as part of the <doc:db>glossterm</doc:db>.
</para>
<para>
The delimiters should probably be localised.
</para>
</doc:notes>
</doc:template>
<xsl:template match="glossentry/acronym">
<xsl:text> ( </xsl:text> <xsl:call-template name="inline.monoseq"/> <xsl:text> ) </xsl:text>
</xsl:template>
<doc:template basename="abbrev" xmlns="">
<refpurpose>Process a <doc:db>glossentry</doc:db>'s <doc:db>abbrev</doc:db> elements</refpurpose>
<doc:description>
<para>
Format an abbrev as part of a glossentry.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
<doc:notes>
<para>
The <doc:db>abbrev</doc:db> is delimited by square brackets. It
appears in the <quote>body</quote> (e.g.
<doc:db>glossdef</doc:db>) region of the glossary entry, not as
part of the <doc:db>glossterm</doc:db>.
</para>
<para>
The delimiters should probably be localised.
</para>
</doc:notes>
</doc:template>
<xsl:template match="glossentry/abbrev">
<xsl:text> [ </xsl:text> <xsl:apply-templates/> <xsl:text> ] </xsl:text>
</xsl:template>
<doc:template basename="revhistory" xmlns="">
<refpurpose>Process a <doc:db>glossentry</doc:db>'s <doc:db>revhistory</doc:db> elements</refpurpose>
<doc:description>
<para>
Currently, <doc:db basename="revhistory">revhistories</doc:db>
are suppressed within <doc:db basename="glossentry">glossentries</doc:db>.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
</doc:template>
<xsl:template match="glossentry/revhistory"/>
<doc:template basename="glossdef" xmlns="">
<refpurpose>Process a <doc:db>glossentry</doc:db>'s <doc:db>glossdef</doc:db> elements</refpurpose>
<doc:description>
<para>
Applies templates.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
</doc:template>
<xsl:template match="glossentry/glossdef">
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<doc:template xmlns="">
<refpurpose>Process <doc:db>glossseealso</doc:db> and <doc:db>glosssee</doc:db> elements</refpurpose>
<doc:description>
<para>
Format a glossary cross-reference.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
<doc:notes>
<para>
Will call the following gentet templates:
<literal>gentext.element.name</literal>,
<literal>gentext.space</literal>,
<literal>gentext.startquote</literal>,
<literal>gentext.endquote</literal>.
It will then output a full stop (<quote>period</quote>).
</para>
<para>
If the <quote>otherterm</quote> was successfully found, and this
element is empty, then the appropriate cross-reference will be
generated. This this element is not empty but the otherterm was
also found, the behaviour will depend on <xref
linkend="param.latex.otherterm.is.preferred"/>.
</para>
</doc:notes>
<doc:samples>
<simplelist type='inline'>
&test_book;
&test_gloss;
&test_ieeebiblio;
</simplelist>
</doc:samples>
<doc:seealso>
<itemizedlist>
<listitem><simpara><xref linkend="param.latex.otherterm.is.preferred"/></simpara></listitem>
</itemizedlist>
</doc:seealso>
</doc:template>
<xsl:template match="glossseealso|glosssee">
<xsl:variable name="otherterm" select="@otherterm"/>
<xsl:variable name="targets" select="key('id',$otherterm)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:call-template name="gentext.element.name"/>
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="gentext.startquote"/>
<xsl:choose>
<xsl:when test="$otherterm">
<xsl:text>\hyperlink{</xsl:text><xsl:value-of select="$otherterm"/>
<xsl:text>}{</xsl:text>
<xsl:choose>
<xsl:when test="$latex.otherterm.is.preferred=1">
<xsl:apply-templates select="$target" mode="xref"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="gentext.endquote"/>
<xsl:text>. </xsl:text>
</xsl:template>
<xsl:template match="glossentry" mode="xref">
<xsl:apply-templates select="./glossterm" mode="xref"/>
</xsl:template>
<xsl:template match="glossterm" mode="xref">
<xsl:apply-templates/>
</xsl:template>
<doc:template xmlns="">
<refpurpose> Essential preamble for <filename>glossary.mod.xsl</filename> support </refpurpose>
<doc:description>
<para>
Defines the <function condition="env">dbglossary</function>
command.
</para>
</doc:description>
<doc:variables>
&no_var;
</doc:variables>
<doc:seealso>
<itemizedlist>
<listitem><simpara>&preamble;</simpara></listitem>
</itemizedlist>
</doc:seealso>
</doc:template>
<xsl:template name="latex.preamble.essential.glossary">
<xsl:if test="//glossary">
<xsl:choose>
<xsl:when test="/book or /part">
<xsl:text>\newcommand{\dbglossary}[1]{\chapter*{#1}% </xsl:text>
<xsl:text>\markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}% </xsl:text>
<xsl:text>\newcommand{\dbglossdiv}[1]{\section*{#1}}% </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\newcommand{\dbglossary}[1]{\section*{#1}}% </xsl:text>
<xsl:text>\newcommand{\dbglossdiv}[1]{\subsection*{#1}}% </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
|