source: stylesheets/pdf/lfs-mixed.xsl@ 0e9a9e2

6.0
Last change on this file since 0e9a9e2 was ce1be57, checked in by Manuel Canales Esparcia <manuel@…>, 20 years ago

Added a bullet and left align in PDF output for packages and patches list.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/testing/BOOK@4118 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

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