source: clfs-embedded/BOOK/stylesheets/pdf/lfs-mixed.xsl@ e2d2a2d

Last change on this file since e2d2a2d was a9e389d, checked in by Jim Gifford <clfs@…>, 18 years ago

Initial Import of CLFS 3.0

  • Property mode set to 100644
File size: 9.5 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:fo="http://www.w3.org/1999/XSL/Format"
5 version="1.0">
6
7
8 <!-- This is a hack and isn't correct semantically. Theoretically, the beginpage
9 tags should be placed in the XML source only to render the PDF output and
10 should be removed after it. But there is no a better way and we need this.-->
11 <xsl:template match="beginpage">
12 <fo:block break-after="page"/>
13 </xsl:template>
14
15 <!-- Allow forced line breaks inside paragraphs emulating literallayout
16 and to remove vertical space in pachages and patches pages. -->
17 <xsl:template match="para">
18 <xsl:choose>
19 <xsl:when test="./@remap='verbatim'">
20 <fo:block wrap-option="no-wrap"
21 white-space-collapse="false"
22 white-space-treatment="preserve"
23 text-align="start"
24 linefeed-treatment="preserve">
25 <xsl:call-template name="anchor"/>
26 <xsl:apply-templates/>
27 </fo:block>
28 </xsl:when>
29 <xsl:when test="ancestor::variablelist/@role = 'materials'">
30 <fo:block>
31 <xsl:attribute name="space-before.optimum">0.1em</xsl:attribute>
32 <xsl:attribute name="space-before.minimum">0em</xsl:attribute>
33 <xsl:attribute name="space-before.maximum">0.2em</xsl:attribute>
34 <xsl:call-template name="anchor"/>
35 <xsl:apply-templates/>
36 </fo:block>
37 </xsl:when>
38 <xsl:otherwise>
39 <xsl:apply-imports/>
40 </xsl:otherwise>
41 </xsl:choose>
42 </xsl:template>
43
44 <!-- Show URLs in italic font -->
45 <xsl:template match="ulink" name="ulink">
46 <fo:inline font-style="italic">
47 <fo:basic-link xsl:use-attribute-sets="xref.properties">
48 <xsl:attribute name="external-destination">
49 <xsl:call-template name="fo-external-image">
50 <xsl:with-param name="filename" select="@url"/>
51 </xsl:call-template>
52 </xsl:attribute>
53 <xsl:choose>
54 <xsl:when test="count(child::node())=0">
55 <xsl:call-template name="hyphenate-url">
56 <xsl:with-param name="url" select="@url"/>
57 </xsl:call-template>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:apply-templates/>
61 </xsl:otherwise>
62 </xsl:choose>
63 </fo:basic-link>
64 </fo:inline>
65 <xsl:if test="count(child::node()) != 0
66 and string(.) != @url
67 and $ulink.show != 0">
68 <!-- yes, show the URI -->
69 <xsl:choose>
70 <xsl:when test="$ulink.footnotes != 0 and not(ancestor::footnote)">
71 <xsl:text>&#xA0;</xsl:text>
72 <fo:footnote>
73 <xsl:call-template name="ulink.footnote.number"/>
74 <fo:footnote-body font-family="{$body.fontset}"
75 font-size="{$footnote.font.size}">
76 <fo:block>
77 <xsl:call-template name="ulink.footnote.number"/>
78 <xsl:text> </xsl:text>
79 <fo:inline>
80 <xsl:value-of select="@url"/>
81 </fo:inline>
82 </fo:block>
83 </fo:footnote-body>
84 </fo:footnote>
85 </xsl:when>
86 <xsl:otherwise>
87 <fo:inline hyphenate="false">
88 <xsl:text> [</xsl:text>
89 <xsl:call-template name="hyphenate-url">
90 <xsl:with-param name="url" select="@url"/>
91 </xsl:call-template>
92 <xsl:text>]</xsl:text>
93 </fo:inline>
94 </xsl:otherwise>
95 </xsl:choose>
96 </xsl:if>
97 </xsl:template>
98
99 <!-- Split URLs (obsolete, keeped as reference) -->
100 <!--<xsl:template name="hyphenate-url">
101 <xsl:param name="url" select="''"/>
102 <xsl:choose>
103 <xsl:when test="ancestor::varlistentry">
104 <xsl:choose>
105 <xsl:when test="string-length($url) > 90">
106 <xsl:value-of select="substring($url, 1, 50)"/>
107 <xsl:param name="rest" select="substring($url, 51)"/>
108 <xsl:value-of select="substring-before($rest, '/')"/>
109 <xsl:text> /</xsl:text>
110 <xsl:value-of select="substring-after($rest, '/')"/>
111 </xsl:when>
112 <xsl:otherwise>
113 <xsl:value-of select="$url"/>
114 </xsl:otherwise>
115 </xsl:choose>
116 </xsl:when>
117 <xsl:otherwise>
118 <xsl:value-of select="$url"/>-->
119 <!-- <xsl:value-of select="substring-before($url, '//')"/>
120 <xsl:text>// </xsl:text>
121 <xsl:call-template name="split-url">
122 <xsl:with-param name="url2" select="substring-after($url, '//')"/>
123 </xsl:call-template>-->
124 <!-- </xsl:otherwise>
125 </xsl:choose>
126 </xsl:template>-->
127
128 <!--<xsl:template name="split-url">
129 <xsl:choose>
130 <xsl:when test="contains($url2, '/')">
131 <xsl:param name="url2" select="''"/>
132 <xsl:value-of select="substring-before($url2, '/')"/>
133 <xsl:text> /</xsl:text>
134 <xsl:call-template name="split-url">
135 <xsl:with-param name="url2" select="substring-after($url2, '/')"/>
136 </xsl:call-template>
137 </xsl:when>
138 <xsl:otherwise>
139 <xsl:value-of select="$url2"/>
140 </xsl:otherwise>
141 </xsl:choose>
142 </xsl:template>-->
143
144 <!-- Shade screen -->
145 <xsl:param name="shade.verbatim" select="1"/>
146
147 <!-- How is rendered by default a variablelist -->
148 <xsl:param name="variablelist.as.blocks" select="1"/>
149 <xsl:param name="variablelist.max.termlength">32</xsl:param>
150
151 <!-- Adding space before segmentedlist -->
152 <xsl:template match="segmentedlist">
153 <!--<xsl:variable name="presentation">
154 <xsl:call-template name="pi-attribute">
155 <xsl:with-param name="pis"
156 select="processing-instruction('dbfo')"/>
157 <xsl:with-param name="attribute" select="'list-presentation'"/>
158 </xsl:call-template>
159 </xsl:variable>
160 <xsl:choose>
161 <xsl:when test="$presentation = 'table'">
162 <xsl:apply-templates select="." mode="seglist-table"/>
163 </xsl:when>
164 <xsl:when test="$presentation = 'list'">
165 <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
166 space-before.maximum="0.8em">
167 <xsl:apply-templates/>
168 </fo:block>
169 </xsl:when>
170 <xsl:when test="$segmentedlist.as.table != 0">
171 <xsl:apply-templates select="." mode="seglist-table"/>
172 </xsl:when>
173 <xsl:otherwise>-->
174 <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em"
175 space-before.maximum="0.8em">
176 <xsl:apply-templates/>
177 </fo:block>
178 <!--</xsl:otherwise>
179 </xsl:choose>-->
180 </xsl:template>
181
182 <!-- Presentation of literal tag -->
183 <xsl:template match="literal">
184 <fo:inline font-weight="normal">
185 <xsl:call-template name="inline.monoseq"/>
186 </fo:inline>
187 </xsl:template>
188
189 <!-- Left alingnament for itemizedlist -->
190 <xsl:template match="itemizedlist">
191 <xsl:variable name="id">
192 <xsl:call-template name="object.id"/>
193 </xsl:variable>
194 <xsl:variable name="label-width">
195 <xsl:call-template name="dbfo-attribute">
196 <xsl:with-param name="pis"
197 select="processing-instruction('dbfo')"/>
198 <xsl:with-param name="attribute" select="'label-width'"/>
199 </xsl:call-template>
200 </xsl:variable>
201 <xsl:if test="title">
202 <xsl:apply-templates select="title" mode="list.title.mode"/>
203 </xsl:if>
204 <!-- Preserve order of PIs and comments -->
205 <xsl:apply-templates
206 select="*[not(self::listitem
207 or self::title
208 or self::titleabbrev)]
209 |comment()[not(preceding-sibling::listitem)]
210 |processing-instruction()[not(preceding-sibling::listitem)]"/>
211 <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing"
212 provisional-label-separation="0.2em" text-align="left">
213 <xsl:attribute name="provisional-distance-between-starts">
214 <xsl:choose>
215 <xsl:when test="$label-width != ''">
216 <xsl:value-of select="$label-width"/>
217 </xsl:when>
218 <xsl:otherwise>1.5em</xsl:otherwise>
219 </xsl:choose>
220 </xsl:attribute>
221 <xsl:apply-templates
222 select="listitem
223 |comment()[preceding-sibling::listitem]
224 |processing-instruction()[preceding-sibling::listitem]"/>
225 </fo:list-block>
226 </xsl:template>
227
228 <!-- Addibg a bullet, and left alignament, for packages and paches list. -->
229
230 <xsl:template match="varlistentry" mode="vl.as.blocks">
231 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
232 <xsl:choose>
233 <xsl:when test="ancestor::variablelist/@role = 'materials'">
234 <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
235 keep-together.within-column="always"
236 keep-with-next.within-column="always" text-align="left">
237 <xsl:text>&#x2022; </xsl:text>
238 <xsl:apply-templates select="term"/>
239 </fo:block>
240 <fo:block margin-left="1.4pc" text-align="left">
241 <xsl:apply-templates select="listitem"/>
242 </fo:block>
243 </xsl:when>
244 <xsl:otherwise>
245 <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
246 keep-together.within-column="always"
247 keep-with-next.within-column="always">
248 <xsl:apply-templates select="term"/>
249 </fo:block>
250 <fo:block margin-left="0.25in">
251 <xsl:apply-templates select="listitem"/>
252 </fo:block>
253 </xsl:otherwise>
254 </xsl:choose>
255 </xsl:template>
256
257</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.