1 <?xml version=
"1.0" encoding=
"utf-8"?>
5 Purpose: Used by check.sh for offline checking of the configuration.
8 Copyright: (c) 2007 Mike Wetherell
9 Licence: wxWidgets licence
12 <transform xmlns=
"http://www.w3.org/1999/XSL/Transform"
13 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
17 <namespace-alias stylesheet-prefix=
"XSL" result-prefix=
"xsl"/>
19 <output indent=
"yes"/>
23 select=
"//*[not(ancestor-or-self::*[name() != name(/*)])]"/>
27 select=
"$root[position() > 1]"/>
30 xmlns:
func=
"http://exslt.org/functions"
32 select=
"$root/xsl:import |
34 $root/xsl:attribute-set |
35 $root/xsl:character-map |
36 $root/xsl:decimal-format |
38 $root/xsl:import-schema |
40 $root/xsl:namespace-alias |
43 $root/xsl:preserve-space |
44 $root/xsl:strip-space |
47 $root/func:function"/>
51 <copy-of select=
"$root/namespace::*"/>
53 <for-each select=
"$root/@xsl:*">
54 <attribute name=
"{local-name()}">
55 <value-of select=
"."/>
59 <for-each select=
"$top-level">
60 <if test=
"not(../ancestor::*/*[name() = name(current()) and @name = current()/@name])">
61 <apply-templates mode=
"copy-xsl" select=
"."/>
65 <apply-templates select=
"*"/>
70 <variable name=
"pattern">
71 <call-template name=
"coord-pattern"/>
74 <variable name=
"is-xsl">
75 <call-template name=
"is-xsl"/>
78 <XSL:template match=
"*[generate-id() = generate-id(document('', /){$pattern})]">
79 <copy-of select=
"namespace::*"/>
81 <when test=
"$root/xsl:template[@name = name(current())]">
82 <call-template name=
"expand">
83 <with-param name=
"inside-xsl" select=
"$is-xsl = 'true'"/>
86 <when test=
"count($includes | .) = count($includes)">
88 <XSL:apply-templates select=
"node()"/>
91 <when test=
"count($top-level | .) != count($top-level)">
92 <call-template name=
"create-context"/>
97 <if test=
"$is-xsl != 'true'">
98 <apply-templates select=
"node()"/>
102 <template match=
"text()"/>
104 <template match=
"@*">
108 <template mode=
"copy-xsl" match=
"*[//xsl:template[not(ancestor::*[name() != name(/*)])]/@name = name()]">
110 <when test=
"ancestor::xsl:template[@name = name(current())]">
112 <call-template name=
"copy-xsl-children"/>
116 <call-template name=
"expand">
117 <with-param name=
"inside-xsl" select=
"true()"/>
123 <template mode=
"copy-xsl" match=
"@*|node()">
125 <call-template name=
"copy-xsl-children"/>
129 <template name=
"copy-xsl-children">
130 <copy-of select=
"namespace::*"/>
131 <apply-templates mode=
"copy-xsl" select=
"@*|node()"/>
134 <template name=
"coord-pattern">
135 <param name=
"element" select=
"."/>
137 <for-each select=
"$element/ancestor-or-self::*">
139 <value-of select=
"count(preceding-sibling::*) + 1"/>
144 <template name=
"is-xsl">
145 <param name=
"element" select=
"."/>
147 <when test=
"$element/self::xsl:*">
148 <value-of select=
"true()"/>
151 <variable name=
"namespace" select=
"namespace-uri($element)"/>
152 <variable name=
"extension-namespaces">
153 <for-each select=
"$element/ancestor-or-self::*/@xsl:extension-element-prefixes">
154 <variable name=
"prefixes"
155 select=
"concat(' ', normalize-space(.), ' ')"/>
156 <variable name=
"namespaces"
157 select=
"../namespace::*[contains($prefixes, concat(' ', name(), ' ')) or
158 (name() = '' and contains($prefixes, ' #default '))]"/>
159 <value-of select=
"$namespaces[. = $namespace]"/>
162 <value-of select=
"$extension-namespaces != ''"/>
167 <template name=
"expand">
168 <param name=
"inside-xsl"/>
169 <variable name=
"params" select=
"$root/xsl:template[@name = name(current())]/xsl:param"/>
171 <XSL:call-template name=
"{name()}">
172 <if test=
"node() and $params">
173 <XSL:with-param name=
"{$params[1]/@name}">
175 <when test=
"$inside-xsl">
176 <apply-templates mode=
"copy-xsl" select=
"node()"/>
179 <variable name=
"pattern">
180 <call-template name=
"coord-pattern"/>
182 <XSL:apply-templates select=
"{$pattern}/node()"/>
188 <for-each select=
"@*">
189 <variable name=
"len" select=
"string-length(.)"/>
191 <when test=
"substring(., 1, 1) = '{' and
192 substring(., $len, 1) = '}'">
193 <XSL:with-param name=
"{name()}"
194 select=
"{substring(., 2, $len - 2)}"/>
197 <XSL:with-param name=
"{name()}">
198 <call-template name=
"avt"/>
206 <template name=
"create-context">
207 <param name=
"elements" select=
"ancestor-or-self::*
208 [last() - 1 > position()]
209 /preceding-sibling::xsl:variable | ."/>
211 <variable name=
"pattern">
212 <call-template name=
"coord-pattern">
213 <with-param name=
"element" select=
"$elements[1]"/>
217 <variable name=
"parent-pattern">
218 <call-template name=
"coord-pattern">
219 <with-param name=
"element" select=
"$elements[1]/.."/>
223 <XSL:for-each select=
"{$parent-pattern}/*">
224 <XSL:if test=
"count({$pattern} | .) = 1">
225 <variable name=
"is-xsl">
226 <call-template name=
"is-xsl">
227 <with-param name=
"element" select=
"$elements[1]"/>
231 <when test=
"$is-xsl = 'true'">
232 <apply-templates mode=
"copy-xsl" select=
"$elements[1]"/>
233 <if test=
"$elements[2]">
234 <call-template name=
"create-context">
235 <with-param name=
"elements" select=
"$elements[position() > 1]"/>
241 <apply-templates select=
"@*"/>
243 <XSL:apply-templates select=
"node()"/>
252 <template name=
"before">
253 <param name=
"string"/>
254 <param name=
"target"/>
256 <variable name=
"apos">'
</variable>
257 <variable name=
"quot">"</variable>
259 <variable name="posapos
" select="string-length(substring-before(
260 concat($string, $apos), $apos))
"/>
261 <variable name="posquot
" select="string-length(substring-before(
262 concat($string, $quot), $quot))
"/>
263 <variable name="postarg
" select="string-length(substring-before(
264 concat($string, $target), $target))
"/>
267 <when test="$posapos = $postarg and $posquot = $postarg
">
268 <value-of select="$string
"/>
270 <when test="$posapos
> $postarg and $posquot
> $postarg"
>
271 <value-of select=
"substring($string, 1, $postarg)"/>
274 <variable name=
"delim">
276 <when test=
"$posquot > $posapos">'
</when>
277 <otherwise>"</otherwise>
281 <value-of select="substring-before($string, $delim)
"/>
282 <value-of select="$delim
"/>
284 <variable name="mid
" select="substring-after($string, $delim)
"/>
287 <when test="contains($mid, $delim)
">
288 <value-of select="substring-before($mid, $delim)
"/>
289 <value-of select="$delim
"/>
291 <call-template name="before
">
292 <with-param name="string
"
293 select="substring-after($mid, $delim)
"/>
294 <with-param name="target
"
299 <value-of select="$mid
"/>
306 <template name="avt
">
307 <param name="string
" select=".
"/>
309 <variable name="before1
" select="substring-before(concat($string, '{'), '{')
"/>
310 <variable name="len1
" select="string-length($before1)
"/>
312 <variable name="before2
" select="substring-before(concat($string, '}}'), '}}')
"/>
313 <variable name="len2
" select="string-length($before2)
"/>
316 <when test="$before1 = $string and $before2 = $string
">
317 <value-of select="$string
"/>
319 <when test="$len2
< $len1
">
320 <value-of select="$before2
"/>
322 <call-template name="avt
">
323 <with-param name="string
" select="substring($string, $len2 +
3)
"/>
326 <when test="substring($string, $len1 +
2,
1) = '{'
">
327 <value-of select="$before1
"/>
329 <call-template name="avt
">
330 <with-param name="string
" select="substring($string, $len1 +
3)
"/>
334 <variable name="mid
" select="substring($string, $len1 +
2)
"/>
335 <variable name="expr
">
336 <call-template name="before
">
337 <with-param name="string
" select="$mid
"/>
338 <with-param name="target
">}</with-param>
341 <value-of select="$before1
"/>
342 <XSL:copy-of select="{$expr}
"/>
343 <call-template name="avt
">
344 <with-param name="string
" select="substring($mid, string-length($expr) +
2)
"/>