source: BOOK/stylesheets/pdf/lfs-mixed.xsl@ 5f6535b

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5f6535b was 3f8be484, checked in by Jim Gifford <clfs@…>, 19 years ago

r627@server (orig r625): jim | 2005-10-31 12:59:34 -0800
Import of Cross-LFS Book

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