1 # Copyright (C) 2001-2008 World Wide Web Consortium, (Massachusetts
2 # Institute of Technology, European Research Consortium for
3 # Informatics and Mathematics, Keio University). All Rights Reserved.
4 # This work is distributed under the W3C(R) Software License in the
5 # hope that it will be useful, but WITHOUT ANY WARRANTY; without even
6 # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9 # This was mostly generated from the syntax summary in the XSLT
10 # Recommendation (using XSLT of course).
12 # Issues: this validates extension elements as literal result
13 # elements, which is overly restrictive.
16 default
namespace xsl
= "http://www.w3.org/1999/XSL/Transform"
21 | literal-result-
element-as-stylesheet
23 top-level-elements
.model
=
24 (top-level-
element.category | top-level-extension)*
26 element * - (xsl:* | local:*)
{
35 template
.model
= (instruction
.category | literal-result-
element | text)*
36 literal-result-
element-as-stylesheet
=
38 attribute xsl:version
{ version
},
39 literal-result-
element-no-version
.atts,
42 literal-result-
element =
43 element * - xsl:*
{ literal-result-
element.atts, template
.model
}
44 literal-result-
element.atts
=
45 literal-result-
element-no-version
.atts,
46 attribute xsl:version
{ version
}?
47 literal-result-
element-no-version
.atts
=
48 (attribute * - xsl:*
{ avt
.datatype
}
49 | attribute xsl:extension-
element-prefixes
{ prefixes
.datatype
}
50 | attribute xsl:exclude-result-prefixes
{ prefixes
.datatype
}
51 | attribute xsl:use-attribute-sets
{ qnames
.datatype
})*
52 top-level-
element.category
=
55 | preserve-space
.element
57 |
namespace-alias
.element
58 | attribute-set
.element
62 | decimal-format
.element
64 instruction
.category
=
65 apply-templates
.element
66 | apply-imports
.element
67 | call-template
.element
71 | processing-instruction
.element
83 extension
.atts
= attribute * - (xsl:* | local:*)
{ text
}*
84 stylesheet
.element = element stylesheet
{ stylesheet
.model
}
85 transform
.element = element transform
{ stylesheet
.model
}
88 attribute id
{ xsd:NCName
}?,
89 attribute extension-
element-prefixes
{ prefixes
.datatype
}?,
90 attribute exclude-result-prefixes
{ prefixes
.datatype
}?,
91 attribute version
{ version
},
92 (import
.element*, top-level-elements
.model)
96 attribute href
{ xsd:anyURI
}
101 attribute href
{ xsd:anyURI
}
103 strip-space
.element =
104 element strip-space
{
106 attribute elements
{ wildcards
.datatype
}
108 preserve-space
.element =
109 element preserve-space
{
111 attribute elements
{ wildcards
.datatype
}
116 attribute match
{ pattern
.datatype
}?,
117 attribute name
{ qname
.datatype
}?,
118 attribute priority
{ number
.datatype
}?,
119 attribute mode
{ qname
.datatype
}?,
120 (param
.element*, template
.model)
122 apply-templates
.element =
123 element apply-templates
{
125 attribute select
{ expression
.datatype
}?,
126 attribute mode
{ qname
.datatype
}?,
127 (sort
.element | with-param
.element)*
129 apply-imports
.element = element apply-imports
{ extension
.atts
}
130 call-template
.element =
131 element call-template
{
133 attribute name
{ qname
.datatype
},
136 namespace-alias
.element =
137 element namespace-alias
{
139 attribute stylesheet-prefix
{ prefix
.datatype
},
140 attribute result-prefix
{ prefix
.datatype
}
145 attribute name
{ qname
.datatype | expr-avt
.datatype
},
146 attribute
namespace { xsd:anyURI | brace-avt
.datatype
}?,
147 attribute use-attribute-sets
{ qnames
.datatype
}?,
153 attribute name
{ qname
.datatype | expr-avt
.datatype
},
154 attribute
namespace { xsd:anyURI | brace-avt
.datatype
}?,
157 attribute-set
.element =
158 element attribute-set
{
160 attribute name
{ qname
.datatype
},
161 attribute use-attribute-sets
{ qnames
.datatype
}?,
167 attribute disable-output-escaping
{
168 xsd:string
"yes" | xsd:string
"no"
172 processing-instruction
.element =
173 element processing-instruction
{
175 attribute name
{ xsd:NCName | expr-avt
.datatype
},
178 comment
.element = element comment
{ extension
.atts, template
.model
}
182 attribute use-attribute-sets
{ qnames
.datatype
}?,
188 attribute select
{ expression
.datatype
},
189 attribute disable-output-escaping
{
190 xsd:string
"yes" | xsd:string
"no"
197 xsd:string
"single" | xsd:string
"multiple" | xsd:string
"any"
199 attribute count
{ pattern
.datatype
}?,
200 attribute from
{ pattern
.datatype
}?,
201 attribute value
{ expression
.datatype
}?,
202 attribute format
{ avt
.datatype
}?,
203 attribute lang
{ xsd:NMTOKEN | expr-avt
.datatype
}?,
204 attribute letter-value
{
205 xsd:string
"alphabetic"
206 | xsd:string
"traditional"
209 attribute grouping-separator
{ char
.datatype | expr-avt
.datatype
}?,
210 attribute grouping-size
{ number
.datatype | expr-avt
.datatype
}?
215 attribute select
{ expression
.datatype
},
216 (sort
.element*, template
.model)
221 attribute test
{ expression
.datatype
},
225 element choose
{ extension
.atts, (when
.element+, otherwise
.element?)
}
229 attribute test
{ expression
.datatype
},
232 otherwise
.element = element otherwise
{ extension
.atts, template
.model
}
236 attribute select
{ expression
.datatype
}?,
237 attribute lang
{ xsd:NMTOKEN | expr-avt
.datatype
}?,
238 attribute data-type
{
240 | xsd:string
"number"
241 | qname-but-not-ncname
.datatype
245 xsd:string
"ascending"
246 | xsd:string
"descending"
249 attribute case-order
{
250 xsd:string
"upper-first"
251 | xsd:string
"lower-first"
258 attribute name
{ qname
.datatype
},
259 (attribute select
{ expression
.datatype
}
265 attribute name
{ qname
.datatype
},
266 (attribute select
{ expression
.datatype
}
272 attribute select
{ expression
.datatype
}
277 attribute name
{ qname
.datatype
},
278 (attribute select
{ expression
.datatype
}
284 attribute name
{ qname
.datatype
},
285 attribute match
{ pattern
.datatype
},
286 attribute use
{ expression
.datatype
}
288 decimal-format
.element =
289 element decimal-format
{
291 attribute name
{ qname
.datatype
}?,
292 attribute decimal-separator
{ char
.datatype
}?,
293 attribute grouping-separator
{ char
.datatype
}?,
294 attribute infinity
{ text
}?,
295 attribute minus-sign
{ char
.datatype
}?,
296 attribute NaN
{ text
}?,
297 attribute percent
{ char
.datatype
}?,
298 attribute per-mille
{ char
.datatype
}?,
299 attribute zero-digit
{ char
.datatype
}?,
300 attribute digit
{ char
.datatype
}?,
301 attribute pattern-separator
{ char
.datatype
}?
306 attribute terminate
{ xsd:string
"yes" | xsd:string
"no" }?,
309 fallback
.element = element fallback
{ extension
.atts, template
.model
}
317 | qname-but-not-ncname
.datatype
319 attribute version
{ xsd:NMTOKEN
}?,
320 attribute encoding
{ text
}?,
321 attribute omit-xml-declaration
{
322 xsd:string
"yes" | xsd:string
"no"
324 attribute standalone
{ xsd:string
"yes" | xsd:string
"no" }?,
325 attribute doctype-public
{ text
}?,
326 attribute doctype-system
{ text
}?,
327 attribute cdata-section-elements
{ qnames
.datatype
}?,
328 attribute indent
{ xsd:string
"yes" | xsd:string
"no" }?,
329 attribute media-type
{ text
}?
331 prefixes
.datatype
= list { (xsd:NCName |
"#default")*
}
332 prefix
.datatype
= xsd:NCName |
"#default"
336 | xsd:token
{ pattern
= "\*|\i\c*:\*" })*
338 qname
.datatype
= xsd:QName
339 qnames
.datatype
= list { xsd:QName*
}
340 char
.datatype
= xsd:string
{ length
= "1" }
341 number
.datatype
= xsd:decimal
342 expression
.datatype
= text
343 pattern
.datatype
= text
344 qname-but-not-ncname
.datatype
= xsd:QName
{ pattern
= ".*:.*" }
345 # An AVT containing at least one expression.
349 """([^\{\}]|\{\{|\}\})*\{([^"'\{\}]|"[^"]*"|'[^
']*')
+\
}(
[^\
{\
}]|\
{\
{|\
}\
}|\
{(
[^
"'\{\}]|"[^
"]*"|
'[^']*
')+\})*"""
351 # An AVT containing at least one brace; ie where instantiated AVT
352 # is not the same as the literal AVT.
356 """[^\{\}]*(\{\{|\}\}|\{([^"'\
{\
}]|
"[^"]*
"|'[^']*')+\})([^\{\}]|\{\{|\}\}|\{([^"'\{\}]|"[^"]*"|'[^
']*')
+\
})*
"""
361 """(
[^\
{\
}]|\
{\
{|\
}\
}|\
{(
[^
"'\{\}]|"[^
"]*"|
'[^']*
')+\})*"""