source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/fo/spaces.xsl@ 15c7d39

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 15c7d39 was 15c7d39, checked in by Matthew Burgess <matthew@…>, 11 years ago

Update stylesheets to docbook-xsl-1.78.1.

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

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