Repair memory leaks in plpython.
[pgsql.git] / doc / src / sgml / stylesheet-fo.xsl
blobe7916a6a88347a6777f0b1383e604e71db1962a8
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: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 -->
21 </xsl:template>
23 <!--
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.
27 -->
28 <xsl:template match="appendix[@id='release']//para[@id='release-commit-links']//node()">
29 <!-- Output an empty para -->
30 </xsl:template>
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>
39 </xsl:attribute-set>
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>
49 </xsl:attribute-set>
51 <xsl:attribute-set name="admonition.title.properties">
52 <xsl:attribute name="text-align">center</xsl:attribute>
53 </xsl:attribute-set>
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>
58 </xsl:attribute-set>
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>
66 </xsl:attribute-set>
68 <!-- Change display of some elements -->
70 <xsl:template match="command">
71 <xsl:call-template name="inline.monoseq"/>
72 </xsl:template>
74 <xsl:template match="confgroup" mode="bibliography.mode">
75 <fo:inline>
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"/>
80 </fo:inline>
81 </xsl:template>
83 <xsl:template match="isbn" mode="bibliography.mode">
84 <fo:inline>
85 <xsl:text>ISBN </xsl:text>
86 <xsl:apply-templates mode="bibliography.mode"/>
87 <xsl:value-of select="$biblioentry.item.separator"/>
88 </fo:inline>
89 </xsl:template>
91 <!-- Make every sect1 in contrib get a page break -->
92 <xsl:template match="id('contrib')/sect1">
93 <fo:block break-after='page'/>
94 <xsl:apply-imports/>
95 </xsl:template>
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>
102 </xsl:if>
103 <xsl:apply-templates/>
104 </fo:block>
105 </xsl:template>
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>
112 </xsl:if>
113 <xsl:apply-templates/>
114 </fo:block>
115 </xsl:template>
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}">&#x2192; </fo:inline>
121 <xsl:call-template name="inline.monoseq"/>
122 </xsl:template>
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>
127 </xsl:template>
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"/>
134 </xsl:template>
136 <!-- include refsects in PDF bookmarks
137 (https://github.com/docbook/xslt10-stylesheets/issues/46) -->
139 <xsl:template match="refsect1|refsect2|refsect3"
140 mode="bookmark">
142 <xsl:variable name="id">
143 <xsl:call-template name="object.id"/>
144 </xsl:variable>
145 <xsl:variable name="bookmark-label">
146 <xsl:apply-templates select="." mode="object.title.markup"/>
147 </xsl:variable>
149 <fo:bookmark internal-destination="{$id}">
150 <xsl:attribute name="starting-state">
151 <xsl:value-of select="$bookmarks.state"/>
152 </xsl:attribute>
153 <fo:bookmark-title>
154 <xsl:value-of select="normalize-space($bookmark-label)"/>
155 </fo:bookmark-title>
156 <xsl:apply-templates select="*" mode="bookmark"/>
157 </fo:bookmark>
158 </xsl:template>
160 <!-- make generated ids reproducible
161 (https://github.com/docbook/xslt10-stylesheets/issues/54) -->
163 <!-- from fo/autoidx.xsl -->
165 <xsl:key name="primaryonly"
166 match="indexterm"
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'"/>
180 </xsl:call-template>
181 </xsl:variable>
183 <xsl:variable name="range.separator">
184 <xsl:call-template name="index.separator">
185 <xsl:with-param name="key" select="'index.range.separator'"/>
186 </xsl:call-template>
187 </xsl:variable>
189 <xsl:variable name="number.separator">
190 <xsl:call-template name="index.separator">
191 <xsl:with-param name="key" select="'index.number.separator'"/>
192 </xsl:call-template>
193 </xsl:variable>
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 -->
202 </xsl:attribute>
203 </xsl:if>
204 <xsl:if test="$axf.extensions != 0">
205 <xsl:attribute name="axf:suppress-duplicate-page-number">true</xsl:attribute>
206 </xsl:if>
208 <xsl:for-each select="$refs/primary">
209 <xsl:if test="@id or @xml:id">
210 <fo:inline id="{(@id|@xml:id)[1]}"/>
211 </xsl:if>
212 </xsl:for-each>
214 <xsl:value-of select="primary"/>
216 <xsl:choose>
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}"/>
227 </xsl:if>
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}"/>
231 </xsl:if>
232 </rx:page-index>
233 </xsl:if>
234 </xsl:when>
235 <xsl:otherwise>
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>
245 </xsl:for-each>
246 </xsl:variable>
248 <xsl:copy-of select="$page-number-citations"/>
249 </xsl:otherwise>
250 </xsl:choose>
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])]"
254 mode="index-see">
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>
260 </xsl:if>
262 </fo:block>
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>
280 </fo:block>
281 </xsl:if>
282 </xsl:template>
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">
294 <xsl:choose>
295 <xsl:when test="contains($see, ',')">
296 <xsl:value-of select="substring-before($see, ',')"/>
297 </xsl:when>
298 <xsl:otherwise>
299 <xsl:value-of select="$see"/>
300 </xsl:otherwise>
301 </xsl:choose>
302 </xsl:variable>
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"/>
312 </xsl:call-template>
313 <!-- pgsql-docs: end -->
314 </xsl:if>
315 </xsl:variable>
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'"/>
321 </xsl:call-template>
322 <xsl:text> </xsl:text>
323 <xsl:choose>
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"/>
329 </xsl:call-template>
330 </xsl:when>
331 <xsl:when test="$autolink.index.see = 0">
332 <xsl:value-of select="$see"/>
333 </xsl:when>
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"/>
338 </fo:basic-link>
339 </xsl:when>
340 <xsl:otherwise>
341 <xsl:value-of select="$see"/>
342 </xsl:otherwise>
343 </xsl:choose>
344 <xsl:text>)</xsl:text>
345 </fo:inline>
346 </xsl:template>
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">
361 <xsl:choose>
362 <xsl:when test="contains($seealso, ',')">
363 <xsl:value-of select="substring-before($seealso, ',')"/>
364 </xsl:when>
365 <xsl:otherwise>
366 <xsl:value-of select="$seealso"/>
367 </xsl:otherwise>
368 </xsl:choose>
369 </xsl:variable>
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"/>
379 </xsl:call-template>
380 <!-- pgsql-docs: end -->
381 </xsl:if>
382 </xsl:variable>
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'"/>
388 </xsl:call-template>
389 <xsl:text> </xsl:text>
390 <xsl:choose>
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"/>
396 </xsl:call-template>
397 </xsl:when>
398 <xsl:when test="$autolink.index.see = 0">
399 <xsl:value-of select="$seealso"/>
400 </xsl:when>
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"/>
405 </fo:basic-link>
406 </xsl:when>
407 <xsl:otherwise>
408 <xsl:value-of select="$seealso"/>
409 </xsl:otherwise>
410 </xsl:choose>
411 <xsl:text>)</xsl:text>
412 </fo:block>
414 </xsl:for-each>
416 </xsl:template>
419 </xsl:stylesheet>