source: stylesheets/lfs-xsl/docbook-xsl-snapshot/fo/spaces.xsl@ 3c6bf83

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 3c6bf83 was 65b2904, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS-XSL Stylesheets files.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@6840 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 9.9 KB
Line 
1<?xml version='1.0' encoding="utf-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 version='1.0'>
5
6<!-- ********************************************************************
7 $Id$
8 ********************************************************************
9 XSL-FO specification treats all space characters like ordinary spaces.
10 We need to map them to fo:leader with different widths in order to
11 simulate desired behaviour.
12 ******************************************************************** -->
13
14<xsl:template match="text()[namespace-uri(..) = '']">
15 <xsl:choose>
16 <xsl:when test="$passivetex.extensions != 0">
17 <xsl:call-template name="passivetex.dash.subst">
18 <xsl:with-param name="string">
19 <xsl:call-template name="space.2000.subst">
20 <xsl:with-param name="string" select="."/>
21 </xsl:call-template>
22 </xsl:with-param>
23 </xsl:call-template>
24 </xsl:when>
25 <xsl:otherwise>
26 <xsl:call-template name="space.2000.subst">
27 <xsl:with-param name="string" select="."/>
28 </xsl:call-template>
29 </xsl:otherwise>
30 </xsl:choose>
31</xsl:template>
32
33<xsl:param name="space.enquad.width">0.5em</xsl:param> <!-- U+2000 -->
34<xsl:param name="space.emquad.width">1em</xsl:param> <!-- U+2001 -->
35<xsl:param name="space.enspace.width">0.5em</xsl:param> <!-- U+2002 -->
36<xsl:param name="space.emspace.width">1em</xsl:param> <!-- U+2003 -->
37<xsl:param name="space.3emspace.width">0.33em</xsl:param><!-- U+2004 -->
38<xsl:param name="space.4emspace.width">0.25em</xsl:param><!-- U+2005 -->
39<xsl:param name="space.6emspace.width">0.16em</xsl:param><!-- U+2006 -->
40<xsl:param name="space.figspace.width"></xsl:param> <!-- U+2007 -->
41<xsl:param name="space.punctspace.width"></xsl:param> <!-- U+2008 -->
42<xsl:param name="space.thinspace.width">0.2em</xsl:param><!-- U+2009 -->
43<xsl:param name="space.hairspace.width">0.1em</xsl:param><!-- U+200A -->
44
45<xsl:template name="space.2000.subst">
46 <xsl:param name="string"/>
47
48 <xsl:choose>
49 <xsl:when test="contains($string, '&#x2000;') and $space.enquad.width != ''">
50 <xsl:call-template name="space.2001.subst">
51 <xsl:with-param name="string" select="substring-before($string, '&#x2000;')"/>
52 </xsl:call-template>
53 <fo:leader leader-length="{$space.enquad.width}"/>
54 <xsl:call-template name="space.2000.subst">
55 <xsl:with-param name="string" select="substring-after($string, '&#x2000;')"/>
56 </xsl:call-template>
57 </xsl:when>
58 <xsl:otherwise>
59 <xsl:call-template name="space.2001.subst">
60 <xsl:with-param name="string" select="$string"/>
61 </xsl:call-template>
62 </xsl:otherwise>
63 </xsl:choose>
64</xsl:template>
65
66<xsl:template name="space.2001.subst">
67 <xsl:param name="string"/>
68
69 <xsl:choose>
70 <xsl:when test="contains($string, '&#x2001;') and $space.emquad.width != ''">
71 <xsl:call-template name="space.2002.subst">
72 <xsl:with-param name="string" select="substring-before($string, '&#x2001;')"/>
73 </xsl:call-template>
74 <fo:leader leader-length="{$space.emquad.width}"/>
75 <xsl:call-template name="space.2001.subst">
76 <xsl:with-param name="string" select="substring-after($string, '&#x2001;')"/>
77 </xsl:call-template>
78 </xsl:when>
79 <xsl:otherwise>
80 <xsl:call-template name="space.2002.subst">
81 <xsl:with-param name="string" select="$string"/>
82 </xsl:call-template>
83 </xsl:otherwise>
84 </xsl:choose>
85</xsl:template>
86
87<xsl:template name="space.2002.subst">
88 <xsl:param name="string"/>
89
90 <xsl:choose>
91 <xsl:when test="contains($string, '&#x2002;') and $space.enspace.width != ''">
92 <xsl:call-template name="space.2003.subst">
93 <xsl:with-param name="string" select="substring-before($string, '&#x2002;')"/>
94 </xsl:call-template>
95 <fo:leader leader-length="{$space.enspace.width}"/>
96 <xsl:call-template name="space.2002.subst">
97 <xsl:with-param name="string" select="substring-after($string, '&#x2002;')"/>
98 </xsl:call-template>
99 </xsl:when>
100 <xsl:otherwise>
101 <xsl:call-template name="space.2003.subst">
102 <xsl:with-param name="string" select="$string"/>
103 </xsl:call-template>
104 </xsl:otherwise>
105 </xsl:choose>
106</xsl:template>
107
108<xsl:template name="space.2003.subst">
109 <xsl:param name="string"/>
110
111 <xsl:choose>
112 <xsl:when test="contains($string, '&#x2003;') and $space.emspace.width != ''">
113 <xsl:call-template name="space.2004.subst">
114 <xsl:with-param name="string" select="substring-before($string, '&#x2003;')"/>
115 </xsl:call-template>
116 <fo:leader leader-length="{$space.emspace.width}"/>
117 <xsl:call-template name="space.2003.subst">
118 <xsl:with-param name="string" select="substring-after($string, '&#x2003;')"/>
119 </xsl:call-template>
120 </xsl:when>
121 <xsl:otherwise>
122 <xsl:call-template name="space.2004.subst">
123 <xsl:with-param name="string" select="$string"/>
124 </xsl:call-template>
125 </xsl:otherwise>
126 </xsl:choose>
127</xsl:template>
128
129<xsl:template name="space.2004.subst">
130 <xsl:param name="string"/>
131
132 <xsl:choose>
133 <xsl:when test="contains($string, '&#x2004;') and $space.3emspace.width != ''">
134 <xsl:call-template name="space.2005.subst">
135 <xsl:with-param name="string" select="substring-before($string, '&#x2004;')"/>
136 </xsl:call-template>
137 <fo:leader leader-length="{$space.3emspace.width}"/>
138 <xsl:call-template name="space.2004.subst">
139 <xsl:with-param name="string" select="substring-after($string, '&#x2004;')"/>
140 </xsl:call-template>
141 </xsl:when>
142 <xsl:otherwise>
143 <xsl:call-template name="space.2005.subst">
144 <xsl:with-param name="string" select="$string"/>
145 </xsl:call-template>
146 </xsl:otherwise>
147 </xsl:choose>
148</xsl:template>
149
150<xsl:template name="space.2005.subst">
151 <xsl:param name="string"/>
152
153 <xsl:choose>
154 <xsl:when test="contains($string, '&#x2005;') and $space.4emspace.width != ''">
155 <xsl:call-template name="space.2006.subst">
156 <xsl:with-param name="string" select="substring-before($string, '&#x2005;')"/>
157 </xsl:call-template>
158 <fo:leader leader-length="{$space.4emspace.width}"/>
159 <xsl:call-template name="space.2005.subst">
160 <xsl:with-param name="string" select="substring-after($string, '&#x2005;')"/>
161 </xsl:call-template>
162 </xsl:when>
163 <xsl:otherwise>
164 <xsl:call-template name="space.2006.subst">
165 <xsl:with-param name="string" select="$string"/>
166 </xsl:call-template>
167 </xsl:otherwise>
168 </xsl:choose>
169</xsl:template>
170
171<xsl:template name="space.2006.subst">
172 <xsl:param name="string"/>
173
174 <xsl:choose>
175 <xsl:when test="contains($string, '&#x2006;') and $space.6emspace.width != ''">
176 <xsl:call-template name="space.2007.subst">
177 <xsl:with-param name="string" select="substring-before($string, '&#x2006;')"/>
178 </xsl:call-template>
179 <fo:leader leader-length="{$space.6emspace.width}"/>
180 <xsl:call-template name="space.2006.subst">
181 <xsl:with-param name="string" select="substring-after($string, '&#x2006;')"/>
182 </xsl:call-template>
183 </xsl:when>
184 <xsl:otherwise>
185 <xsl:call-template name="space.2007.subst">
186 <xsl:with-param name="string" select="$string"/>
187 </xsl:call-template>
188 </xsl:otherwise>
189 </xsl:choose>
190</xsl:template>
191
192<xsl:template name="space.2007.subst">
193 <xsl:param name="string"/>
194
195 <xsl:choose>
196 <xsl:when test="contains($string, '&#x2007;') and $space.figspace.width != ''">
197 <xsl:call-template name="space.2008.subst">
198 <xsl:with-param name="string" select="substring-before($string, '&#x2007;')"/>
199 </xsl:call-template>
200 <fo:leader leader-length="{$space.figspace.width}"/>
201 <xsl:call-template name="space.2007.subst">
202 <xsl:with-param name="string" select="substring-after($string, '&#x2007;')"/>
203 </xsl:call-template>
204 </xsl:when>
205 <xsl:otherwise>
206 <xsl:call-template name="space.2008.subst">
207 <xsl:with-param name="string" select="$string"/>
208 </xsl:call-template>
209 </xsl:otherwise>
210 </xsl:choose>
211</xsl:template>
212
213<xsl:template name="space.2008.subst">
214 <xsl:param name="string"/>
215
216 <xsl:choose>
217 <xsl:when test="contains($string, '&#x2008;') and $space.punctspace.width != ''">
218 <xsl:call-template name="space.2009.subst">
219 <xsl:with-param name="string" select="substring-before($string, '&#x2008;')"/>
220 </xsl:call-template>
221 <fo:leader leader-length="{$space.punctspace.width}"/>
222 <xsl:call-template name="space.2008.subst">
223 <xsl:with-param name="string" select="substring-after($string, '&#x2008;')"/>
224 </xsl:call-template>
225 </xsl:when>
226 <xsl:otherwise>
227 <xsl:call-template name="space.2009.subst">
228 <xsl:with-param name="string" select="$string"/>
229 </xsl:call-template>
230 </xsl:otherwise>
231 </xsl:choose>
232</xsl:template>
233
234<xsl:template name="space.2009.subst">
235 <xsl:param name="string"/>
236
237 <xsl:choose>
238 <xsl:when test="contains($string, '&#x2009;') and $space.thinspace.width != ''">
239 <xsl:call-template name="space.200A.subst">
240 <xsl:with-param name="string" select="substring-before($string, '&#x2009;')"/>
241 </xsl:call-template>
242 <fo:leader leader-length="{$space.thinspace.width}"/>
243 <xsl:call-template name="space.2009.subst">
244 <xsl:with-param name="string" select="substring-after($string, '&#x2009;')"/>
245 </xsl:call-template>
246 </xsl:when>
247 <xsl:otherwise>
248 <xsl:call-template name="space.200A.subst">
249 <xsl:with-param name="string" select="$string"/>
250 </xsl:call-template>
251 </xsl:otherwise>
252 </xsl:choose>
253</xsl:template>
254
255<xsl:template name="space.200A.subst">
256 <xsl:param name="string"/>
257
258 <xsl:choose>
259 <xsl:when test="contains($string, '&#x200A;') and $space.hairspace.width != ''">
260 <xsl:value-of select="substring-before($string, '&#x200A;')"/>
261 <fo:leader leader-length="{$space.hairspace.width}"/>
262 <xsl:call-template name="space.200A.subst">
263 <xsl:with-param name="string" select="substring-after($string, '&#x200A;')"/>
264 </xsl:call-template>
265 </xsl:when>
266 <xsl:otherwise>
267 <xsl:value-of select="$string"/>
268 </xsl:otherwise>
269 </xsl:choose>
270</xsl:template>
271
272</xsl:stylesheet>
273
Note: See TracBrowser for help on using the repository browser.