2 <!--#############################################################################
3 | $Id: index.mod.xsl,v 1.1.2.1 2003/05/01 14:06:14 jelmer Exp $
4 |- #############################################################################
8 + ############################################################################## -->
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'>
16 <!--############################################################################# -->
17 <!-- DOCUMENTATION -->
18 <doc:reference id="index" xmlns="">
20 <releaseinfo role="meta">
21 $Id: index.mod.xsl,v 1.1.2.1 2003/05/01 14:06:14 jelmer Exp $
24 <author> <firstname>Ramon</firstname> <surname>Casellas</surname> </author>
25 <author> <firstname>James</firstname> <surname>Devenish</surname> </author>
28 <year>2000</year> <year>2001</year> <year>2002</year> <year>2003</year>
29 <holder>Ramon Casellas</holder>
33 <title>Index <filename>index.mod.xsl</filename></title>
35 <section><title>Introduction</title>
42 <!-- This parameter is for enabeling or disabling of indexterms -->
43 <xsl:param name="latex.generate.indexterm">1</xsl:param>
45 <!-- Our key for ranges -->
46 <xsl:key name="indexterm-range" match="indexterm[@class='startofrange']" use="@id"/>
51 <!-- ############################################################### -->
54 <!-- ############################################################### -->
55 <xsl:template match="index|setindex">
56 <xsl:call-template name="label.id"/>
57 <xsl:text>\printindex </xsl:text>
60 <xsl:template match="index/title"></xsl:template>
61 <xsl:template match="index/subtitle"></xsl:template>
62 <xsl:template match="index/titleabbrev"></xsl:template>
64 <xsl:template match="index/title" mode="component.title.mode">
65 <xsl:call-template name="label.id"> <xsl:with-param name="object" select=".."/> </xsl:call-template>
68 <xsl:template match="index/subtitle" mode="component.title.mode"/>
71 <!-- ############################################################### -->
74 <!-- ############################################################### -->
75 <xsl:template match="indexdiv">
76 <xsl:apply-templates/>
79 <xsl:template match="indexdiv/title">
80 <xsl:call-template name="label.id"> <xsl:with-param name="object" select=".."/> </xsl:call-template>
84 <!-- INDEX TERM CONTENT MODEL
93 <!-- ############################################################### -->
96 <!-- ############################################################### -->
97 <xsl:template match="indexterm">
98 <xsl:if test="$latex.generate.indexterm != 0">
100 <xsl:text>\index{</xsl:text>
101 <xsl:call-template name="normalize-scape">
102 <xsl:with-param name="string" select="normalize-space(./primary)"/>
104 <xsl:if test="./secondary">
105 <xsl:text>!</xsl:text>
106 <xsl:call-template name="normalize-scape">
107 <xsl:with-param name="string" select="normalize-space(./secondary)"/>
110 <xsl:if test="./tertiary">
111 <xsl:text>!</xsl:text>
112 <xsl:call-template name="normalize-scape">
113 <xsl:with-param name="string" select="normalize-space(./tertiary)"/>
116 <xsl:if test="./see">
117 <xsl:text>|see{</xsl:text>
118 <xsl:call-template name="normalize-scape">
119 <xsl:with-param name="string" select="normalize-space(./see)"/>
121 <xsl:text>}</xsl:text>
123 <xsl:if test="./seealso">
124 <xsl:text>|see{</xsl:text>
125 <xsl:call-template name="normalize-scape">
126 <xsl:with-param name="string" select="normalize-space(./seealso)"/>
128 <xsl:text>}</xsl:text>
130 <xsl:text>}</xsl:text>
132 <xsl:variable name="idxterm">
133 <xsl:apply-templates mode="indexterm"/>
136 <xsl:if test="@class and @zone">
137 <xsl:message terminate="yes">Error: Only one attribut (@class or @zone) is in indexterm possible!</xsl:message>
141 <xsl:when test="@class='startofrange'">
142 <xsl:text>\index{</xsl:text>
143 <xsl:value-of select="normalize-space($idxterm)"/>
144 <xsl:text>|(}</xsl:text>
146 <xsl:when test="@class='endofrange'">
148 <xsl:when test="count(key('indexterm-range',@startref)) = 0">
149 <xsl:message terminate="yes"><xsl:text>Error: No indexterm with </xsl:text>
150 <xsl:text>id='</xsl:text><xsl:value-of select="@startref"/>
151 <xsl:text>' found!</xsl:text>
152 <xsl:text> Check your attributs id/startref in your indexterms!</xsl:text>
156 <xsl:variable name="thekey" select="key('indexterm-range',@startref)"/>
157 <xsl:text>\index{</xsl:text>
158 <xsl:apply-templates select="$thekey/*" mode="indexterm"/>
159 <xsl:text>|)}</xsl:text>
164 <xsl:text>\index{</xsl:text>
165 <xsl:message terminate="no"><xsl:text>Simple case:</xsl:text></xsl:message>
166 <xsl:value-of select="normalize-space($idxterm)"/>
167 <xsl:text>}</xsl:text>
174 <!-- ================================================ -->
175 <xsl:template match="*" mode="indexterm">
176 <xsl:message>WARNING: Element '<xsl:value-of select="local-name()"/>' in indexterm not supported!</xsl:message>
181 <!-- ================================================ -->
182 <xsl:template match="primary" mode="indexterm">
183 <xsl:apply-templates mode="indexterm"/>
186 <xsl:template match="secondary" mode="indexterm">
187 <xsl:text>!</xsl:text>
188 <xsl:apply-templates mode="indexterm"/>
191 <xsl:template match="tertiary" mode="indexterm">
192 <xsl:text>!</xsl:text>
193 <xsl:apply-templates mode="indexterm"/>
196 <xsl:template match="see|seealso" mode="indexterm">
197 <xsl:text>|see{</xsl:text>
198 <xsl:apply-templates mode="indexterm"/>
199 <xsl:text>} </xsl:text>
203 <!-- ================================================ -->
204 <!-- A simple example of what can be in an primary, -->
205 <!-- secondary or tertiary. -->
206 <!-- ================================================ -->
207 <xsl:template match="acronym" mode="indexterm">
208 <xsl:apply-templates mode="indexterm"/>
212 <xsl:template match="primary|secondary|tertiary|see|seealso"/>
213 <xsl:template match="indexentry"/>
214 <xsl:template match="primaryie|secondaryie|tertiaryie|seeie|seealsoie"/>