| [f8c4e94] | 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, ' ') and $space.enquad.width != ''"> | 
|---|
|  | 50 | <xsl:call-template name="space.2001.subst"> | 
|---|
|  | 51 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.emquad.width != ''"> | 
|---|
|  | 71 | <xsl:call-template name="space.2002.subst"> | 
|---|
|  | 72 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.enspace.width != ''"> | 
|---|
|  | 92 | <xsl:call-template name="space.2003.subst"> | 
|---|
|  | 93 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.emspace.width != ''"> | 
|---|
|  | 113 | <xsl:call-template name="space.2004.subst"> | 
|---|
|  | 114 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.3emspace.width != ''"> | 
|---|
|  | 134 | <xsl:call-template name="space.2005.subst"> | 
|---|
|  | 135 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.4emspace.width != ''"> | 
|---|
|  | 155 | <xsl:call-template name="space.2006.subst"> | 
|---|
|  | 156 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.6emspace.width != ''"> | 
|---|
|  | 176 | <xsl:call-template name="space.2007.subst"> | 
|---|
|  | 177 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.figspace.width != ''"> | 
|---|
|  | 197 | <xsl:call-template name="space.2008.subst"> | 
|---|
|  | 198 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.punctspace.width != ''"> | 
|---|
|  | 218 | <xsl:call-template name="space.2009.subst"> | 
|---|
|  | 219 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.thinspace.width != ''"> | 
|---|
|  | 239 | <xsl:call-template name="space.200A.subst"> | 
|---|
|  | 240 | <xsl:with-param name="string" select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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, ' ') and $space.hairspace.width != ''"> | 
|---|
|  | 260 | <xsl:value-of select="substring-before($string, ' ')"/> | 
|---|
|  | 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, ' ')"/> | 
|---|
|  | 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 |  | 
|---|