1
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
3
This program is free software; you can redistribute it and/or modify it under
4
the terms of the GNU Lesser General Public License as published by the Free
5
Software Foundation; either version 2 of the License, or (at your option) any
8
This program is distributed in the hope that it will be useful, but WITHOUT
9
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13
You should have received a copy of the GNU Lesser General Public License
14
along with this program; see the file COPYING.LGPL. If not, write to the
15
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
20
xmlns:db="http://docbook.org/ns/docbook"
21
xmlns:msg="http://projects.gnome.org/yelp/gettext/"
22
xmlns:set="http://exslt.org/sets"
23
xmlns="http://www.w3.org/1999/xhtml"
24
exclude-result-prefixes="db msg set"
27
<!--!!==========================================================================
28
DocBook to HTML - Indexes
29
:Requires: db-chunk db2html-division gettext
31
This module provides templates to process DocBook indexes.
41
<!-- == Matched Templates == -->
44
<xsl:template match="primaryie | db:primaryie"/>
45
<xsl:template match="secondaryie | db:secondaryie"/>
46
<xsl:template match="tertiaryie | db:tertiaryie"/>
48
<!-- = indexentry = -->
49
<xsl:template match="indexentry | db:indexentry">
50
<dt class="primaryie">
51
<xsl:apply-templates select="primaryie/node() | db:primaryie/node()"/>
53
<xsl:variable name="pri_see"
54
select="seeie[not(preceding-sibling::secondaryie)] |
55
db:seeie[not(preceding-sibling::db:secondaryie)]"/>
56
<xsl:variable name="pri_seealso"
57
select="seealsoie[not(preceding-sibling::secondaryie)] |
58
db:seealsoie[not(preceding-sibling::db:secondaryie)]"/>
59
<xsl:if test="$pri_see">
61
<xsl:call-template name="l10n.gettext">
62
<xsl:with-param name="msgid" select="'seeie.format'"/>
63
<xsl:with-param name="node" select="$pri_see"/>
64
<xsl:with-param name="format" select="true()"/>
68
<xsl:if test="$pri_seealso">
70
<xsl:call-template name="l10n.gettext">
71
<xsl:with-param name="msgid" select="'seealsoie.format'"/>
72
<xsl:with-param name="node" select="$pri_seealso"/>
73
<xsl:with-param name="format" select="true()"/>
77
<xsl:for-each select="secondaryie | db:secondaryie">
79
<dl class="secondary">
80
<dt class="secondaryie">
81
<xsl:apply-templates/>
83
<xsl:variable name="sec_see"
84
select="following-sibling::seeie
85
[set:has-same-node(preceding-sibling::secondaryie[1], current())] |
86
following-sibling::db:seeie
87
[set:has-same-node(preceding-sibling::db:secondaryie[1], current())]"/>
88
<xsl:variable name="sec_seealso"
89
select="following-sibling::seealsoie
90
[set:has-same-node(preceding-sibling::secondaryie[1], current())] |
91
following-sibling::db:seealsoie
92
[set:has-same-node(preceding-sibling::db:secondaryie[1], current())]"/>
93
<xsl:variable name="tertiary"
94
select="following-sibling::tertiaryie
95
[set:has-same-node(preceding-sibling::secondaryie[1], current())] |
96
following-sibling::db:tertiaryie
97
[set:has-same-node(preceding-sibling::db:secondaryie[1], current())]"/>
98
<xsl:if test="$sec_see">
100
<xsl:call-template name="l10n.gettext">
101
<xsl:with-param name="msgid" select="'seeie.format'"/>
102
<xsl:with-param name="node" select="$sec_see"/>
103
<xsl:with-param name="format" select="true()"/>
107
<xsl:if test="$sec_seealso">
109
<xsl:call-template name="l10n.gettext">
110
<xsl:with-param name="msgid" select="'seealsoie.format'"/>
111
<xsl:with-param name="node" select="$sec_seealso"/>
112
<xsl:with-param name="format" select="true()"/>
116
<xsl:if test="$tertiary">
125
<xsl:template match="index | db:index">
126
<xsl:param name="depth_in_chunk">
127
<xsl:call-template name="db.chunk.depth-in-chunk"/>
129
<xsl:param name="depth_of_chunk">
130
<xsl:call-template name="db.chunk.depth-of-chunk"/>
133
<xsl:when test="not(title) and not(indexinfo/title) and not(db:title) and
134
not(db:info/db:title)">
135
<xsl:call-template name="db2html.division.div">
136
<xsl:with-param name="info" select="indexinfo | db:info"/>
137
<xsl:with-param name="divisions" select="indexdiv | db:indexdiv"/>
138
<xsl:with-param name="entries" select="indexentry | db:indexentry"/>
139
<xsl:with-param name="title_content">
140
<xsl:call-template name="l10n.gettext">
141
<xsl:with-param name="msgid" select="'Index'"/>
144
<xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
145
<xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
149
<xsl:call-template name="db2html.division.div">
150
<xsl:with-param name="info" select="indexinfo | db:info"/>
151
<xsl:with-param name="divisions" select="indexdiv | db:indexdiv"/>
152
<xsl:with-param name="entries" select="indexentry | db:indexentry"/>
153
<xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
154
<xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
160
<!-- = setindex = -->
161
<xsl:template match="setindex | db:setindex">
162
<xsl:param name="depth_in_chunk">
163
<xsl:call-template name="db.chunk.depth-in-chunk"/>
165
<xsl:param name="depth_of_chunk">
166
<xsl:call-template name="db.chunk.depth-of-chunk"/>
169
<xsl:when test="not(title) and not(setindexinfo/title) and not(db:title) and
170
not(db:info/db:title)">
171
<xsl:call-template name="db2html.division.div">
172
<xsl:with-param name="info" select="setindexinfo | db:info"/>
173
<xsl:with-param name="divisions" select="indexdiv | db:indexdiv"/>
174
<xsl:with-param name="entries" select="indexentry | db:indexentry"/>
175
<xsl:with-param name="title_content">
176
<xsl:call-template name="l10n.gettext">
177
<xsl:with-param name="msgid" select="'Index'"/>
180
<xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
181
<xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
185
<xsl:call-template name="db2html.division.div">
186
<xsl:with-param name="info" select="setindexinfo | db:info"/>
187
<xsl:with-param name="divisions" select="indexdiv | db:indexdiv"/>
188
<xsl:with-param name="entries" select="indexentry | db:indexentry"/>
189
<xsl:with-param name="depth_in_chunk" select="$depth_in_chunk"/>
190
<xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
196
<!--#% l10n.format.mode -->
197
<xsl:template mode="l10n.format.mode" match="msg:seeie">
198
<xsl:param name="node"/>
199
<xsl:for-each select="$node">
200
<xsl:if test="position() != 1">
201
<xsl:call-template name="l10n.gettext">
202
<xsl:with-param name="msgid" select="', '"/>
205
<xsl:value-of select="."/>
208
<xsl:when test="@otherterm">
210
<xsl:attribute name="href">
211
<xsl:call-template name="db.xref.target">
212
<xsl:with-param name="linkend" select="@otherterm"/>
215
<xsl:attribute name="title">
216
<xsl:call-template name="db.xref.tooltip">
217
<xsl:with-param name="linkend" select="@otherterm"/>
221
<xsl:when test="normalize-space(.) != ''">
222
<xsl:apply-templates/>
225
<xsl:call-template name="db.xref.content">
226
<xsl:with-param name="linkend" select="@otherterm"/>
227
<xsl:with-param name="role" select="'glosssee'"/>
234
<xsl:apply-templates/>