Debian Codegraph @

doc/src/sgml/stylesheet-html-common.xsl

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY % common.entities SYSTEM "http://docbook.sourceforge.net/release/xsl/current/common/entities.ent">
4 %common.entities;
5 ]>
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 version="1.0"
8 xmlns="http://www.w3.org/1999/xhtml">
9
10 <!--
11 This file contains XSLT stylesheet customizations that are common to
12 all HTML output variants (chunked and single-page).
13 -->
14
15 <!-- Parameters -->
16 <xsl:param name="make.valid.html" select="1"></xsl:param>
17 <xsl:param name="generate.id.attributes" select="1"></xsl:param>
18 <xsl:param name="make.graphic.viewport" select="0"/>
19 <xsl:param name="link.mailto.url">[email protected]</xsl:param>
20 <xsl:param name="toc.max.depth">2</xsl:param>
21 <xsl:param name="website.stylesheet" select="0"/>
22 <xsl:param name="custom.css.source">
23 <xsl:if test="$website.stylesheet = 0">stylesheet.css.xml</xsl:if>
24 </xsl:param>
25 <xsl:param name="html.stylesheet">
26 <xsl:if test="not($website.stylesheet = 0)">https://www.postgresql.org/media/css/docs-complete.css</xsl:if>
27 </xsl:param>
28
29
30 <!--
31 The below allows the stylesheets provided by the website to be applied fully
32 to the generated HTML.
33 -->
34 <xsl:template name="body.attributes">
35 <xsl:attribute name="id">docContent</xsl:attribute>
36 <xsl:attribute name="class">container-fluid col-10</xsl:attribute>
37 </xsl:template>
38
39 <!-- Change display of some elements -->
40
41 <xsl:template match="command">
42 <xsl:call-template name="inline.monoseq"/>
43 </xsl:template>
44
45 <xsl:template match="confgroup" mode="bibliography.mode">
46 <span>
47 <xsl:call-template name="common.html.attributes"/>
48 <xsl:call-template name="id.attribute"/>
49 <xsl:apply-templates select="conftitle/text()" mode="bibliography.mode"/>
50 <xsl:text>, </xsl:text>
51 <xsl:apply-templates select="confdates/text()" mode="bibliography.mode"/>
52 <xsl:copy-of select="$biblioentry.item.separator"/>
53 </span>
54 </xsl:template>
55
56 <xsl:template match="isbn" mode="bibliography.mode">
57 <span>
58 <xsl:call-template name="common.html.attributes"/>
59 <xsl:call-template name="id.attribute"/>
60 <xsl:text>ISBN </xsl:text>
61 <xsl:apply-templates mode="bibliography.mode"/>
62 <xsl:copy-of select="$biblioentry.item.separator"/>
63 </span>
64 </xsl:template>
65
66
67 <!-- table of contents configuration -->
68
69 <xsl:param name="generate.toc">
70 appendix toc,title
71 article/appendix nop
72 article toc,title
73 book toc,title
74 chapter toc,title
75 part toc,title
76 preface toc,title
77 qandadiv toc
78 qandaset toc
79 reference toc,title
80 sect1 toc
81 sect2 toc
82 sect3 toc
83 sect4 toc
84 sect5 toc
85 section toc
86 set toc,title
87 </xsl:param>
88
89 <xsl:param name="generate.section.toc.level" select="1"></xsl:param>
90
91 <!-- include refentry under sect1 in tocs -->
92 <xsl:template match="sect1" mode="toc">
93 <xsl:param name="toc-context" select="."/>
94 <xsl:call-template name="subtoc">
95 <xsl:with-param name="toc-context" select="$toc-context"/>
96 <xsl:with-param name="nodes" select="sect2|refentry
97 |bridgehead[$bridgehead.in.toc != 0]"/>
98 </xsl:call-template>
99 </xsl:template>
100
101
102 <!-- Put index "quicklinks" (A | B | C | ...) at the top of the bookindex page. -->
103
104 <!-- from html/autoidx.xsl -->
105
106 <xsl:template name="generate-basic-index">
107 <xsl:param name="scope" select="NOTANODE"/>
108
109 <xsl:variable name="role">
110 <xsl:if test="$index.on.role != 0">
111 <xsl:value-of select="@role"/>
112 </xsl:if>
113 </xsl:variable>
114
115 <xsl:variable name="type">
116 <xsl:if test="$index.on.type != 0">
117 <xsl:value-of select="@type"/>
118 </xsl:if>
119 </xsl:variable>
120
121 <xsl:variable name="terms"
122 select="//indexterm
123 [count(.|key('letter',
124 translate(substring(&primary;, 1, 1),
125 &lowercase;,
126 &uppercase;))
127 [&scope;][1]) = 1
128 and not(@class = 'endofrange')]"/>
129
130 <xsl:variable name="alphabetical"
131 select="$terms[contains(concat(&lowercase;, &uppercase;),
132 substring(&primary;, 1, 1))]"/>
133
134 <xsl:variable name="others" select="$terms[not(contains(concat(&lowercase;,
135 &uppercase;),
136 substring(&primary;, 1, 1)))]"/>
137
138 <!-- pgsql-docs: added xmlns:xlink, autoidx.xsl doesn't include xlink in
139 exclude-result-prefixes. Without our customization that just leads to a
140 single xmlns:xlink in this div, but because we emit it it otherwise
141 gets pushed down to the elements output by autoidx.xsl -->
142 <div class="index" xmlns:xlink="http://www.w3.org/1999/xlink">
143 <p class="indexdiv-quicklinks">
144 <a href="#indexdiv-Symbols">
145 <xsl:call-template name="gentext">
146 <xsl:with-param name="key" select="'index symbols'"/>
147 </xsl:call-template>
148 </a>
149 <xsl:apply-templates select="$alphabetical[count(.|key('letter',
150 translate(substring(&primary;, 1, 1),
151 &lowercase;,&uppercase;))[&scope;][1]) = 1]"
152 mode="index-div-quicklinks">
153 <xsl:with-param name="position" select="position()"/>
154 <xsl:with-param name="scope" select="$scope"/>
155 <xsl:with-param name="role" select="$role"/>
156 <xsl:with-param name="type" select="$type"/>
157 <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
158 </xsl:apply-templates>
159 </p>
160 <!-- pgsql-docs: end added stuff -->
161
162 <xsl:if test="$others">
163 <xsl:choose>
164 <xsl:when test="normalize-space($type) != '' and
165 $others[@type = $type][count(.|key('primary', &primary;)[&scope;][1]) = 1]">
166 <!-- pgsql-docs: added id attribute here for linking to it -->
167 <div class="indexdiv" id="indexdiv-Symbols">
168 <h3>
169 <xsl:call-template name="gentext">
170 <xsl:with-param name="key" select="'index symbols'"/>
171 </xsl:call-template>
172 </h3>
173 <dl>
174 <xsl:apply-templates select="$others[count(.|key('primary', &primary;)[&scope;][1]) = 1]"
175 mode="index-symbol-div">
176 <xsl:with-param name="position" select="position()"/>
177 <xsl:with-param name="scope" select="$scope"/>
178 <xsl:with-param name="role" select="$role"/>
179 <xsl:with-param name="type" select="$type"/>
180 <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
181 </xsl:apply-templates>
182 </dl>
183 </div>
184 </xsl:when>
185 <xsl:when test="normalize-space($type) != ''">
186 <!-- Output nothing, as there isn't a match for $other using this $type -->
187 </xsl:when>
188 <xsl:otherwise>
189 <!-- pgsql-docs: added id attribute here for linking to it -->
190 <div class="indexdiv" id="indexdiv-Symbols">
191 <h3>
192 <xsl:call-template name="gentext">
193 <xsl:with-param name="key" select="'index symbols'"/>
194 </xsl:call-template>
195 </h3>
196 <dl>
197 <xsl:apply-templates select="$others[count(.|key('primary',
198 &primary;)[&scope;][1]) = 1]"
199 mode="index-symbol-div">
200 <xsl:with-param name="position" select="position()"/>
201 <xsl:with-param name="scope" select="$scope"/>
202 <xsl:with-param name="role" select="$role"/>
203 <xsl:with-param name="type" select="$type"/>
204 <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
205 </xsl:apply-templates>
206 </dl>
207 </div>
208 </xsl:otherwise>
209 </xsl:choose>
210 </xsl:if>
211
212 <xsl:apply-templates select="$alphabetical[count(.|key('letter',
213 translate(substring(&primary;, 1, 1),
214 &lowercase;,&uppercase;))[&scope;][1]) = 1]"
215 mode="index-div-basic">
216 <xsl:with-param name="position" select="position()"/>
217 <xsl:with-param name="scope" select="$scope"/>
218 <xsl:with-param name="role" select="$role"/>
219 <xsl:with-param name="type" select="$type"/>
220 <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
221 </xsl:apply-templates>
222 </div>
223 </xsl:template>
224
225 <xsl:template match="indexterm" mode="index-div-basic">
226 <xsl:param name="scope" select="."/>
227 <xsl:param name="role" select="''"/>
228 <xsl:param name="type" select="''"/>
229
230 <xsl:variable name="key"
231 select="translate(substring(&primary;, 1, 1),
232 &lowercase;,&uppercase;)"/>
233
234 <xsl:if test="key('letter', $key)[&scope;]
235 [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
236 <div class="indexdiv">
237 <!-- pgsql-docs: added id attribute here for linking to it -->
238 <xsl:attribute name="id">
239 <xsl:value-of select="concat('indexdiv-', $key)"/>
240 </xsl:attribute>
241
242 <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
243 <h3>
244 <xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
245 </h3>
246 </xsl:if>
247 <dl>
248 <xsl:apply-templates select="key('letter', $key)[&scope;]
249 [count(.|key('primary', &primary;)
250 [&scope;][1])=1]"
251 mode="index-primary">
252 <xsl:with-param name="position" select="position()"/>
253 <xsl:with-param name="scope" select="$scope"/>
254 <xsl:with-param name="role" select="$role"/>
255 <xsl:with-param name="type" select="$type"/>
256 <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
257 </xsl:apply-templates>
258 </dl>
259 </div>
260 </xsl:if>
261 </xsl:template>
262
263 <!-- pgsql-docs -->
264 <xsl:template match="indexterm" mode="index-div-quicklinks">
265 <xsl:param name="scope" select="."/>
266 <xsl:param name="role" select="''"/>
267 <xsl:param name="type" select="''"/>
268
269 <xsl:variable name="key"
270 select="translate(substring(&primary;, 1, 1),
271 &lowercase;,&uppercase;)"/>
272
273 <xsl:if test="key('letter', $key)[&scope;]
274 [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
275 <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
276 |
277 <a>
278 <xsl:attribute name="href">
279 <xsl:value-of select="concat('#indexdiv-', $key)"/>
280 </xsl:attribute>
281 <xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
282 </a>
283 </xsl:if>
284 </xsl:if>
285 </xsl:template>
286
287
288 <!-- upper case HTML anchors for backward compatibility -->
289
290 <xsl:template name="object.id">
291 <xsl:param name="object" select="."/>
292 <xsl:choose>
293 <xsl:when test="$object/@id">
294 <xsl:value-of select="translate($object/@id, &lowercase;, &uppercase;)"/>
295 </xsl:when>
296 <xsl:when test="$object/@xml:id">
297 <xsl:value-of select="$object/@xml:id"/>
298 </xsl:when>
299 <xsl:when test="$generate.consistent.ids != 0">
300 <!-- Make $object the current node -->
301 <xsl:for-each select="$object">
302 <xsl:text>id-</xsl:text>
303 <xsl:number level="multiple" count="*"/>
304 </xsl:for-each>
305 </xsl:when>
306 <xsl:otherwise>
307 <xsl:value-of select="generate-id($object)"/>
308 </xsl:otherwise>
309 </xsl:choose>
310 </xsl:template>
311
312
313 <!-- Add an id link to each section heading. -->
314
315 <!-- from html/sections.xsl -->
316 <xsl:template name="section.heading">
317 <xsl:param name="section" select="."/>
318 <xsl:param name="level" select="1"/>
319 <xsl:param name="allow-anchors" select="1"/>
320 <xsl:param name="title"/>
321 <xsl:param name="class" select="'title'"/>
322
323 <xsl:variable name="id">
324 <xsl:choose>
325 <!-- Make sure the subtitle doesn't get the same id as the title -->
326 <xsl:when test="self::subtitle">
327 <xsl:call-template name="object.id">
328 <xsl:with-param name="object" select="."/>
329 </xsl:call-template>
330 </xsl:when>
331 <!-- if title is in an *info wrapper, get the grandparent -->
332 <xsl:when test="contains(local-name(..), 'info')">
333 <xsl:call-template name="object.id">
334 <xsl:with-param name="object" select="../.."/>
335 </xsl:call-template>
336 </xsl:when>
337 <xsl:otherwise>
338 <xsl:call-template name="object.id">
339 <xsl:with-param name="object" select=".."/>
340 </xsl:call-template>
341 </xsl:otherwise>
342 </xsl:choose>
343 </xsl:variable>
344
345 <!-- HTML H level is one higher than section level -->
346 <xsl:variable name="hlevel">
347 <xsl:choose>
348 <!-- highest valid HTML H level is H6; so anything nested deeper
349 than 5 levels down just becomes H6 -->
350 <xsl:when test="$level &gt; 5">6</xsl:when>
351 <xsl:otherwise>
352 <xsl:value-of select="$level + 1"/>
353 </xsl:otherwise>
354 </xsl:choose>
355 </xsl:variable>
356 <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
357 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
358 <xsl:if test="$css.decoration != '0'">
359 <xsl:if test="$hlevel&lt;3">
360 <xsl:attribute name="style">clear: both</xsl:attribute>
361 </xsl:if>
362 </xsl:if>
363 <xsl:if test="$allow-anchors != 0">
364 <xsl:call-template name="anchor">
365 <xsl:with-param name="node" select="$section"/>
366 <xsl:with-param name="conditional" select="0"/>
367 </xsl:call-template>
368 </xsl:if>
369 <xsl:copy-of select="$title"/>
370 <!-- pgsql-docs: begin -->
371 <xsl:call-template name="pg.id.link">
372 <xsl:with-param name="object" select="$section"/>
373 </xsl:call-template>
374 <!-- pgsql-docs: end -->
375 </xsl:element>
376 </xsl:template>
377
378
379 <!-- Add an id link after the last term of a varlistentry. -->
380
381 <!-- overrides html/lists.xsl -->
382 <xsl:template match="varlistentry/term">
383 <xsl:apply-imports/>
384
385 <!-- Add the link after the last term -->
386 <xsl:if test="position() = last()">
387 <xsl:call-template name="pg.id.link">
388 <xsl:with-param name="object" select="parent::varlistentry"/>
389 </xsl:call-template>
390 </xsl:if>
391 </xsl:template>
392
393
394 <!-- Create a link pointing to an id within the document -->
395 <xsl:template name="pg.id.link">
396 <xsl:param name="object" select="."/>
397 <xsl:choose>
398 <xsl:when test="$object/@id or $object/@xml:id">
399 <xsl:text> </xsl:text>
400 <a>
401 <xsl:attribute name="href">
402 <xsl:text>#</xsl:text>
403 <xsl:call-template name="object.id">
404 <xsl:with-param name="object" select="$object"/>
405 </xsl:call-template>
406 </xsl:attribute>
407 <xsl:attribute name="class">
408 <xsl:text>id_link</xsl:text>
409 </xsl:attribute>
410 <xsl:text>#</xsl:text>
411 </a>
412 </xsl:when>
413 <xsl:otherwise>
414 <!-- Only complain about varlistentries if at least one entry in
415 the list has an id -->
416 <xsl:if test="name($object) != 'varlistentry'
417 or $object/parent::variablelist/varlistentry[@id]">
418 <xsl:message terminate="yes">
419 <xsl:text>ERROR: id attribute missing on &lt;</xsl:text>
420 <xsl:value-of select ="name($object)"/>
421 <xsl:text>&gt; element under </xsl:text>
422 <xsl:for-each select="$object/ancestor::*">
423 <xsl:text>/</xsl:text>
424 <xsl:value-of select ="name(.)"/>
425 <xsl:if test="@id|@xml:id">
426 <xsl:text>[@</xsl:text>
427 <xsl:value-of select ="name(@id|@xml:id)"/>
428 <xsl:text> = '</xsl:text>
429 <xsl:value-of select ="@id"/>
430 <xsl:text>']</xsl:text>
431 </xsl:if>
432 </xsl:for-each>
433 </xsl:message>
434 </xsl:if>
435 </xsl:otherwise>
436 </xsl:choose>
437 </xsl:template>
438
439 <!-- make generated ids reproducible
440 (https://github.com/docbook/xslt10-stylesheets/issues/54) -->
441
442 <!-- from html/autoidx.xsl -->
443
444 <xsl:key name="primaryonly"
445 match="indexterm"
446 use="normalize-space(primary)"/>
447
448 <xsl:template match="indexterm" mode="index-primary">
449 <xsl:param name="scope" select="."/>
450 <xsl:param name="role" select="''"/>
451 <xsl:param name="type" select="''"/>
452
453 <xsl:variable name="key" select="&primary;"/>
454 <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
455 <dt>
456 <xsl:if test="$autolink.index.see != 0">
457 <!-- add internal id attribute to form see and seealso links -->
458 <xsl:attribute name="id">
459 <!-- pgsql-docs: begin -->
460 <xsl:text>ientry-</xsl:text>
461 <xsl:call-template name="object.id"/>
462 <!-- pgsql-docs: end -->
463 </xsl:attribute>
464 </xsl:if>
465 <xsl:for-each select="$refs/primary">
466 <xsl:if test="@id or @xml:id">
467 <xsl:choose>
468 <xsl:when test="$generate.id.attributes = 0">
469 <a name="{(@id|@xml:id)[1]}"/>
470 </xsl:when>
471 <xsl:otherwise>
472 <span>
473 <xsl:call-template name="id.attribute"/>
474 </span>
475 </xsl:otherwise>
476 </xsl:choose>
477 </xsl:if>
478 </xsl:for-each>
479 <xsl:value-of select="primary"/>
480 <xsl:choose>
481 <xsl:when test="$index.links.to.section = 1">
482 <xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('primary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
483 <xsl:apply-templates select="." mode="reference">
484 <xsl:with-param name="position" select="position()"/>
485 <xsl:with-param name="scope" select="$scope"/>
486 <xsl:with-param name="role" select="$role"/>
487 <xsl:with-param name="type" select="$type"/>
488 </xsl:apply-templates>
489 </xsl:for-each>
490 </xsl:when>
491 <xsl:otherwise>
492 <xsl:for-each select="$refs[not(see)
493 and not(secondary)][&scope;]">
494 <xsl:apply-templates select="." mode="reference">
495 <xsl:with-param name="position" select="position()"/>
496 <xsl:with-param name="scope" select="$scope"/>
497 <xsl:with-param name="role" select="$role"/>
498 <xsl:with-param name="type" select="$type"/>
499 </xsl:apply-templates>
500 </xsl:for-each>
501 </xsl:otherwise>
502 </xsl:choose>
503
504 <xsl:if test="$refs[not(secondary)]/*[self::see]">
505 <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
506 mode="index-see">
507 <xsl:with-param name="position" select="position()"/>
508 <xsl:with-param name="scope" select="$scope"/>
509 <xsl:with-param name="role" select="$role"/>
510 <xsl:with-param name="type" select="$type"/>
511 <xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
512 </xsl:apply-templates>
513 </xsl:if>
514 </dt>
515 <xsl:choose>
516 <xsl:when test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
517 <dd>
518 <dl>
519 <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
520 mode="index-seealso">
521 <xsl:with-param name="position" select="position()"/>
522 <xsl:with-param name="scope" select="$scope"/>
523 <xsl:with-param name="role" select="$role"/>
524 <xsl:with-param name="type" select="$type"/>
525 <xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
526 </xsl:apply-templates>
527 <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]"
528 mode="index-secondary">
529 <xsl:with-param name="position" select="position()"/>
530 <xsl:with-param name="scope" select="$scope"/>
531 <xsl:with-param name="role" select="$role"/>
532 <xsl:with-param name="type" select="$type"/>
533 <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
534 </xsl:apply-templates>
535 </dl>
536 </dd>
537 </xsl:when>
538 <!-- HTML5 requires dd for each dt -->
539 <xsl:when test="$div.element = 'section'">
540 <dd></dd>
541 </xsl:when>
542 </xsl:choose>
543 </xsl:template>
544
545 <xsl:template match="indexterm" mode="index-see" xmlns:xlink='http://www.w3.org/1999/xlink'>
546 <xsl:param name="scope" select="."/>
547 <xsl:param name="role" select="''"/>
548 <xsl:param name="type" select="''"/>
549
550 <xsl:variable name="see" select="normalize-space(see)"/>
551
552 <!-- can only link to primary, which should appear before comma
553 in see "primary, secondary" entry -->
554 <xsl:variable name="seeprimary">
555 <xsl:choose>
556 <xsl:when test="contains($see, ',')">
557 <xsl:value-of select="substring-before($see, ',')"/>
558 </xsl:when>
559 <xsl:otherwise>
560 <xsl:value-of select="$see"/>
561 </xsl:otherwise>
562 </xsl:choose>
563 </xsl:variable>
564
565 <xsl:variable name="seetarget" select="key('primaryonly', $seeprimary)[1]"/>
566
567 <xsl:variable name="linkend">
568 <xsl:if test="$seetarget">
569 <!-- pgsql-docs: begin -->
570 <xsl:text>#ientry-</xsl:text>
571 <xsl:call-template name="object.id">
572 <xsl:with-param name="object" select="$seetarget"/>
573 </xsl:call-template>
574 <!-- pgsql-docs: end -->
575 </xsl:if>
576 </xsl:variable>
577
578 <xsl:text> (</xsl:text>
579 <xsl:call-template name="gentext">
580 <xsl:with-param name="key" select="'see'"/>
581 </xsl:call-template>
582 <xsl:text> </xsl:text>
583 <xsl:choose>
584 <!-- manual links have precedence -->
585 <xsl:when test="see/@linkend or see/@xlink:href">
586 <xsl:call-template name="simple.xlink">
587 <xsl:with-param name="node" select="see"/>
588 <xsl:with-param name="content" select="$see"/>
589 </xsl:call-template>
590 </xsl:when>
591 <xsl:when test="$autolink.index.see = 0">
592 <xsl:value-of select="$see"/>
593 </xsl:when>
594 <xsl:when test="$seetarget">
595 <a href="{$linkend}">
596 <xsl:value-of select="$see"/>
597 </a>
598 </xsl:when>
599 <xsl:otherwise>
600 <xsl:value-of select="$see"/>
601 </xsl:otherwise>
602 </xsl:choose>
603 <xsl:text>)</xsl:text>
604 </xsl:template>
605
606 <xsl:template match="indexterm" mode="index-seealso" xmlns:xlink='http://www.w3.org/1999/xlink'>
607 <xsl:param name="scope" select="."/>
608 <xsl:param name="role" select="''"/>
609 <xsl:param name="type" select="''"/>
610
611 <xsl:for-each select="seealso">
612 <xsl:sort select="translate(., &lowercase;, &uppercase;)"/>
613
614 <xsl:variable name="seealso" select="normalize-space(.)"/>
615
616 <!-- can only link to primary, which should appear before comma
617 in seealso "primary, secondary" entry -->
618 <xsl:variable name="seealsoprimary">
619 <xsl:choose>
620 <xsl:when test="contains($seealso, ',')">
621 <xsl:value-of select="substring-before($seealso, ',')"/>
622 </xsl:when>
623 <xsl:otherwise>
624 <xsl:value-of select="$seealso"/>
625 </xsl:otherwise>
626 </xsl:choose>
627 </xsl:variable>
628
629 <xsl:variable name="seealsotarget" select="key('primaryonly', $seealsoprimary)[1]"/>
630
631 <xsl:variable name="linkend">
632 <xsl:if test="$seealsotarget">
633 <!-- pgsql-docs: begin -->
634 <xsl:text>#ientry-</xsl:text>
635 <xsl:call-template name="object.id">
636 <xsl:with-param name="object" select="$seealsotarget"/>
637 </xsl:call-template>
638 <!-- pgsql-docs: end -->
639 </xsl:if>
640 </xsl:variable>
641
642 <dt>
643 <xsl:text>(</xsl:text>
644 <xsl:call-template name="gentext">
645 <xsl:with-param name="key" select="'seealso'"/>
646 </xsl:call-template>
647 <xsl:text> </xsl:text>
648 <xsl:choose>
649 <!-- manual links have precedence -->
650 <xsl:when test="@linkend or see/@xlink:href">
651 <xsl:call-template name="simple.xlink">
652 <xsl:with-param name="node" select="."/>
653 <xsl:with-param name="content" select="$seealso"/>
654 </xsl:call-template>
655 </xsl:when>
656 <xsl:when test="$autolink.index.see = 0">
657 <xsl:value-of select="$seealso"/>
658 </xsl:when>
659 <xsl:when test="$seealsotarget">
660 <a href="{$linkend}">
661 <xsl:value-of select="$seealso"/>
662 </a>
663 </xsl:when>
664 <xsl:otherwise>
665 <xsl:value-of select="$seealso"/>
666 </xsl:otherwise>
667 </xsl:choose>
668 <xsl:text>)</xsl:text>
669 </dt>
670
671 <xsl:if test="$div.element = 'section'">
672 <dd></dd>
673 </xsl:if>
674 </xsl:for-each>
675 </xsl:template>
676
677 </xsl:stylesheet>