1 # $Id: xslt.rnc,v 1.2 2003/08/30 08:09:03 jjc Exp $
3 # This was mostly generated from the syntax summary in the XSLT
4 # Recommendation (using XSLT of course).
6 # Issues: this validates extension elements as literal result
7 # elements, which is overly restrictive.
10 default
namespace xsl
= "http://www.w3.org/1999/XSL/Transform"
15 | literal-result-
element-as-stylesheet
17 top-level-elements
.model
=
18 (top-level-
element.category | top-level-extension)*
20 element * - (xsl:* | local:*)
{
29 template
.model
= (instruction
.category | literal-result-
element | text)*
30 literal-result-
element-as-stylesheet
=
32 attribute xsl:version
{ version
},
33 literal-result-
element-no-version
.atts,
36 literal-result-
element =
37 element * - xsl:*
{ literal-result-
element.atts, template
.model
}
38 literal-result-
element.atts
=
39 literal-result-
element-no-version
.atts,
40 attribute xsl:version
{ version
}?
41 literal-result-
element-no-version
.atts
=
42 (attribute * - xsl:*
{ avt
.datatype
}
43 | attribute xsl:extension-
element-prefixes
{ prefixes
.datatype
}
44 | attribute xsl:exclude-result-prefixes
{ prefixes
.datatype
}
45 | attribute xsl:use-attribute-sets
{ qnames
.datatype
})*
46 top-level-
element.category
=
49 | preserve-space
.element
51 |
namespace-alias
.element
52 | attribute-set
.element
56 | decimal-format
.element
58 instruction
.category
=
59 apply-templates
.element
60 | apply-imports
.element
61 | call-template
.element
65 | processing-instruction
.element
77 extension
.atts
= attribute * - (xsl:* | local:*)
{ text
}*
78 stylesheet
.element = element stylesheet
{ stylesheet
.model
}
79 transform
.element = element transform
{ stylesheet
.model
}
82 attribute id
{ xsd:NCName
}?,
83 attribute extension-
element-prefixes
{ prefixes
.datatype
}?,
84 attribute exclude-result-prefixes
{ prefixes
.datatype
}?,
85 attribute version
{ version
},
86 (import
.element*, top-level-elements
.model)
90 attribute href
{ xsd:anyURI
}
95 attribute href
{ xsd:anyURI
}
100 attribute elements
{ wildcards
.datatype
}
102 preserve-space
.element =
103 element preserve-space
{
105 attribute elements
{ wildcards
.datatype
}
110 attribute match
{ pattern
.datatype
}?,
111 attribute name
{ qname
.datatype
}?,
112 attribute priority
{ number
.datatype
}?,
113 attribute mode
{ qname
.datatype
}?,
114 (param
.element*, template
.model)
116 apply-templates
.element =
117 element apply-templates
{
119 attribute select
{ expression
.datatype
}?,
120 attribute mode
{ qname
.datatype
}?,
121 (sort
.element | with-param
.element)*
123 apply-imports
.element = element apply-imports
{ extension
.atts
}
124 call-template
.element =
125 element call-template
{
127 attribute name
{ qname
.datatype
},
130 namespace-alias
.element =
131 element namespace-alias
{
133 attribute stylesheet-prefix
{ prefix
.datatype
},
134 attribute result-prefix
{ prefix
.datatype
}
139 attribute name
{ qname
.datatype | expr-avt
.datatype
},
140 attribute
namespace { xsd:anyURI | brace-avt
.datatype
}?,
141 attribute use-attribute-sets
{ qnames
.datatype
}?,
147 attribute name
{ qname
.datatype | expr-avt
.datatype
},
148 attribute
namespace { xsd:anyURI | brace-avt
.datatype
}?,
151 attribute-set
.element =
152 element attribute-set
{
154 attribute name
{ qname
.datatype
},
155 attribute use-attribute-sets
{ qnames
.datatype
}?,
161 attribute disable-output-escaping
{
162 xsd:string
"yes" | xsd:string
"no"
166 processing-instruction
.element =
167 element processing-instruction
{
169 attribute name
{ xsd:NCName | expr-avt
.datatype
},
172 comment
.element = element comment
{ extension
.atts, template
.model
}
176 attribute use-attribute-sets
{ qnames
.datatype
}?,
182 attribute select
{ expression
.datatype
},
183 attribute disable-output-escaping
{
184 xsd:string
"yes" | xsd:string
"no"
191 xsd:string
"single" | xsd:string
"multiple" | xsd:string
"any"
193 attribute count
{ pattern
.datatype
}?,
194 attribute from
{ pattern
.datatype
}?,
195 attribute value
{ expression
.datatype
}?,
196 attribute format
{ avt
.datatype
}?,
197 attribute lang
{ xsd:NMTOKEN | expr-avt
.datatype
}?,
198 attribute letter-value
{
199 xsd:string
"alphabetic"
200 | xsd:string
"traditional"
203 attribute grouping-separator
{ char
.datatype | expr-avt
.datatype
}?,
204 attribute grouping-size
{ number
.datatype | expr-avt
.datatype
}?
209 attribute select
{ expression
.datatype
},
210 (sort
.element*, template
.model)
215 attribute test
{ expression
.datatype
},
219 element choose
{ extension
.atts, (when
.element+, otherwise
.element?)
}
223 attribute test
{ expression
.datatype
},
226 otherwise
.element = element otherwise
{ extension
.atts, template
.model
}
230 attribute select
{ expression
.datatype
}?,
231 attribute lang
{ xsd:NMTOKEN | expr-avt
.datatype
}?,
232 attribute data-type
{
234 | xsd:string
"number"
235 | qname-but-not-ncname
.datatype
239 xsd:string
"ascending"
240 | xsd:string
"descending"
243 attribute case-order
{
244 xsd:string
"upper-first"
245 | xsd:string
"lower-first"
252 attribute name
{ qname
.datatype
},
253 (attribute select
{ expression
.datatype
}
259 attribute name
{ qname
.datatype
},
260 (attribute select
{ expression
.datatype
}
266 attribute select
{ expression
.datatype
}
271 attribute name
{ qname
.datatype
},
272 (attribute select
{ expression
.datatype
}
278 attribute name
{ qname
.datatype
},
279 attribute match
{ pattern
.datatype
},
280 attribute use
{ expression
.datatype
}
282 decimal-format
.element =
283 element decimal-format
{
285 attribute name
{ qname
.datatype
}?,
286 attribute decimal-separator
{ char
.datatype
}?,
287 attribute grouping-separator
{ char
.datatype
}?,
288 attribute infinity
{ text
}?,
289 attribute minus-sign
{ char
.datatype
}?,
290 attribute NaN
{ text
}?,
291 attribute percent
{ char
.datatype
}?,
292 attribute per-mille
{ char
.datatype
}?,
293 attribute zero-digit
{ char
.datatype
}?,
294 attribute digit
{ char
.datatype
}?,
295 attribute pattern-separator
{ char
.datatype
}?
300 attribute terminate
{ xsd:string
"yes" | xsd:string
"no" }?,
303 fallback
.element = element fallback
{ extension
.atts, template
.model
}
311 | qname-but-not-ncname
.datatype
313 attribute version
{ xsd:NMTOKEN
}?,
314 attribute encoding
{ text
}?,
315 attribute omit-xml-declaration
{
316 xsd:string
"yes" | xsd:string
"no"
318 attribute standalone
{ xsd:string
"yes" | xsd:string
"no" }?,
319 attribute doctype-public
{ text
}?,
320 attribute doctype-system
{ text
}?,
321 attribute cdata-section-elements
{ qnames
.datatype
}?,
322 attribute indent
{ xsd:string
"yes" | xsd:string
"no" }?,
323 attribute media-type
{ text
}?
325 prefixes
.datatype
= list { (xsd:NCName |
"#default")*
}
326 prefix
.datatype
= xsd:NCName |
"#default"
330 | xsd:token
{ pattern
= "\*|\i\c*:\*" })*
332 qname
.datatype
= xsd:QName
333 qnames
.datatype
= list { xsd:QName*
}
334 char
.datatype
= xsd:string
{ length
= "1" }
335 number
.datatype
= xsd:decimal
336 expression
.datatype
= text
337 pattern
.datatype
= text
338 qname-but-not-ncname
.datatype
= xsd:QName
{ pattern
= ".*:.*" }
339 # An AVT containing at least one expression.
343 """([^\{\}]|\{\{|\}\})*\{([^"'\{\}]|"[^"]*"|'[^
']*')
+\
}(
[^\
{\
}]|\
{\
{|\
}\
}|\
{(
[^
"'\{\}]|"[^
"]*"|
'[^']*
')+\})*"""
345 # An AVT containing at least one brace; ie where instantiated AVT
346 # is not the same as the literal AVT.
350 """[^\{\}]*(\{\{|\}\}|\{([^"'\
{\
}]|
"[^"]*
"|'[^']*')+\})([^\{\}]|\{\{|\}\}|\{([^"'\{\}]|"[^"]*"|'[^
']*')
+\
})*
"""
355 """(
[^\
{\
}]|\
{\
{|\
}\
}|\
{(
[^
"'\{\}]|"[^
"]*"|
'[^']*
')+\})*"""