1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets. Do not edit this file.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
6 <!-- ********************************************************************
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
12 and other information.
14 ******************************************************************** -->
16 <!-- ==================================================================== -->
17 <!-- Jeni Tennison gets all the credit for what follows.
18 I think I understand it :-) Anyway, I've hacked it a bit, so the
21 <xsl:key name="letter" match="indexterm" use="translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
23 <xsl:key name="primary" match="indexterm" use="normalize-space(concat(primary/@sortas, primary[not(@sortas)]))"/>
25 <xsl:key name="secondary" match="indexterm" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
27 <xsl:key name="tertiary" match="indexterm" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])))"/>
29 <xsl:key name="endofrange" match="indexterm[@class='endofrange']" use="@startref"/>
31 <xsl:key name="primary-section" match="indexterm[not(secondary) and not(see)]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", generate-id((ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]))"/>
33 <xsl:key name="secondary-section" match="indexterm[not(tertiary) and not(see)]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", generate-id((ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]))"/>
35 <xsl:key name="tertiary-section" match="indexterm[not(see)]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), " ", generate-id((ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]))"/>
37 <xsl:key name="see-also" match="indexterm[seealso]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), " ", seealso)"/>
39 <xsl:key name="see" match="indexterm[see]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), " ", see)"/>
41 <xsl:key name="sections" match="*[@id]" use="@id"/>
43 <xsl:template name="generate-index">
44 <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
46 <xsl:variable name="role">
47 <xsl:if test="$index.on.role != 0">
48 <xsl:value-of select="@role"/>
52 <xsl:variable name="type">
53 <xsl:if test="$index.on.type != 0">
54 <xsl:value-of select="@type"/>
58 <xsl:variable name="terms" select="//indexterm[count(.|key('letter', translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1 and not(@class = 'endofrange')]"/>
60 <xsl:variable name="alphabetical" select="$terms[contains(concat('abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1))]"/>
62 <xsl:variable name="others" select="$terms[not(contains(concat('abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1)))]"/>
64 <xsl:if test="$others">
65 <div class="indexdiv">
67 <xsl:call-template name="gentext">
68 <xsl:with-param name="key" select="'index symbols'"/>
72 <xsl:apply-templates select="$others[count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]" mode="index-symbol-div">
73 <xsl:with-param name="scope" select="$scope"/>
74 <xsl:with-param name="role" select="$role"/>
75 <xsl:with-param name="type" select="$type"/>
76 <xsl:sort select="translate(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
77 </xsl:apply-templates>
82 <xsl:apply-templates select="$alphabetical[count(.|key('letter', translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1), 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]" mode="index-div">
83 <xsl:with-param name="scope" select="$scope"/>
84 <xsl:with-param name="role" select="$role"/>
85 <xsl:with-param name="type" select="$type"/>
86 <xsl:sort select="translate(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
87 </xsl:apply-templates>
91 <xsl:template match="indexterm" mode="index-div">
92 <xsl:param name="scope" select="."/>
93 <xsl:param name="role" select="''"/>
94 <xsl:param name="type" select="''"/>
96 <xsl:variable name="key" select="translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
98 <!-- Make sure that we don't generate a div if there are no terms in scope -->
99 <xsl:if test="key('letter', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))] [count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]">
100 <div class="indexdiv">
101 <xsl:if test="contains(concat('abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), $key)">
103 <xsl:value-of select="translate($key, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
107 <xsl:apply-templates select="key('letter', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))] [count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])=1]" mode="index-primary">
108 <xsl:with-param name="scope" select="$scope"/>
109 <xsl:with-param name="role" select="$role"/>
110 <xsl:with-param name="type" select="$type"/>
111 <xsl:sort select="translate(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
112 </xsl:apply-templates>
118 <xsl:template match="indexterm" mode="index-symbol-div">
119 <xsl:param name="scope" select="/"/>
120 <xsl:param name="role" select="''"/>
121 <xsl:param name="type" select="''"/>
123 <xsl:variable name="key" select="translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1), 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
125 <xsl:apply-templates select="key('letter', $key) [count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[1]) = 1]" mode="index-primary">
126 <xsl:with-param name="scope" select="$scope"/>
127 <xsl:with-param name="role" select="$role"/>
128 <xsl:with-param name="type" select="$type"/>
129 <xsl:sort select="translate(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
130 </xsl:apply-templates>
133 <xsl:template match="indexterm" mode="index-primary">
134 <xsl:param name="scope" select="."/>
135 <xsl:param name="role" select="''"/>
136 <xsl:param name="type" select="''"/>
138 <xsl:variable name="key" select="normalize-space(concat(primary/@sortas, primary[not(@sortas)]))"/>
139 <xsl:variable name="refs" select="key('primary', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))]"/>
141 <xsl:value-of select="primary"/>
142 <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section', concat($key, " ", generate-id((ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]">
143 <xsl:apply-templates select="." mode="reference">
144 <xsl:with-param name="scope" select="$scope"/>
145 <xsl:with-param name="role" select="$role"/>
146 <xsl:with-param name="type" select="$type"/>
147 </xsl:apply-templates>
150 <xsl:if test="$refs[not(secondary)]/*[self::see]">
151 <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", " ", " ", see))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-see">
152 <xsl:with-param name="scope" select="$scope"/>
153 <xsl:with-param name="role" select="$role"/>
154 <xsl:with-param name="type" select="$type"/>
155 <xsl:sort select="translate(see, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
156 </xsl:apply-templates>
159 <xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
162 <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", " ", " ", seealso))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-seealso">
163 <xsl:with-param name="scope" select="$scope"/>
164 <xsl:with-param name="role" select="$role"/>
165 <xsl:with-param name="type" select="$type"/>
166 <xsl:sort select="translate(seealso, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
167 </xsl:apply-templates>
168 <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)]))))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]" mode="index-secondary">
169 <xsl:with-param name="scope" select="$scope"/>
170 <xsl:with-param name="role" select="$role"/>
171 <xsl:with-param name="type" select="$type"/>
172 <xsl:sort select="translate(normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
173 </xsl:apply-templates>
179 <xsl:template match="indexterm" mode="index-secondary">
180 <xsl:param name="scope" select="."/>
181 <xsl:param name="role" select="''"/>
182 <xsl:param name="type" select="''"/>
184 <xsl:variable name="key" select="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
185 <xsl:variable name="refs" select="key('secondary', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))]"/>
187 <xsl:value-of select="secondary"/>
188 <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section', concat($key, " ", generate-id((ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]">
189 <xsl:apply-templates select="." mode="reference">
190 <xsl:with-param name="scope" select="$scope"/>
191 <xsl:with-param name="role" select="$role"/>
192 <xsl:with-param name="type" select="$type"/>
193 </xsl:apply-templates>
196 <xsl:if test="$refs[not(tertiary)]/*[self::see]">
197 <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", " ", see))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-see">
198 <xsl:with-param name="scope" select="$scope"/>
199 <xsl:with-param name="role" select="$role"/>
200 <xsl:with-param name="type" select="$type"/>
201 <xsl:sort select="translate(see, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
202 </xsl:apply-templates>
205 <xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
208 <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", " ", seealso))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-seealso">
209 <xsl:with-param name="scope" select="$scope"/>
210 <xsl:with-param name="role" select="$role"/>
211 <xsl:with-param name="type" select="$type"/>
212 <xsl:sort select="translate(seealso, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
213 </xsl:apply-templates>
214 <xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, " ", normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)]))))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]" mode="index-tertiary">
215 <xsl:with-param name="scope" select="$scope"/>
216 <xsl:with-param name="role" select="$role"/>
217 <xsl:with-param name="type" select="$type"/>
218 <xsl:sort select="translate(normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
219 </xsl:apply-templates>
225 <xsl:template match="indexterm" mode="index-tertiary">
226 <xsl:param name="scope" select="."/>
227 <xsl:param name="role" select="''"/>
228 <xsl:param name="type" select="''"/>
230 <xsl:variable name="key" select="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])))"/>
231 <xsl:variable name="refs" select="key('tertiary', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))]"/>
233 <xsl:value-of select="tertiary"/>
234 <xsl:for-each select="$refs[generate-id() = generate-id(key('tertiary-section', concat($key, " ", generate-id((ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]">
235 <xsl:apply-templates select="." mode="reference">
236 <xsl:with-param name="scope" select="$scope"/>
237 <xsl:with-param name="role" select="$role"/>
238 <xsl:with-param name="type" select="$type"/>
239 </xsl:apply-templates>
242 <xsl:if test="$refs/see">
243 <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), " ", see))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-see">
244 <xsl:with-param name="scope" select="$scope"/>
245 <xsl:with-param name="role" select="$role"/>
246 <xsl:with-param name="type" select="$type"/>
247 <xsl:sort select="translate(see, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
248 </xsl:apply-templates>
251 <xsl:if test="$refs/seealso">
254 <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), " ", normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), " ", normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), " ", seealso))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-seealso">
255 <xsl:with-param name="scope" select="$scope"/>
256 <xsl:with-param name="role" select="$role"/>
257 <xsl:with-param name="type" select="$type"/>
258 <xsl:sort select="translate(seealso, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
259 </xsl:apply-templates>
265 <xsl:template match="indexterm" mode="reference">
266 <xsl:param name="scope" select="."/>
267 <xsl:param name="role" select="''"/>
268 <xsl:param name="type" select="''"/>
269 <xsl:param name="separator" select="', '"/>
271 <xsl:value-of select="$separator"/>
273 <xsl:when test="@zone and string(@zone)">
274 <xsl:call-template name="reference">
275 <xsl:with-param name="zones" select="normalize-space(@zone)"/>
276 <xsl:with-param name="scope" select="$scope"/>
277 <xsl:with-param name="role" select="$role"/>
278 <xsl:with-param name="type" select="$type"/>
283 <xsl:variable name="title">
285 <xsl:when test="(ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]/titleabbrev and $index.prefer.titleabbrev != 0">
286 <xsl:apply-templates select="(ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]" mode="titleabbrev.markup"/>
289 <xsl:apply-templates select="(ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]" mode="title.markup"/>
294 <xsl:attribute name="href">
295 <xsl:call-template name="href.target">
296 <xsl:with-param name="object" select="(ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]"/>
297 <xsl:with-param name="context" select="//index[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]"/>
301 <xsl:value-of select="$title"/> <!-- text only -->
304 <xsl:if test="key('endofrange', @id)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))]">
305 <xsl:apply-templates select="key('endofrange', @id)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][last()]" mode="reference">
306 <xsl:with-param name="scope" select="$scope"/>
307 <xsl:with-param name="role" select="$role"/>
308 <xsl:with-param name="type" select="$type"/>
309 <xsl:with-param name="separator" select="'-'"/>
310 </xsl:apply-templates>
316 <xsl:template name="reference">
317 <xsl:param name="scope" select="."/>
318 <xsl:param name="role" select="''"/>
319 <xsl:param name="type" select="''"/>
320 <xsl:param name="zones"/>
323 <xsl:when test="contains($zones, ' ')">
324 <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
325 <xsl:variable name="target" select="key('sections', $zone)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))]"/>
328 <xsl:attribute name="href">
329 <xsl:call-template name="href.target">
330 <xsl:with-param name="object" select="$target[1]"/>
331 <xsl:with-param name="context" select="//index[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]"/>
334 <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
336 <xsl:text>, </xsl:text>
337 <xsl:call-template name="reference">
338 <xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
339 <xsl:with-param name="scope" select="$scope"/>
340 <xsl:with-param name="role" select="$role"/>
341 <xsl:with-param name="type" select="$type"/>
345 <xsl:variable name="zone" select="$zones"/>
346 <xsl:variable name="target" select="key('sections', $zone)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))]"/>
349 <xsl:attribute name="href">
350 <xsl:call-template name="href.target">
351 <xsl:with-param name="object" select="$target[1]"/>
352 <xsl:with-param name="context" select="//index[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]"/>
355 <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
361 <xsl:template match="indexterm" mode="index-see">
362 <xsl:param name="scope" select="."/>
363 <xsl:param name="role" select="''"/>
364 <xsl:param name="type" select="''"/>
366 <xsl:text> (</xsl:text>
367 <xsl:call-template name="gentext">
368 <xsl:with-param name="key" select="'see'"/>
370 <xsl:text> </xsl:text>
371 <xsl:value-of select="see"/>
372 <xsl:text>)</xsl:text>
375 <xsl:template match="indexterm" mode="index-seealso">
376 <xsl:param name="scope" select="."/>
377 <xsl:param name="role" select="''"/>
378 <xsl:param name="type" select="''"/>
380 <xsl:for-each select="seealso">
381 <xsl:sort select="translate(., 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
383 <xsl:text>(</xsl:text>
384 <xsl:call-template name="gentext">
385 <xsl:with-param name="key" select="'seealso'"/>
387 <xsl:text> </xsl:text>
388 <xsl:value-of select="."/>
389 <xsl:text>)</xsl:text>
394 <xsl:template match="*" mode="index-title-content">
395 <xsl:variable name="title">
396 <xsl:apply-templates select="(ancestor-or-self::set |ancestor-or-self::book |ancestor-or-self::part |ancestor-or-self::reference |ancestor-or-self::partintro |ancestor-or-self::chapter |ancestor-or-self::appendix |ancestor-or-self::preface |ancestor-or-self::article |ancestor-or-self::section |ancestor-or-self::sect1 |ancestor-or-self::sect2 |ancestor-or-self::sect3 |ancestor-or-self::sect4 |ancestor-or-self::sect5 |ancestor-or-self::refentry |ancestor-or-self::refsect1 |ancestor-or-self::refsect2 |ancestor-or-self::refsect3 |ancestor-or-self::simplesect |ancestor-or-self::bibliography |ancestor-or-self::glossary |ancestor-or-self::index |ancestor-or-self::webpage)[last()]" mode="title.markup"/>
399 <xsl:value-of select="$title"/>