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">
|
---|
5 |
|
---|
6 | <!-- ********************************************************************
|
---|
7 | $Id: autoidx.xsl,v 1.26 2005/01/13 08:52:14 bobstayton Exp $
|
---|
8 | ********************************************************************
|
---|
9 |
|
---|
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.
|
---|
13 |
|
---|
14 | ******************************************************************** -->
|
---|
15 |
|
---|
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
|
---|
19 | bugs are mine. -->
|
---|
20 |
|
---|
21 | <xsl:key name="letter" match="indexterm" use="translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
|
---|
22 |
|
---|
23 | <xsl:key name="primary" match="indexterm" use="normalize-space(concat(primary/@sortas, primary[not(@sortas)]))"/>
|
---|
24 |
|
---|
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)])))"/>
|
---|
26 |
|
---|
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)])))"/>
|
---|
28 |
|
---|
29 | <xsl:key name="endofrange" match="indexterm[@class='endofrange']" use="@startref"/>
|
---|
30 |
|
---|
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()]))"/>
|
---|
32 |
|
---|
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()]))"/>
|
---|
34 |
|
---|
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()]))"/>
|
---|
36 |
|
---|
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)"/>
|
---|
38 |
|
---|
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)"/>
|
---|
40 |
|
---|
41 | <xsl:key name="sections" match="*[@id]" use="@id"/>
|
---|
42 |
|
---|
43 | <xsl:template name="generate-index">
|
---|
44 | <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
|
---|
45 |
|
---|
46 | <xsl:variable name="role">
|
---|
47 | <xsl:if test="$index.on.role != 0">
|
---|
48 | <xsl:value-of select="@role"/>
|
---|
49 | </xsl:if>
|
---|
50 | </xsl:variable>
|
---|
51 |
|
---|
52 | <xsl:variable name="type">
|
---|
53 | <xsl:if test="$index.on.type != 0">
|
---|
54 | <xsl:value-of select="@type"/>
|
---|
55 | </xsl:if>
|
---|
56 | </xsl:variable>
|
---|
57 |
|
---|
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')]"/>
|
---|
59 |
|
---|
60 | <xsl:variable name="alphabetical" select="$terms[contains(concat('abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1))]"/>
|
---|
61 |
|
---|
62 | <xsl:variable name="others" select="$terms[not(contains(concat('abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1)))]"/>
|
---|
63 | <div class="index">
|
---|
64 | <xsl:if test="$others">
|
---|
65 | <div class="indexdiv">
|
---|
66 | <h3>
|
---|
67 | <xsl:call-template name="gentext">
|
---|
68 | <xsl:with-param name="key" select="'index symbols'"/>
|
---|
69 | </xsl:call-template>
|
---|
70 | </h3>
|
---|
71 | <dl>
|
---|
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>
|
---|
78 | </dl>
|
---|
79 | </div>
|
---|
80 | </xsl:if>
|
---|
81 |
|
---|
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>
|
---|
88 | </div>
|
---|
89 | </xsl:template>
|
---|
90 |
|
---|
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="''"/>
|
---|
95 |
|
---|
96 | <xsl:variable name="key" select="translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
|
---|
97 |
|
---|
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)">
|
---|
102 | <h3>
|
---|
103 | <xsl:value-of select="translate($key, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
|
---|
104 | </h3>
|
---|
105 | </xsl:if>
|
---|
106 | <dl>
|
---|
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>
|
---|
113 | </dl>
|
---|
114 | </div>
|
---|
115 | </xsl:if>
|
---|
116 | </xsl:template>
|
---|
117 |
|
---|
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="''"/>
|
---|
122 |
|
---|
123 | <xsl:variable name="key" select="translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1), 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
|
---|
124 |
|
---|
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>
|
---|
131 | </xsl:template>
|
---|
132 |
|
---|
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="''"/>
|
---|
137 |
|
---|
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))]"/>
|
---|
140 | <dt>
|
---|
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>
|
---|
148 | </xsl:for-each>
|
---|
149 |
|
---|
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>
|
---|
157 | </xsl:if>
|
---|
158 | </dt>
|
---|
159 | <xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
|
---|
160 | <dd>
|
---|
161 | <dl>
|
---|
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>
|
---|
174 | </dl>
|
---|
175 | </dd>
|
---|
176 | </xsl:if>
|
---|
177 | </xsl:template>
|
---|
178 |
|
---|
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="''"/>
|
---|
183 |
|
---|
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))]"/>
|
---|
186 | <dt>
|
---|
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>
|
---|
194 | </xsl:for-each>
|
---|
195 |
|
---|
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>
|
---|
203 | </xsl:if>
|
---|
204 | </dt>
|
---|
205 | <xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
|
---|
206 | <dd>
|
---|
207 | <dl>
|
---|
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>
|
---|
220 | </dl>
|
---|
221 | </dd>
|
---|
222 | </xsl:if>
|
---|
223 | </xsl:template>
|
---|
224 |
|
---|
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="''"/>
|
---|
229 |
|
---|
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))]"/>
|
---|
232 | <dt>
|
---|
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>
|
---|
240 | </xsl:for-each>
|
---|
241 |
|
---|
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>
|
---|
249 | </xsl:if>
|
---|
250 | </dt>
|
---|
251 | <xsl:if test="$refs/seealso">
|
---|
252 | <dd>
|
---|
253 | <dl>
|
---|
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>
|
---|
260 | </dl>
|
---|
261 | </dd>
|
---|
262 | </xsl:if>
|
---|
263 | </xsl:template>
|
---|
264 |
|
---|
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="', '"/>
|
---|
270 |
|
---|
271 | <xsl:value-of select="$separator"/>
|
---|
272 | <xsl:choose>
|
---|
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"/>
|
---|
279 | </xsl:call-template>
|
---|
280 | </xsl:when>
|
---|
281 | <xsl:otherwise>
|
---|
282 | <a>
|
---|
283 | <xsl:variable name="title">
|
---|
284 | <xsl:choose>
|
---|
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"/>
|
---|
287 | </xsl:when>
|
---|
288 | <xsl:otherwise>
|
---|
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"/>
|
---|
290 | </xsl:otherwise>
|
---|
291 | </xsl:choose>
|
---|
292 | </xsl:variable>
|
---|
293 |
|
---|
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]"/>
|
---|
298 | </xsl:call-template>
|
---|
299 | </xsl:attribute>
|
---|
300 |
|
---|
301 | <xsl:value-of select="$title"/> <!-- text only -->
|
---|
302 | </a>
|
---|
303 |
|
---|
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>
|
---|
311 | </xsl:if>
|
---|
312 | </xsl:otherwise>
|
---|
313 | </xsl:choose>
|
---|
314 | </xsl:template>
|
---|
315 |
|
---|
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"/>
|
---|
321 |
|
---|
322 | <xsl:choose>
|
---|
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))]"/>
|
---|
326 |
|
---|
327 | <a>
|
---|
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]"/>
|
---|
332 | </xsl:call-template>
|
---|
333 | </xsl:attribute>
|
---|
334 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
335 | </a>
|
---|
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"/>
|
---|
342 | </xsl:call-template>
|
---|
343 | </xsl:when>
|
---|
344 | <xsl:otherwise>
|
---|
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))]"/>
|
---|
347 |
|
---|
348 | <a>
|
---|
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]"/>
|
---|
353 | </xsl:call-template>
|
---|
354 | </xsl:attribute>
|
---|
355 | <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
|
---|
356 | </a>
|
---|
357 | </xsl:otherwise>
|
---|
358 | </xsl:choose>
|
---|
359 | </xsl:template>
|
---|
360 |
|
---|
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="''"/>
|
---|
365 |
|
---|
366 | <xsl:text> (</xsl:text>
|
---|
367 | <xsl:call-template name="gentext">
|
---|
368 | <xsl:with-param name="key" select="'see'"/>
|
---|
369 | </xsl:call-template>
|
---|
370 | <xsl:text> </xsl:text>
|
---|
371 | <xsl:value-of select="see"/>
|
---|
372 | <xsl:text>)</xsl:text>
|
---|
373 | </xsl:template>
|
---|
374 |
|
---|
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="''"/>
|
---|
379 |
|
---|
380 | <xsl:for-each select="seealso">
|
---|
381 | <xsl:sort select="translate(., 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
|
---|
382 | <dt>
|
---|
383 | <xsl:text>(</xsl:text>
|
---|
384 | <xsl:call-template name="gentext">
|
---|
385 | <xsl:with-param name="key" select="'seealso'"/>
|
---|
386 | </xsl:call-template>
|
---|
387 | <xsl:text> </xsl:text>
|
---|
388 | <xsl:value-of select="."/>
|
---|
389 | <xsl:text>)</xsl:text>
|
---|
390 | </dt>
|
---|
391 | </xsl:for-each>
|
---|
392 | </xsl:template>
|
---|
393 |
|
---|
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"/>
|
---|
397 | </xsl:variable>
|
---|
398 |
|
---|
399 | <xsl:value-of select="$title"/>
|
---|
400 | </xsl:template>
|
---|
401 |
|
---|
402 | </xsl:stylesheet>
|
---|