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">
6 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
8 xmlns:
fo=
"http://www.w3.org/1999/XSL/Format">
10 <xsl:import href=
"http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
11 <xsl:include href=
"stylesheet-common.xsl" />
13 <xsl:param name=
"fop1.extensions" select=
"1"></xsl:param>
14 <xsl:param name=
"tablecolumns.extension" select=
"0"></xsl:param>
15 <xsl:param name=
"toc.max.depth">3</xsl:param>
16 <xsl:param name=
"ulink.footnotes" select=
"1"></xsl:param>
18 <!-- The release notes have too many ulinks to look good as footnotes in print mode -->
19 <xsl:template match=
"sect1[starts-with(@id, 'release-')]//ulink[starts-with(@url, 'https://postgr.es/c/')]">
20 <!-- Do nothing for ulink to avoid footnotes -->
24 Suppress the description of the commit link markers in print mode.
25 Use "node()" to keep the paragraph but remove all content; prevents
26 an "Unresolved ID reference found" warning during PDF builds.
28 <xsl:template match=
"appendix[@id='release']//para[@id='release-commit-links']//node()">
29 <!-- Output an empty para -->
32 <xsl:param name=
"use.extensions" select=
"1"></xsl:param>
33 <xsl:param name=
"variablelist.as.blocks" select=
"1"></xsl:param>
34 <xsl:param name=
"orderedlist.label.width">1.5em
</xsl:param>
36 <xsl:attribute-set name=
"monospace.verbatim.properties"
37 use-attribute-sets=
"verbatim.properties monospace.properties">
38 <xsl:attribute name=
"wrap-option">wrap
</xsl:attribute>
41 <xsl:attribute-set name=
"nongraphical.admonition.properties">
42 <xsl:attribute name=
"border-style">solid
</xsl:attribute>
43 <xsl:attribute name=
"border-width">1pt
</xsl:attribute>
44 <xsl:attribute name=
"border-color">black
</xsl:attribute>
45 <xsl:attribute name=
"padding-start">12pt
</xsl:attribute>
46 <xsl:attribute name=
"padding-end">12pt
</xsl:attribute>
47 <xsl:attribute name=
"padding-top">6pt
</xsl:attribute>
48 <xsl:attribute name=
"padding-bottom">6pt
</xsl:attribute>
51 <xsl:attribute-set name=
"admonition.title.properties">
52 <xsl:attribute name=
"text-align">center
</xsl:attribute>
55 <!-- Make all tables default to left alignment, for consistency with HTML -->
56 <xsl:attribute-set name=
"table.table.properties">
57 <xsl:attribute name=
"text-align">left
</xsl:attribute>
60 <!-- fix missing space after vertical simplelist
61 https://github.com/docbook/xslt10-stylesheets/issues/31 -->
62 <xsl:attribute-set name=
"normal.para.spacing">
63 <xsl:attribute name=
"space-after.optimum">1em
</xsl:attribute>
64 <xsl:attribute name=
"space-after.minimum">0.8em
</xsl:attribute>
65 <xsl:attribute name=
"space-after.maximum">1.2em
</xsl:attribute>
68 <!-- Change display of some elements -->
70 <xsl:template match=
"command">
71 <xsl:call-template name=
"inline.monoseq"/>
74 <xsl:template match=
"confgroup" mode=
"bibliography.mode">
76 <xsl:apply-templates select=
"conftitle/text()" mode=
"bibliography.mode"/>
77 <xsl:text>,
</xsl:text>
78 <xsl:apply-templates select=
"confdates/text()" mode=
"bibliography.mode"/>
79 <xsl:value-of select=
"$biblioentry.item.separator"/>
83 <xsl:template match=
"isbn" mode=
"bibliography.mode">
85 <xsl:text>ISBN
</xsl:text>
86 <xsl:apply-templates mode=
"bibliography.mode"/>
87 <xsl:value-of select=
"$biblioentry.item.separator"/>
91 <!-- Make every sect1 in contrib get a page break -->
92 <xsl:template match=
"id('contrib')/sect1">
93 <fo:block break-after='page'
/>
97 <!-- formatting for entries in tables of functions -->
98 <xsl:template match=
"entry[@role='func_table_entry']/para">
99 <fo:block margin-left=
"4em" text-align=
"left">
100 <xsl:if test=
"self::para[@role='func_signature']">
101 <xsl:attribute name=
"text-indent">-
3.5em
</xsl:attribute>
103 <xsl:apply-templates/>
107 <!-- formatting for entries in tables of catalog/view columns -->
108 <xsl:template match=
"entry[@role='catalog_table_entry']/para">
109 <fo:block margin-left=
"4em" text-align=
"left">
110 <xsl:if test=
"self::para[@role='column_definition']">
111 <xsl:attribute name=
"text-indent">-
3.5em
</xsl:attribute>
113 <xsl:apply-templates/>
117 <!-- overrides stylesheet-common.xsl -->
118 <!-- FOP needs us to be explicit about the font to use for right arrow -->
119 <xsl:template match=
"returnvalue">
120 <fo:inline font-family=
"{$symbol.font.family}">→ </fo:inline>
121 <xsl:call-template name=
"inline.monoseq"/>
124 <!-- FOP needs us to be explicit about use of symbol font in some cases -->
125 <xsl:template match=
"phrase[@role='symbol_font']">
126 <fo:inline font-family=
"{$symbol.font.family}"><xsl:value-of select=
"."/></fo:inline>
129 <!-- bug fix from <https://sourceforge.net/p/docbook/bugs/1360/#831b> -->
131 <xsl:template match=
"varlistentry/term" mode=
"xref-to">
132 <xsl:param name=
"verbose" select=
"1"/>
133 <xsl:apply-templates mode=
"no.anchor.mode"/>
136 <!-- include refsects in PDF bookmarks
137 (https://github.com/docbook/xslt10-stylesheets/issues/46) -->
139 <xsl:template match=
"refsect1|refsect2|refsect3"
142 <xsl:variable name=
"id">
143 <xsl:call-template name=
"object.id"/>
145 <xsl:variable name=
"bookmark-label">
146 <xsl:apply-templates select=
"." mode=
"object.title.markup"/>
149 <fo:bookmark internal-destination=
"{$id}">
150 <xsl:attribute name=
"starting-state">
151 <xsl:value-of select=
"$bookmarks.state"/>
154 <xsl:value-of select=
"normalize-space($bookmark-label)"/>
156 <xsl:apply-templates select=
"*" mode=
"bookmark"/>
160 <!-- make generated ids reproducible
161 (https://github.com/docbook/xslt10-stylesheets/issues/54) -->
163 <!-- from fo/autoidx.xsl -->
165 <xsl:key name=
"primaryonly"
167 use=
"normalize-space(primary)"/>
169 <xsl:template match=
"indexterm" mode=
"index-primary">
170 <xsl:param name=
"scope" select=
"."/>
171 <xsl:param name=
"role" select=
"''"/>
172 <xsl:param name=
"type" select=
"''"/>
174 <xsl:variable name=
"key" select=
"&primary;"/>
175 <xsl:variable name=
"refs" select=
"key('primary', $key)[&scope;]"/>
177 <xsl:variable name=
"term.separator">
178 <xsl:call-template name=
"index.separator">
179 <xsl:with-param name=
"key" select=
"'index.term.separator'"/>
183 <xsl:variable name=
"range.separator">
184 <xsl:call-template name=
"index.separator">
185 <xsl:with-param name=
"key" select=
"'index.range.separator'"/>
189 <xsl:variable name=
"number.separator">
190 <xsl:call-template name=
"index.separator">
191 <xsl:with-param name=
"key" select=
"'index.number.separator'"/>
195 <fo:block xmlns:
rx=
"http://www.renderx.com/XSL/Extensions" xmlns:
axf=
"http://www.antennahouse.com/names/XSL/Extensions">
196 <xsl:if test=
"$autolink.index.see != 0">
197 <xsl:attribute name=
"id">
198 <!-- pgsql-docs: begin -->
199 <xsl:text>ientry-
</xsl:text>
200 <xsl:call-template name=
"object.id"/>
201 <!-- pgsql-docs: end -->
204 <xsl:if test=
"$axf.extensions != 0">
205 <xsl:attribute name=
"axf:suppress-duplicate-page-number">true
</xsl:attribute>
208 <xsl:for-each select=
"$refs/primary">
209 <xsl:if test=
"@id or @xml:id">
210 <fo:inline id=
"{(@id|@xml:id)[1]}"/>
214 <xsl:value-of select=
"primary"/>
217 <xsl:when test=
"$xep.extensions != 0">
218 <xsl:if test=
"$refs[not(see) and not(secondary)]">
219 <xsl:copy-of select=
"$term.separator"/>
220 <xsl:variable name=
"primary" select=
"&primary;"/>
221 <xsl:variable name=
"primary.significant" select=
"concat(&primary;, $significant.flag)"/>
222 <rx:page-index list-separator=
"{$number.separator}"
223 range-separator=
"{$range.separator}">
224 <xsl:if test=
"$refs[@significance='preferred'][not(see) and not(secondary)]">
225 <rx:index-item xsl:
use-attribute-sets=
"index.preferred.page.properties xep.index.item.properties"
226 ref-key=
"{$primary.significant}"/>
228 <xsl:if test=
"$refs[not(@significance) or @significance!='preferred'][not(see) and not(secondary)]">
229 <rx:index-item xsl:
use-attribute-sets=
"xep.index.item.properties"
230 ref-key=
"{$primary}"/>
236 <xsl:variable name=
"page-number-citations">
237 <xsl:for-each select=
"$refs[not(see)
238 and not(secondary)]">
239 <xsl:apply-templates select=
"." mode=
"reference">
240 <xsl:with-param name=
"scope" select=
"$scope"/>
241 <xsl:with-param name=
"role" select=
"$role"/>
242 <xsl:with-param name=
"type" select=
"$type"/>
243 <xsl:with-param name=
"position" select=
"position()"/>
244 </xsl:apply-templates>
248 <xsl:copy-of select=
"$page-number-citations"/>
252 <xsl:if test=
"$refs[not(secondary)]/*[self::see]">
253 <xsl:apply-templates select=
"$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
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(see, &lowercase;, &uppercase;)"/>
259 </xsl:apply-templates>
264 <xsl:if test=
"$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
265 <fo:block start-indent=
"1pc">
266 <xsl:apply-templates select=
"$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
267 mode=
"index-seealso">
268 <xsl:with-param name=
"scope" select=
"$scope"/>
269 <xsl:with-param name=
"role" select=
"$role"/>
270 <xsl:with-param name=
"type" select=
"$type"/>
271 <xsl:sort select=
"translate(seealso, &lowercase;, &uppercase;)"/>
272 </xsl:apply-templates>
273 <xsl:apply-templates select=
"$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]"
274 mode=
"index-secondary">
275 <xsl:with-param name=
"scope" select=
"$scope"/>
276 <xsl:with-param name=
"role" select=
"$role"/>
277 <xsl:with-param name=
"type" select=
"$type"/>
278 <xsl:sort select=
"translate(&secondary;, &lowercase;, &uppercase;)"/>
279 </xsl:apply-templates>
284 <xsl:template match=
"indexterm" mode=
"index-see">
285 <xsl:param name=
"scope" select=
"."/>
286 <xsl:param name=
"role" select=
"''"/>
287 <xsl:param name=
"type" select=
"''"/>
289 <xsl:variable name=
"see" select=
"normalize-space(see)"/>
291 <!-- can only link to primary, which should appear before comma
292 in see "primary, secondary" entry -->
293 <xsl:variable name=
"seeprimary">
295 <xsl:when test=
"contains($see, ',')">
296 <xsl:value-of select=
"substring-before($see, ',')"/>
299 <xsl:value-of select=
"$see"/>
304 <xsl:variable name=
"seetarget" select=
"key('primaryonly', $seeprimary)[1]"/>
306 <xsl:variable name=
"linkend">
307 <xsl:if test=
"$seetarget">
308 <!-- pgsql-docs: begin -->
309 <xsl:text>ientry-
</xsl:text>
310 <xsl:call-template name=
"object.id">
311 <xsl:with-param name=
"object" select=
"$seetarget"/>
313 <!-- pgsql-docs: end -->
317 <fo:inline xmlns:xlink='http://www.w3.org/
1999/xlink'
>
318 <xsl:text> (
</xsl:text>
319 <xsl:call-template name=
"gentext">
320 <xsl:with-param name=
"key" select=
"'see'"/>
322 <xsl:text> </xsl:text>
324 <!-- manual links have precedence -->
325 <xsl:when test=
"see/@linkend or see/@xlink:href">
326 <xsl:call-template name=
"simple.xlink">
327 <xsl:with-param name=
"node" select=
"see"/>
328 <xsl:with-param name=
"content" select=
"$see"/>
331 <xsl:when test=
"$autolink.index.see = 0">
332 <xsl:value-of select=
"$see"/>
334 <xsl:when test=
"$seetarget">
335 <fo:basic-link internal-destination=
"{$linkend}"
336 xsl:
use-attribute-sets=
"xref.properties">
337 <xsl:value-of select=
"$see"/>
341 <xsl:value-of select=
"$see"/>
344 <xsl:text>)
</xsl:text>
348 <xsl:template match=
"indexterm" mode=
"index-seealso">
349 <xsl:param name=
"scope" select=
"."/>
350 <xsl:param name=
"role" select=
"''"/>
351 <xsl:param name=
"type" select=
"''"/>
353 <xsl:for-each select=
"seealso">
354 <xsl:sort select=
"translate(., &lowercase;, &uppercase;)"/>
356 <xsl:variable name=
"seealso" select=
"normalize-space(.)"/>
358 <!-- can only link to primary, which should appear before comma
359 in seealso "primary, secondary" entry -->
360 <xsl:variable name=
"seealsoprimary">
362 <xsl:when test=
"contains($seealso, ',')">
363 <xsl:value-of select=
"substring-before($seealso, ',')"/>
366 <xsl:value-of select=
"$seealso"/>
371 <xsl:variable name=
"seealsotarget" select=
"key('primaryonly', $seealsoprimary)[1]"/>
373 <xsl:variable name=
"linkend">
374 <xsl:if test=
"$seealsotarget">
375 <!-- pgsql-docs: begin -->
376 <xsl:text>ientry-
</xsl:text>
377 <xsl:call-template name=
"object.id">
378 <xsl:with-param name=
"object" select=
"$seealsotarget"/>
380 <!-- pgsql-docs: end -->
384 <fo:block xmlns:xlink='http://www.w3.org/
1999/xlink'
>
385 <xsl:text>(
</xsl:text>
386 <xsl:call-template name=
"gentext">
387 <xsl:with-param name=
"key" select=
"'seealso'"/>
389 <xsl:text> </xsl:text>
391 <!-- manual links have precedence -->
392 <xsl:when test=
"@linkend or see/@xlink:href">
393 <xsl:call-template name=
"simple.xlink">
394 <xsl:with-param name=
"node" select=
"."/>
395 <xsl:with-param name=
"content" select=
"$seealso"/>
398 <xsl:when test=
"$autolink.index.see = 0">
399 <xsl:value-of select=
"$seealso"/>
401 <xsl:when test=
"$seealsotarget">
402 <fo:basic-link internal-destination=
"{$linkend}"
403 xsl:
use-attribute-sets=
"xref.properties">
404 <xsl:value-of select=
"$seealso"/>
408 <xsl:value-of select=
"$seealso"/>
411 <xsl:text>)
</xsl:text>