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