source: clfs-embedded/BOOK/stylesheets/lfs-xsl/pdf/lfs-pagesetup.xsl@ 36dec8b

Last change on this file since 36dec8b was 9882b55, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added the new lfs-xsl stylesheets.

  • Property mode set to 100644
File size: 9.8 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<!--
4$LastChangedBy$
5$Date$
6-->
7
8<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9 xmlns:fo="http://www.w3.org/1999/XSL/Format"
10 version="1.0">
11
12 <!-- This stylesheet controls page margins, sections page break,
13 header content and titles size. -->
14
15 <!-- The inner page margin. -->
16 <xsl:param name="page.margin.inner" select="'0.32in'"/>
17
18 <!-- The outer page margin. -->
19 <xsl:param name="page.margin.outer" select="'0.32in'"/>
20
21 <!-- The bottom margin of the page. -->
22 <xsl:param name="page.margin.bottom" select="'0.35in'"/>
23
24 <!-- The top margin of the page. -->
25 <xsl:param name="page.margin.top" select="'0.35in'"/>
26
27 <!-- The bottom margin of the body text. -->
28 <xsl:param name="body.margin.bottom" select="'0.4in'"/>
29
30 <!-- The top margin of the body text. -->
31 <xsl:param name="body.margin.top" select="'0.4in'"/>
32
33 <!-- Specifies the height of the header. -->
34 <xsl:param name="region.before.extent" select="'0.25in'"/>
35
36 <!-- Specifies the height of the footer. -->
37 <xsl:param name="region.after.extent" select="'0.25in'"/>
38
39 <!-- The start-indent for the body text. -->
40 <xsl:param name="body.start.indent" select="'0pc'"/>
41
42 <!-- Adjust the left margin for titles. -->
43 <xsl:param name="title.margin.left">-0.8pc</xsl:param>
44
45 <!-- Default table width on tables that do not specify an alternate
46 width using the dbfo processing instruction.
47 This value is used also on bookinfo/revhistory table. -->
48 <xsl:param name="default.table.width" select="'70%'"/>
49
50 <!-- Properties for component titles -->
51 <xsl:attribute-set name="component.title.properties">
52 <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
53 <xsl:attribute name="space-before.optimum">
54 <xsl:value-of select="concat($body.font.master, 'pt')"/>
55 </xsl:attribute>
56 <xsl:attribute name="space-before.minimum">
57 <xsl:value-of select="concat($body.font.master, 'pt * 0.8')"/>
58 </xsl:attribute>
59 <xsl:attribute name="space-before.maximum">
60 <xsl:value-of select="concat($body.font.master, 'pt * 1.2')"/>
61 </xsl:attribute>
62 <xsl:attribute name="hyphenate">false</xsl:attribute>
63 <xsl:attribute name="text-align">
64 <xsl:choose>
65 <xsl:when test="((parent::article | parent::articleinfo |
66 parent::info/parent::article)
67 and not(ancestor::book) and not(self::bibliography))
68 or (parent::slides | parent::slidesinfo)
69 or self::index">center</xsl:when>
70 <xsl:otherwise>left</xsl:otherwise>
71 </xsl:choose>
72 </xsl:attribute>
73 <xsl:attribute name="start-indent">
74 <xsl:value-of select="$title.margin.left"/>
75 </xsl:attribute>
76 </xsl:attribute-set>
77
78 <!-- Rule under headers? 1 =yes, 0 = no -->
79 <xsl:param name="header.rule" select="0"/>
80
81 <!-- Rule over footers? 1 =yes, 0 = no -->
82 <xsl:param name="footer.rule" select="0"></xsl:param>
83
84 <!-- Control depth of sections shown in running headers or footers.
85 Be sure that no unneeded fo:marker are generated. -->
86 <xsl:param name="marker.section.level" select="-1"></xsl:param>
87
88 <!-- Force package's sect1 onto a new page -->
89 <xsl:attribute-set name="section.level1.properties">
90 <xsl:attribute name="break-before">
91 <xsl:choose>
92 <!--<xsl:when test="not(. = //*/sect1[1])">
93 <xsl:text>page</xsl:text>
94 </xsl:when>-->
95 <xsl:when test="preceding-sibling::sect1[position()=1]/sect2/@role='package'
96 or self::sect1/sect2/@role='package'">page</xsl:when>
97 <xsl:otherwise>
98 <xsl:text>auto</xsl:text>
99 </xsl:otherwise>
100 </xsl:choose>
101 </xsl:attribute>
102 </xsl:attribute-set>
103
104 <!-- part/partintro:
105 Be sure that partintro is on a new page. -->
106 <!-- The original template is in {docbook-xsl}/fo/divisions.xsl -->
107 <xsl:template match="part/partintro">
108 <xsl:apply-templates select=".." mode="part.titlepage.mode">
109 <xsl:with-param name="additional.content">
110 <fo:block break-before="page"/>
111 <xsl:if test="title">
112 <xsl:call-template name="partintro.titlepage"/>
113 </xsl:if>
114 <xsl:apply-templates/>
115 </xsl:with-param>
116 </xsl:apply-templates>
117 <xsl:call-template name="generate.part.toc">
118 <xsl:with-param name="part" select=".."/>
119 </xsl:call-template>
120 </xsl:template>
121
122 <!-- book title:
123 Centered the title and removed unused code.
124 Removed book.titlepage.separator. -->
125 <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->
126 <xsl:template name="book.titlepage">
127 <fo:block margin-top="3in">
128 <fo:block>
129 <xsl:call-template name="book.titlepage.before.recto"/>
130 <xsl:call-template name="book.titlepage.recto"/>
131 </fo:block>
132 <fo:block>
133 <xsl:call-template name="book.titlepage.before.verso"/>
134 <xsl:call-template name="book.titlepage.verso"/>
135 </fo:block>
136 </fo:block>
137 </xsl:template>
138
139 <!-- book titlepage verso:
140 Added missing bibliosource and revhistory support.
141 Removed unused code. -->
142 <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->
143 <xsl:template name="book.titlepage.verso">
144 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/title"/>
145 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/corpauthor"/>
146 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/authorgroup"/>
147 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/author"/>
148 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/othercredit"/>
149 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/releaseinfo"/>
150 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/pubdate"/>
151 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/copyright"/>
152 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/bibliosource"/>
153 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/abstract"/>
154 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/revhistory"/>
155 <xsl:apply-templates mode="book.titlepage.verso.auto.mode" select="bookinfo/legalnotice"/>
156 </xsl:template>
157
158 <!-- bibliosource:
159 Self-made template to handle bibliosource when inside bookinfo. -->
160 <xsl:template match="bibliosource" mode="book.titlepage.verso.auto.mode">
161 <fo:block font-size="8pt">
162 <xsl:apply-templates/>
163 </fo:block>
164 </xsl:template>
165
166 <!-- part title:
167 Centered the title and removed unused code. -->
168 <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->
169 <xsl:template name="part.titlepage">
170 <fo:block>
171 <fo:block margin-top="3.5in">
172 <xsl:call-template name="part.titlepage.before.recto"/>
173 <xsl:call-template name="part.titlepage.recto"/>
174 </fo:block>
175 <fo:block>
176 <xsl:call-template name="part.titlepage.before.verso"/>
177 <xsl:call-template name="part.titlepage.verso"/>
178 </fo:block>
179 <xsl:call-template name="part.titlepage.separator"/>
180 </fo:block>
181 </xsl:template>
182
183 <!-- chapter title:
184 Small font size and left alignament. -->
185 <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->
186 <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
187 <fo:block xsl:use-attribute-sets="chapter.titlepage.recto.style"
188 font-size="21pt" font-weight="bold" text-align="left">
189 <xsl:call-template name="component.title">
190 <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
191 </xsl:call-template>
192 </fo:block>
193 </xsl:template>
194
195 <!-- sect2 title:
196 Skip sect2.titlepage run when title is empty.
197 Removed unused code. -->
198 <!-- The original template is in {docbook-xsl}/fo/sections.xsl -->
199 <xsl:template match="sect2">
200 <xsl:variable name="id">
201 <xsl:call-template name="object.id"/>
202 </xsl:variable>
203 <fo:block xsl:use-attribute-sets="section.level2.properties">
204 <xsl:attribute name="id">
205 <xsl:value-of select="$id"/>
206 </xsl:attribute>
207 <xsl:if test="not(string-length(title)=0)">
208 <xsl:call-template name="sect2.titlepage"/>
209 </xsl:if>
210 <xsl:apply-templates/>
211 </fo:block>
212 </xsl:template>
213
214 <!-- header.table:
215 Re-made template to not generate a fo:table in the header,
216 allowing a more simple header.content customization. -->
217 <!-- The original template is in {docbook-xsl}/fo/pagesetup.xsl -->
218 <xsl:template name="header.table">
219 <xsl:param name="sequence" select="''"/>
220 <xsl:param name="gentext-key" select="''"/>
221 <xsl:choose>
222 <xsl:when test="$gentext-key = 'book' or $sequence = 'blank'"/>
223 <xsl:otherwise>
224 <xsl:call-template name="header.content">
225 <xsl:with-param name="sequence" select="$sequence"/>
226 </xsl:call-template>
227 </xsl:otherwise>
228 </xsl:choose>
229 </xsl:template>
230
231 <!-- header.content
232 Re-made template to show the book title and version on all pages. -->
233 <!-- The original template is in {docbook-xsl}/fo/pagesetup.xsl -->
234 <xsl:template name="header.content">
235 <xsl:param name="sequence" select="''"/>
236 <fo:block>
237 <xsl:attribute name="text-align">
238 <xsl:choose>
239 <xsl:when test="$sequence = 'first' or $sequence = 'odd'">right</xsl:when>
240 <xsl:otherwise>left</xsl:otherwise>
241 </xsl:choose>
242 </xsl:attribute>
243 <xsl:value-of select="/book/bookinfo/title"/>
244 <xsl:text> - </xsl:text>
245 <xsl:value-of select="/book/bookinfo/subtitle"/>
246 </fo:block>
247 </xsl:template>
248
249</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.