2 <!--#############################################################################
3 | $Id: glossary.mod.xsl,v 1.1.2.1 2003/05/01 14:06:14 jelmer Exp $
4 |- #############################################################################
8 + ############################################################################## -->
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'>
17 <!--############################################################################# -->
18 <!-- DOCUMENTATION -->
19 <doc:reference id="glossary" xmlns="">
21 <releaseinfo role="meta">
22 $Id: glossary.mod.xsl,v 1.1.2.1 2003/05/01 14:06:14 jelmer Exp $
25 <author> <firstname>Ramon</firstname> <surname>Casellas</surname> </author>
26 <author> <firstname>James</firstname> <surname>Devenish</surname> </author>
29 <year>2000</year> <year>2001</year> <year>2002</year> <year>2003</year>
30 <holder>Ramon Casellas</holder>
33 <title>Glossary <filename>glossary.mod.xsl</filename></title>
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>
43 <!--############################################################################# -->
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>
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>
63 <formalpara><title>Remarks and Bugs</title>
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>
71 <!--############################################################################# -->
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)]"/>
78 <xsl:when test="local-name(..)='book' or local-name(..)='part'">
79 <xsl:text>\newcommand{\dbglossary}[1]{\chapter*{#1}}% </xsl:text>
80 <xsl:text>\newcommand{\dbglossdiv}[1]{\section*{#1}}% </xsl:text>
83 <xsl:text>\newcommand{\dbglossary}[1]{\section*{#1}}% </xsl:text>
84 <xsl:text>\newcommand{\dbglossdiv}[1]{\subsection*{#1}}% </xsl:text>
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"/>
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>
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>
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>
116 <formalpara><title>Remarks and Bugs</title>
118 <listitem><para>Template for glossdiv/glossaryinfo is EMPTY.</para></listitem>
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"/>
129 <xsl:template match="glossdiv/title" />
134 <!--############################################################################# -->
135 <!-- DOCUMENTATION -->
136 <doc:template match="glossentry" xmlns="">
137 <refpurpose> Glossary Entry XSL template / entry point </refpurpose>
142 <listitem><para>Apply Templates.</para></listitem>
144 <formalpara><title>Remarks and Bugs</title>
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>
156 <!--############################################################################# -->
159 <xsl:template match="glossentry">
160 <xsl:apply-templates/>
161 <xsl:text> </xsl:text>
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>
171 <xsl:text>{</xsl:text>
172 <xsl:call-template name="normalize-scape">
173 <xsl:with-param name="string" select="."/>
175 <xsl:text>}] </xsl:text>
178 <xsl:template match="glossentry/acronym">
179 <xsl:text> ( \texttt {</xsl:text> <xsl:apply-templates/> <xsl:text>} ) </xsl:text>
182 <xsl:template match="glossentry/abbrev">
183 <xsl:text> [ </xsl:text> <xsl:apply-templates/> <xsl:text> ] </xsl:text>
186 <xsl:template match="glossentry/revhistory"/>
188 <xsl:template match="glossentry/glossdef">
189 <xsl:text> </xsl:text>
190 <xsl:apply-templates/>
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"/>
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>
206 <xsl:apply-templates/>
209 <xsl:call-template name="gentext.endquote"/>
210 <xsl:text>. </xsl:text>
213 <xsl:template match="glossentry" mode="xref">
214 <xsl:apply-templates select="./glossterm" mode="xref"/>
217 <xsl:template match="glossterm" mode="xref">
218 <xsl:apply-templates/>