This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[sfrench/samba-autobuild/.git] / docs / docbook / xslt / db2latex / glossary.mod.xsl
1 <?xml version='1.0'?>
2 <!--############################################################################# 
3 |       $Id: glossary.mod.xsl,v 1.1.2.1 2003/05/01 14:06:14 jelmer Exp $
4 |- #############################################################################
5 |       $Author: jelmer $
6 |                                                                                                               
7 |   PURPOSE:
8 + ############################################################################## -->
9
10 <xsl:stylesheet 
11     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12     xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
13     exclude-result-prefixes="doc" version='1.0'>
14
15
16
17     <!--############################################################################# -->
18     <!-- DOCUMENTATION                                                                -->
19     <doc:reference id="glossary" xmlns="">
20         <referenceinfo>
21             <releaseinfo role="meta">
22                 $Id: glossary.mod.xsl,v 1.1.2.1 2003/05/01 14:06:14 jelmer Exp $
23             </releaseinfo>
24         <authorgroup>
25             <author> <firstname>Ramon</firstname> <surname>Casellas</surname> </author>
26             <author> <firstname>James</firstname> <surname>Devenish</surname> </author>
27         </authorgroup>
28             <copyright>
29                 <year>2000</year> <year>2001</year> <year>2002</year> <year>2003</year>
30                 <holder>Ramon Casellas</holder>
31             </copyright>
32         </referenceinfo>
33         <title>Glossary <filename>glossary.mod.xsl</filename></title>
34         <partintro>
35             <section><title>Introduction</title>
36                 <para>This reference applies to the glossary element name. Altough LaTeX
37                     provides some glossary support, the better glossary management support
38                     motivates the bypass of the LaTeX <literal>\makeglossary</literal>
39                     command.</para>
40             </section>
41         </partintro>
42     </doc:reference>
43     <!--############################################################################# -->
44
45
46     <!--############################################################################# -->
47     <!-- DOCUMENTATION                                                                -->
48     <doc:template match="glossary" xmlns="">
49         <refpurpose> Glossary XSL template / entry point  </refpurpose>
50         <refdescription><para>The <sgmltag>glossary</sgmltag> element is the entry point
51                 to a docbook glossary. The DB2LaTeX processing of the element is quite straight-
52                 forward. First thing is to check whether the document is a book or article. In 
53                 both cases two new LaTeX commands are defined. <literal>\dbglossary</literal>
54                 and <literal>\dbglossdiv</literal>. In the former case, they are mapped to 
55                 <literal>\chapter*</literal> and <literal>\section*</literal>. In the second
56                 case to <literal>\section*</literal> and <literal>\subsection*</literal>.</para>
57         </refdescription>
58         <itemizedlist>
59             <listitem><para>Call template map.begin.</para></listitem>
60             <listitem><para>Apply Templates for Preamble, GlossDivs and GlossEntries (serial).</para></listitem>
61             <listitem><para>Call template map.end.</para></listitem>
62         </itemizedlist>
63         <formalpara><title>Remarks and Bugs</title>
64             <itemizedlist>
65                 <listitem><para>Template for glossary/glossaryinfo is EMPTY.</para></listitem>
66                 <listitem><para>Template for glossary/title | glossary/subtitle is EMPTY.</para></listitem>
67                 <listitem><para>Template for glossary/titleabbrev is EMPTY.</para></listitem>
68             </itemizedlist>
69         </formalpara>
70     </doc:template>
71     <!--############################################################################# -->
72
73     <xsl:template match="glossary">
74         <xsl:variable name="divs" select="glossdiv"/>
75         <xsl:variable name="entries" select="glossentry"/>
76         <xsl:variable name="preamble" select="*[not(self::title or self::subtitle or self::glossdiv or self::glossentry)]"/>
77         <xsl:choose>
78             <xsl:when test="local-name(..)='book' or local-name(..)='part'">
79                 <xsl:text>\newcommand{\dbglossary}[1]{\chapter*{#1}}%&#10;</xsl:text>
80                 <xsl:text>\newcommand{\dbglossdiv}[1]{\section*{#1}}%&#10;</xsl:text>
81             </xsl:when>
82             <xsl:otherwise>
83                 <xsl:text>\newcommand{\dbglossary}[1]{\section*{#1}}%&#10;</xsl:text>
84                 <xsl:text>\newcommand{\dbglossdiv}[1]{\subsection*{#1}}%&#10;</xsl:text>
85             </xsl:otherwise>
86         </xsl:choose>
87         <xsl:call-template name="map.begin"/>
88         <xsl:if test="./subtitle"><xsl:apply-templates select="./subtitle" mode="component.title.mode"/> </xsl:if>
89         <xsl:if test="$preamble"> <xsl:apply-templates select="$preamble"/> </xsl:if>
90         <xsl:if test="$divs"> <xsl:apply-templates select="$divs"/> </xsl:if>
91         <xsl:if test="$entries"> <xsl:apply-templates select="$entries"/></xsl:if>
92         <xsl:call-template name="map.end"/>
93     </xsl:template>
94
95     <xsl:template match="glossary/glossaryinfo"/>
96     <xsl:template match="glossary/title"/>
97     <xsl:template match="glossary/subtitle"/>
98     <xsl:template match="glossary/titleabbrev"/>
99     <xsl:template match="glossary/title"        mode="component.title.mode"> <xsl:apply-templates/> </xsl:template>
100     <xsl:template match="glossary/subtitle"     mode="component.title.mode"> <xsl:apply-templates/> </xsl:template>
101
102
103
104
105     <!--############################################################################# -->
106     <!-- DOCUMENTATION                                                                -->
107     <doc:template match="glossdiv|glosslist" xmlns="">
108         <refpurpose> Glossary Division and Glossary Lists XSL templates.  </refpurpose>
109         <refdescription><para>T.B.D</para>
110         </refdescription>
111         <itemizedlist>
112             <listitem><para>Call template map.begin.</para></listitem>
113             <listitem><para>Apply Templates.</para></listitem>
114             <listitem><para>Call template map.end.</para></listitem>
115         </itemizedlist>
116         <formalpara><title>Remarks and Bugs</title>
117             <itemizedlist>
118                 <listitem><para>Template for glossdiv/glossaryinfo is EMPTY.</para></listitem>
119             </itemizedlist>
120         </formalpara>
121     </doc:template>
122     <!--############################################################################# -->
123     <xsl:template match="glossdiv|glosslist">
124         <xsl:call-template name="map.begin"/>
125         <xsl:apply-templates/>
126         <xsl:call-template name="map.end"/>
127     </xsl:template>
128
129     <xsl:template match="glossdiv/title" />
130
131
132
133
134     <!--############################################################################# -->
135     <!-- DOCUMENTATION                                                                -->
136     <doc:template match="glossentry" xmlns="">
137         <refpurpose> Glossary Entry XSL template / entry point  </refpurpose>
138         <refdescription>
139             <para>T.B.D.</para>
140         </refdescription>
141         <itemizedlist>
142             <listitem><para>Apply Templates.</para></listitem>
143         </itemizedlist>
144         <formalpara><title>Remarks and Bugs</title>
145             <itemizedlist>
146                 <listitem><para>Explicit Templates for <literal>glossentry/glossterm</literal></para></listitem>
147                 <listitem><para>Explicit Templates for <literal>glossentry/acronym</literal></para></listitem>
148                 <listitem><para>Explicit Templates for <literal>glossentry/abbrev</literal></para></listitem>
149                 <listitem><para>Explicit Templates for <literal>glossentry/glossdef</literal></para></listitem>
150                 <listitem><para>Explicit Templates for <literal>glossentry/glosssee</literal></para></listitem>
151                 <listitem><para>Explicit Templates for <literal>glossentry/glossseealso</literal></para></listitem>
152                 <listitem><para>Template for glossentry/revhistory is EMPTY.</para></listitem>
153             </itemizedlist>
154         </formalpara>
155     </doc:template>
156     <!--############################################################################# -->
157
158
159     <xsl:template match="glossentry">
160         <xsl:apply-templates/>
161         <xsl:text>&#10;&#10;</xsl:text>
162     </xsl:template>
163
164     <xsl:template match="glossentry/glossterm">
165         <xsl:text>\item[</xsl:text>
166         <xsl:if test="../@id!=''">
167                 <xsl:text>\hypertarget{</xsl:text>
168                 <xsl:value-of select="../@id"/>
169                 <xsl:text>}</xsl:text>
170         </xsl:if>
171         <xsl:text>{</xsl:text>
172         <xsl:call-template name="normalize-scape">
173             <xsl:with-param name="string" select="."/>
174         </xsl:call-template>
175         <xsl:text>}] </xsl:text>
176     </xsl:template>
177
178     <xsl:template match="glossentry/acronym">
179         <xsl:text> ( \texttt {</xsl:text> <xsl:apply-templates/> <xsl:text>} ) </xsl:text>
180     </xsl:template>
181
182     <xsl:template match="glossentry/abbrev">
183         <xsl:text> [ </xsl:text> <xsl:apply-templates/> <xsl:text> ] </xsl:text> 
184     </xsl:template>
185
186     <xsl:template match="glossentry/revhistory"/>
187
188     <xsl:template match="glossentry/glossdef">
189         <xsl:text>&#10;</xsl:text>
190         <xsl:apply-templates/>
191     </xsl:template>
192
193     <xsl:template match="glossseealso|glossentry/glosssee">
194         <xsl:variable name="otherterm" select="@otherterm"/>
195         <xsl:variable name="targets" select="//node()[@id=$otherterm]"/>
196         <xsl:variable name="target" select="$targets[1]"/>
197         <xsl:call-template name="gentext.element.name"/>
198         <xsl:call-template name="gentext.space"/>
199         <xsl:call-template name="gentext.startquote"/>
200         <xsl:choose>
201             <xsl:when test="@otherterm">
202                 <xsl:text>\hyperlink{</xsl:text><xsl:value-of select="@otherterm"/>
203                 <xsl:text>}{</xsl:text><xsl:apply-templates select="$target" mode="xref"/><xsl:text>}</xsl:text>
204             </xsl:when>
205             <xsl:otherwise>
206                 <xsl:apply-templates/>
207             </xsl:otherwise>
208         </xsl:choose>
209         <xsl:call-template name="gentext.endquote"/>
210         <xsl:text>. </xsl:text>
211     </xsl:template>
212
213     <xsl:template match="glossentry" mode="xref">
214         <xsl:apply-templates select="./glossterm" mode="xref"/>
215     </xsl:template>
216
217     <xsl:template match="glossterm" mode="xref">
218         <xsl:apply-templates/>
219     </xsl:template>
220
221 </xsl:stylesheet>