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