1<?xml version="1.0" encoding="utf-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                version="1.0"
4                xmlns:fo="http://www.w3.org/1999/XSL/Format">
5
6<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
7<xsl:include href="stylesheet-common.xsl" />
8
9<xsl:param name="fop1.extensions" select="1"></xsl:param>
10<xsl:param name="tablecolumns.extension" select="0"></xsl:param>
11<xsl:param name="toc.max.depth">3</xsl:param>
12<xsl:param name="ulink.footnotes" select="1"></xsl:param>
13<xsl:param name="use.extensions" select="1"></xsl:param>
14<xsl:param name="variablelist.as.blocks" select="1"></xsl:param>
15<xsl:param name="orderedlist.label.width">1.5em</xsl:param>
16
17<xsl:attribute-set name="monospace.verbatim.properties"
18                   use-attribute-sets="verbatim.properties monospace.properties">
19  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
20</xsl:attribute-set>
21
22<xsl:attribute-set name="nongraphical.admonition.properties">
23  <xsl:attribute name="border-style">solid</xsl:attribute>
24  <xsl:attribute name="border-width">1pt</xsl:attribute>
25  <xsl:attribute name="border-color">black</xsl:attribute>
26  <xsl:attribute name="padding-start">12pt</xsl:attribute>
27  <xsl:attribute name="padding-end">12pt</xsl:attribute>
28  <xsl:attribute name="padding-top">6pt</xsl:attribute>
29  <xsl:attribute name="padding-bottom">6pt</xsl:attribute>
30</xsl:attribute-set>
31
32<xsl:attribute-set name="admonition.title.properties">
33  <xsl:attribute name="text-align">center</xsl:attribute>
34</xsl:attribute-set>
35
36<!-- Make all tables default to left alignment, for consistency with HTML -->
37<xsl:attribute-set name="table.table.properties">
38  <xsl:attribute name="text-align">left</xsl:attribute>
39</xsl:attribute-set>
40
41<!-- fix missing space after vertical simplelist
42     https://github.com/docbook/xslt10-stylesheets/issues/31 -->
43<xsl:attribute-set name="normal.para.spacing">
44  <xsl:attribute name="space-after.optimum">1em</xsl:attribute>
45  <xsl:attribute name="space-after.minimum">0.8em</xsl:attribute>
46  <xsl:attribute name="space-after.maximum">1.2em</xsl:attribute>
47</xsl:attribute-set>
48
49<!-- Change display of some elements -->
50
51<xsl:template match="command">
52  <xsl:call-template name="inline.monoseq"/>
53</xsl:template>
54
55<xsl:template match="confgroup" mode="bibliography.mode">
56  <fo:inline>
57    <xsl:apply-templates select="conftitle/text()" mode="bibliography.mode"/>
58    <xsl:text>, </xsl:text>
59    <xsl:apply-templates select="confdates/text()" mode="bibliography.mode"/>
60    <xsl:value-of select="$biblioentry.item.separator"/>
61  </fo:inline>
62</xsl:template>
63
64<xsl:template match="isbn" mode="bibliography.mode">
65  <fo:inline>
66    <xsl:text>ISBN </xsl:text>
67    <xsl:apply-templates mode="bibliography.mode"/>
68    <xsl:value-of select="$biblioentry.item.separator"/>
69  </fo:inline>
70</xsl:template>
71
72<!-- formatting for entries in tables of functions -->
73<xsl:template match="entry[@role='func_table_entry']/para">
74  <fo:block margin-left="4em" text-align="left">
75    <xsl:if test="self::para[@role='func_signature']">
76      <xsl:attribute name="text-indent">-3.5em</xsl:attribute>
77    </xsl:if>
78    <xsl:apply-templates/>
79  </fo:block>
80</xsl:template>
81
82<!-- formatting for entries in tables of catalog/view columns -->
83<xsl:template match="entry[@role='catalog_table_entry']/para">
84  <fo:block margin-left="4em" text-align="left">
85    <xsl:if test="self::para[@role='column_definition']">
86      <xsl:attribute name="text-indent">-3.5em</xsl:attribute>
87    </xsl:if>
88    <xsl:apply-templates/>
89  </fo:block>
90</xsl:template>
91
92<!-- overrides stylesheet-common.xsl -->
93<!-- FOP needs us to be explicit about the font to use for right arrow -->
94<xsl:template match="returnvalue">
95  <fo:inline font-family="{$symbol.font.family}">&#x2192; </fo:inline>
96  <xsl:call-template name="inline.monoseq"/>
97</xsl:template>
98
99<!-- FOP needs us to be explicit about use of symbol font in some cases -->
100<xsl:template match="phrase[@role='symbol_font']">
101  <fo:inline font-family="{$symbol.font.family}"><xsl:value-of select="."/></fo:inline>
102</xsl:template>
103
104<!-- bug fix from <https://sourceforge.net/p/docbook/bugs/1360/#831b> -->
105
106<xsl:template match="varlistentry/term" mode="xref-to">
107  <xsl:param name="verbose" select="1"/>
108  <xsl:apply-templates mode="no.anchor.mode"/>
109</xsl:template>
110
111<!-- include refsects in PDF bookmarks
112     (https://github.com/docbook/xslt10-stylesheets/issues/46) -->
113
114<xsl:template match="refsect1|refsect2|refsect3"
115              mode="bookmark">
116
117  <xsl:variable name="id">
118    <xsl:call-template name="object.id"/>
119  </xsl:variable>
120  <xsl:variable name="bookmark-label">
121    <xsl:apply-templates select="." mode="object.title.markup"/>
122  </xsl:variable>
123
124  <fo:bookmark internal-destination="{$id}">
125    <xsl:attribute name="starting-state">
126      <xsl:value-of select="$bookmarks.state"/>
127    </xsl:attribute>
128    <fo:bookmark-title>
129      <xsl:value-of select="normalize-space($bookmark-label)"/>
130    </fo:bookmark-title>
131    <xsl:apply-templates select="*" mode="bookmark"/>
132  </fo:bookmark>
133</xsl:template>
134
135</xsl:stylesheet>
136