Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit97f16b8

Browse files
committed
doc: Add index letter links to XSLT HTML build
This matches what was already implemented in the DSSSL HTML build.
1 parent1f87181 commit97f16b8

File tree

1 file changed

+187
-0
lines changed

1 file changed

+187
-0
lines changed

‎doc/src/sgml/stylesheet.xsl

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?xml version='1.0'?>
2+
<!DOCTYPExsl:stylesheet [
3+
<!ENTITY %common.entities SYSTEM"http://docbook.sourceforge.net/release/xsl/current/common/entities.ent">
4+
%common.entities;
5+
]>
26
<xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform"
37
version='1.0'
48
xmlns="http://www.w3.org/TR/xhtml1/transitional"
@@ -59,4 +63,187 @@ section toc
5963
set toc,title
6064
</xsl:param>
6165

66+
67+
<!-- Put index "quicklinks" (A | B | C | ...) at the top of the bookindex page.-->
68+
69+
<!-- from html/autoidx.xsl-->
70+
71+
<xsl:templatename="generate-basic-index">
72+
<xsl:paramname="scope"select="NOTANODE"/>
73+
74+
<xsl:variablename="role">
75+
<xsl:iftest="$index.on.role != 0">
76+
<xsl:value-ofselect="@role"/>
77+
</xsl:if>
78+
</xsl:variable>
79+
80+
<xsl:variablename="type">
81+
<xsl:iftest="$index.on.type != 0">
82+
<xsl:value-ofselect="@type"/>
83+
</xsl:if>
84+
</xsl:variable>
85+
86+
<xsl:variablename="terms"
87+
select="//indexterm
88+
[count(.|key('letter',
89+
translate(substring(&primary;, 1, 1),
90+
&lowercase;,
91+
&uppercase;))
92+
[&scope;][1]) = 1
93+
and not(@class = 'endofrange')]"/>
94+
95+
<xsl:variablename="alphabetical"
96+
select="$terms[contains(concat(&lowercase;,&uppercase;),
97+
substring(&primary;, 1, 1))]"/>
98+
99+
<xsl:variablename="others"select="$terms[not(contains(concat(&lowercase;,
100+
&uppercase;),
101+
substring(&primary;, 1, 1)))]"/>
102+
103+
<divclass="index">
104+
<!-- pgsql-docs: begin added stuff-->
105+
<pclass="indexdiv-quicklinks">
106+
<ahref="#indexdiv-Symbols">
107+
<xsl:call-templatename="gentext">
108+
<xsl:with-paramname="key"select="'index symbols'"/>
109+
</xsl:call-template>
110+
</a>
111+
<xsl:apply-templatesselect="$alphabetical[count(.|key('letter',
112+
translate(substring(&primary;, 1, 1),
113+
&lowercase;,&uppercase;))[&scope;][1]) = 1]"
114+
mode="index-div-quicklinks">
115+
<xsl:with-paramname="position"select="position()"/>
116+
<xsl:with-paramname="scope"select="$scope"/>
117+
<xsl:with-paramname="role"select="$role"/>
118+
<xsl:with-paramname="type"select="$type"/>
119+
<xsl:sortselect="translate(&primary;,&lowercase;,&uppercase;)"/>
120+
</xsl:apply-templates>
121+
</p>
122+
<!-- pgsql-docs: end added stuff-->
123+
124+
<xsl:iftest="$others">
125+
<xsl:choose>
126+
<xsl:whentest="normalize-space($type) != '' and
127+
$others[@type = $type][count(.|key('primary',&primary;)[&scope;][1]) = 1]">
128+
<!-- pgsql-docs: added id attribute here for linking to it-->
129+
<divclass="indexdiv"id="indexdiv-Symbols">
130+
<h3>
131+
<xsl:call-templatename="gentext">
132+
<xsl:with-paramname="key"select="'index symbols'"/>
133+
</xsl:call-template>
134+
</h3>
135+
<dl>
136+
<xsl:apply-templatesselect="$others[count(.|key('primary',&primary;)[&scope;][1]) = 1]"
137+
mode="index-symbol-div">
138+
<xsl:with-paramname="position"select="position()"/>
139+
<xsl:with-paramname="scope"select="$scope"/>
140+
<xsl:with-paramname="role"select="$role"/>
141+
<xsl:with-paramname="type"select="$type"/>
142+
<xsl:sortselect="translate(&primary;,&lowercase;,&uppercase;)"/>
143+
</xsl:apply-templates>
144+
</dl>
145+
</div>
146+
</xsl:when>
147+
<xsl:whentest="normalize-space($type) != ''">
148+
<!-- Output nothing, as there isn't a match for $other using this $type-->
149+
</xsl:when>
150+
<xsl:otherwise>
151+
<!-- pgsql-docs: added id attribute here for linking to it-->
152+
<divclass="indexdiv"id="indexdiv-Symbols">
153+
<h3>
154+
<xsl:call-templatename="gentext">
155+
<xsl:with-paramname="key"select="'index symbols'"/>
156+
</xsl:call-template>
157+
</h3>
158+
<dl>
159+
<xsl:apply-templatesselect="$others[count(.|key('primary',
160+
&primary;)[&scope;][1]) = 1]"
161+
mode="index-symbol-div">
162+
<xsl:with-paramname="position"select="position()"/>
163+
<xsl:with-paramname="scope"select="$scope"/>
164+
<xsl:with-paramname="role"select="$role"/>
165+
<xsl:with-paramname="type"select="$type"/>
166+
<xsl:sortselect="translate(&primary;,&lowercase;,&uppercase;)"/>
167+
</xsl:apply-templates>
168+
</dl>
169+
</div>
170+
</xsl:otherwise>
171+
</xsl:choose>
172+
</xsl:if>
173+
174+
<xsl:apply-templatesselect="$alphabetical[count(.|key('letter',
175+
translate(substring(&primary;, 1, 1),
176+
&lowercase;,&uppercase;))[&scope;][1]) = 1]"
177+
mode="index-div-basic">
178+
<xsl:with-paramname="position"select="position()"/>
179+
<xsl:with-paramname="scope"select="$scope"/>
180+
<xsl:with-paramname="role"select="$role"/>
181+
<xsl:with-paramname="type"select="$type"/>
182+
<xsl:sortselect="translate(&primary;,&lowercase;,&uppercase;)"/>
183+
</xsl:apply-templates>
184+
</div>
185+
</xsl:template>
186+
187+
<xsl:templatematch="indexterm"mode="index-div-basic">
188+
<xsl:paramname="scope"select="."/>
189+
<xsl:paramname="role"select="''"/>
190+
<xsl:paramname="type"select="''"/>
191+
192+
<xsl:variablename="key"
193+
select="translate(substring(&primary;, 1, 1),
194+
&lowercase;,&uppercase;)"/>
195+
196+
<xsl:iftest="key('letter', $key)[&scope;]
197+
[count(.|key('primary',&primary;)[&scope;][1]) = 1]">
198+
<divclass="indexdiv">
199+
<!-- pgsql-docs: added id attribute here for linking to it-->
200+
<xsl:attributename="id">
201+
<xsl:value-ofselect="concat('indexdiv-', $key)"/>
202+
</xsl:attribute>
203+
204+
<xsl:iftest="contains(concat(&lowercase;,&uppercase;), $key)">
205+
<h3>
206+
<xsl:value-ofselect="translate($key,&lowercase;,&uppercase;)"/>
207+
</h3>
208+
</xsl:if>
209+
<dl>
210+
<xsl:apply-templatesselect="key('letter', $key)[&scope;]
211+
[count(.|key('primary',&primary;)
212+
[&scope;][1])=1]"
213+
mode="index-primary">
214+
<xsl:with-paramname="position"select="position()"/>
215+
<xsl:with-paramname="scope"select="$scope"/>
216+
<xsl:with-paramname="role"select="$role"/>
217+
<xsl:with-paramname="type"select="$type"/>
218+
<xsl:sortselect="translate(&primary;,&lowercase;,&uppercase;)"/>
219+
</xsl:apply-templates>
220+
</dl>
221+
</div>
222+
</xsl:if>
223+
</xsl:template>
224+
225+
<!-- pgsql-docs-->
226+
<xsl:templatematch="indexterm"mode="index-div-quicklinks">
227+
<xsl:paramname="scope"select="."/>
228+
<xsl:paramname="role"select="''"/>
229+
<xsl:paramname="type"select="''"/>
230+
231+
<xsl:variablename="key"
232+
select="translate(substring(&primary;, 1, 1),
233+
&lowercase;,&uppercase;)"/>
234+
235+
<xsl:iftest="key('letter', $key)[&scope;]
236+
[count(.|key('primary',&primary;)[&scope;][1]) = 1]">
237+
<xsl:iftest="contains(concat(&lowercase;,&uppercase;), $key)">
238+
|
239+
<a>
240+
<xsl:attributename="href">
241+
<xsl:value-ofselect="concat('#indexdiv-', $key)"/>
242+
</xsl:attribute>
243+
<xsl:value-ofselect="translate($key,&lowercase;,&uppercase;)"/>
244+
</a>
245+
</xsl:if>
246+
</xsl:if>
247+
</xsl:template>
248+
62249
</xsl:stylesheet>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp