Merge pull request #4677 from mwichmann/issue/debug-memoizer
[scons.git] / SCons / Tool / docbook / docbook-xsl-1.76.1 / fo / spaces.xsl
blobd34c9cd96d731359de3e6e8010cebeeb99a65c3a
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'>
6 <!-- ********************************************************************
7 $Id: spaces.xsl 8121 2008-09-13 17:21:11Z mzjn $
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 ******************************************************************** -->
14 <xsl:template match="text()[namespace-uri(..) = '' or
15 namespace-uri(..) = 'http://docbook.org/ns/docbook']">
16 <xsl:choose>
17 <xsl:when test="$passivetex.extensions != 0">
18 <xsl:call-template name="passivetex.dash.subst">
19 <xsl:with-param name="string">
20 <xsl:call-template name="space.2000.subst">
21 <xsl:with-param name="string" select="."/>
22 </xsl:call-template>
23 </xsl:with-param>
24 </xsl:call-template>
25 </xsl:when>
26 <xsl:otherwise>
27 <xsl:call-template name="space.2000.subst">
28 <xsl:with-param name="string" select="."/>
29 </xsl:call-template>
30 </xsl:otherwise>
31 </xsl:choose>
32 </xsl:template>
34 <xsl:param name="space.enquad.width">0.5em</xsl:param> <!-- U+2000 -->
35 <xsl:param name="space.emquad.width">1em</xsl:param> <!-- U+2001 -->
36 <xsl:param name="space.enspace.width">0.5em</xsl:param> <!-- U+2002 -->
37 <xsl:param name="space.emspace.width">1em</xsl:param> <!-- U+2003 -->
38 <xsl:param name="space.3emspace.width">0.33em</xsl:param><!-- U+2004 -->
39 <xsl:param name="space.4emspace.width">0.25em</xsl:param><!-- U+2005 -->
40 <xsl:param name="space.6emspace.width">0.16em</xsl:param><!-- U+2006 -->
41 <xsl:param name="space.figspace.width"></xsl:param> <!-- U+2007 -->
42 <xsl:param name="space.punctspace.width"></xsl:param> <!-- U+2008 -->
43 <xsl:param name="space.thinspace.width">0.2em</xsl:param><!-- U+2009 -->
44 <xsl:param name="space.hairspace.width">0.1em</xsl:param><!-- U+200A -->
46 <xsl:template name="space.2000.subst">
47 <xsl:param name="string"/>
49 <xsl:choose>
50 <xsl:when test="contains($string, '&#x2000;') and $space.enquad.width != ''">
51 <xsl:call-template name="space.2001.subst">
52 <xsl:with-param name="string" select="substring-before($string, '&#x2000;')"/>
53 </xsl:call-template>
54 <fo:leader leader-length="{$space.enquad.width}"/>
55 <xsl:call-template name="space.2000.subst">
56 <xsl:with-param name="string" select="substring-after($string, '&#x2000;')"/>
57 </xsl:call-template>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:call-template name="space.2001.subst">
61 <xsl:with-param name="string" select="$string"/>
62 </xsl:call-template>
63 </xsl:otherwise>
64 </xsl:choose>
65 </xsl:template>
67 <xsl:template name="space.2001.subst">
68 <xsl:param name="string"/>
70 <xsl:choose>
71 <xsl:when test="contains($string, '&#x2001;') and $space.emquad.width != ''">
72 <xsl:call-template name="space.2002.subst">
73 <xsl:with-param name="string" select="substring-before($string, '&#x2001;')"/>
74 </xsl:call-template>
75 <fo:leader leader-length="{$space.emquad.width}"/>
76 <xsl:call-template name="space.2001.subst">
77 <xsl:with-param name="string" select="substring-after($string, '&#x2001;')"/>
78 </xsl:call-template>
79 </xsl:when>
80 <xsl:otherwise>
81 <xsl:call-template name="space.2002.subst">
82 <xsl:with-param name="string" select="$string"/>
83 </xsl:call-template>
84 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:template>
88 <xsl:template name="space.2002.subst">
89 <xsl:param name="string"/>
91 <xsl:choose>
92 <xsl:when test="contains($string, '&#x2002;') and $space.enspace.width != ''">
93 <xsl:call-template name="space.2003.subst">
94 <xsl:with-param name="string" select="substring-before($string, '&#x2002;')"/>
95 </xsl:call-template>
96 <fo:leader leader-length="{$space.enspace.width}"/>
97 <xsl:call-template name="space.2002.subst">
98 <xsl:with-param name="string" select="substring-after($string, '&#x2002;')"/>
99 </xsl:call-template>
100 </xsl:when>
101 <xsl:otherwise>
102 <xsl:call-template name="space.2003.subst">
103 <xsl:with-param name="string" select="$string"/>
104 </xsl:call-template>
105 </xsl:otherwise>
106 </xsl:choose>
107 </xsl:template>
109 <xsl:template name="space.2003.subst">
110 <xsl:param name="string"/>
112 <xsl:choose>
113 <xsl:when test="contains($string, '&#x2003;') and $space.emspace.width != ''">
114 <xsl:call-template name="space.2004.subst">
115 <xsl:with-param name="string" select="substring-before($string, '&#x2003;')"/>
116 </xsl:call-template>
117 <fo:leader leader-length="{$space.emspace.width}"/>
118 <xsl:call-template name="space.2003.subst">
119 <xsl:with-param name="string" select="substring-after($string, '&#x2003;')"/>
120 </xsl:call-template>
121 </xsl:when>
122 <xsl:otherwise>
123 <xsl:call-template name="space.2004.subst">
124 <xsl:with-param name="string" select="$string"/>
125 </xsl:call-template>
126 </xsl:otherwise>
127 </xsl:choose>
128 </xsl:template>
130 <xsl:template name="space.2004.subst">
131 <xsl:param name="string"/>
133 <xsl:choose>
134 <xsl:when test="contains($string, '&#x2004;') and $space.3emspace.width != ''">
135 <xsl:call-template name="space.2005.subst">
136 <xsl:with-param name="string" select="substring-before($string, '&#x2004;')"/>
137 </xsl:call-template>
138 <fo:leader leader-length="{$space.3emspace.width}"/>
139 <xsl:call-template name="space.2004.subst">
140 <xsl:with-param name="string" select="substring-after($string, '&#x2004;')"/>
141 </xsl:call-template>
142 </xsl:when>
143 <xsl:otherwise>
144 <xsl:call-template name="space.2005.subst">
145 <xsl:with-param name="string" select="$string"/>
146 </xsl:call-template>
147 </xsl:otherwise>
148 </xsl:choose>
149 </xsl:template>
151 <xsl:template name="space.2005.subst">
152 <xsl:param name="string"/>
154 <xsl:choose>
155 <xsl:when test="contains($string, '&#x2005;') and $space.4emspace.width != ''">
156 <xsl:call-template name="space.2006.subst">
157 <xsl:with-param name="string" select="substring-before($string, '&#x2005;')"/>
158 </xsl:call-template>
159 <fo:leader leader-length="{$space.4emspace.width}"/>
160 <xsl:call-template name="space.2005.subst">
161 <xsl:with-param name="string" select="substring-after($string, '&#x2005;')"/>
162 </xsl:call-template>
163 </xsl:when>
164 <xsl:otherwise>
165 <xsl:call-template name="space.2006.subst">
166 <xsl:with-param name="string" select="$string"/>
167 </xsl:call-template>
168 </xsl:otherwise>
169 </xsl:choose>
170 </xsl:template>
172 <xsl:template name="space.2006.subst">
173 <xsl:param name="string"/>
175 <xsl:choose>
176 <xsl:when test="contains($string, '&#x2006;') and $space.6emspace.width != ''">
177 <xsl:call-template name="space.2007.subst">
178 <xsl:with-param name="string" select="substring-before($string, '&#x2006;')"/>
179 </xsl:call-template>
180 <fo:leader leader-length="{$space.6emspace.width}"/>
181 <xsl:call-template name="space.2006.subst">
182 <xsl:with-param name="string" select="substring-after($string, '&#x2006;')"/>
183 </xsl:call-template>
184 </xsl:when>
185 <xsl:otherwise>
186 <xsl:call-template name="space.2007.subst">
187 <xsl:with-param name="string" select="$string"/>
188 </xsl:call-template>
189 </xsl:otherwise>
190 </xsl:choose>
191 </xsl:template>
193 <xsl:template name="space.2007.subst">
194 <xsl:param name="string"/>
196 <xsl:choose>
197 <xsl:when test="contains($string, '&#x2007;') and $space.figspace.width != ''">
198 <xsl:call-template name="space.2008.subst">
199 <xsl:with-param name="string" select="substring-before($string, '&#x2007;')"/>
200 </xsl:call-template>
201 <fo:leader leader-length="{$space.figspace.width}"/>
202 <xsl:call-template name="space.2007.subst">
203 <xsl:with-param name="string" select="substring-after($string, '&#x2007;')"/>
204 </xsl:call-template>
205 </xsl:when>
206 <xsl:otherwise>
207 <xsl:call-template name="space.2008.subst">
208 <xsl:with-param name="string" select="$string"/>
209 </xsl:call-template>
210 </xsl:otherwise>
211 </xsl:choose>
212 </xsl:template>
214 <xsl:template name="space.2008.subst">
215 <xsl:param name="string"/>
217 <xsl:choose>
218 <xsl:when test="contains($string, '&#x2008;') and $space.punctspace.width != ''">
219 <xsl:call-template name="space.2009.subst">
220 <xsl:with-param name="string" select="substring-before($string, '&#x2008;')"/>
221 </xsl:call-template>
222 <fo:leader leader-length="{$space.punctspace.width}"/>
223 <xsl:call-template name="space.2008.subst">
224 <xsl:with-param name="string" select="substring-after($string, '&#x2008;')"/>
225 </xsl:call-template>
226 </xsl:when>
227 <xsl:otherwise>
228 <xsl:call-template name="space.2009.subst">
229 <xsl:with-param name="string" select="$string"/>
230 </xsl:call-template>
231 </xsl:otherwise>
232 </xsl:choose>
233 </xsl:template>
235 <xsl:template name="space.2009.subst">
236 <xsl:param name="string"/>
238 <xsl:choose>
239 <xsl:when test="contains($string, '&#x2009;') and $space.thinspace.width != ''">
240 <xsl:call-template name="space.200A.subst">
241 <xsl:with-param name="string" select="substring-before($string, '&#x2009;')"/>
242 </xsl:call-template>
243 <fo:leader leader-length="{$space.thinspace.width}"/>
244 <xsl:call-template name="space.2009.subst">
245 <xsl:with-param name="string" select="substring-after($string, '&#x2009;')"/>
246 </xsl:call-template>
247 </xsl:when>
248 <xsl:otherwise>
249 <xsl:call-template name="space.200A.subst">
250 <xsl:with-param name="string" select="$string"/>
251 </xsl:call-template>
252 </xsl:otherwise>
253 </xsl:choose>
254 </xsl:template>
256 <xsl:template name="space.200A.subst">
257 <xsl:param name="string"/>
259 <xsl:choose>
260 <xsl:when test="contains($string, '&#x200A;') and $space.hairspace.width != ''">
261 <xsl:value-of select="substring-before($string, '&#x200A;')"/>
262 <fo:leader leader-length="{$space.hairspace.width}"/>
263 <xsl:call-template name="space.200A.subst">
264 <xsl:with-param name="string" select="substring-after($string, '&#x200A;')"/>
265 </xsl:call-template>
266 </xsl:when>
267 <xsl:otherwise>
268 <xsl:value-of select="$string"/>
269 </xsl:otherwise>
270 </xsl:choose>
271 </xsl:template>
273 </xsl:stylesheet>