Mercurial > emacs
annotate etc/schema/xslt.rnc @ 105164:ed1ef7720126
*** empty log message ***
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Wed, 23 Sep 2009 23:21:47 +0000 |
parents | bb94fc610c9f |
children |
rev | line source |
---|---|
99427
bb94fc610c9f
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
1 # Copyright (C) 2001-2008 World Wide Web Consortium, (Massachusetts |
bb94fc610c9f
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
2 # Institute of Technology, European Research Consortium for |
bb94fc610c9f
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
3 # Informatics and Mathematics, Keio University). All Rights Reserved. |
bb94fc610c9f
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
4 # This work is distributed under the W3C(R) Software License in the |
bb94fc610c9f
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
5 # hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
bb94fc610c9f
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
6 # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
bb94fc610c9f
Add copyright notice.
Chong Yidong <cyd@stupidchicken.com>
parents:
86361
diff
changeset
|
7 # PURPOSE. |
86361 | 8 |
9 # This was mostly generated from the syntax summary in the XSLT | |
10 # Recommendation (using XSLT of course). | |
11 | |
12 # Issues: this validates extension elements as literal result | |
13 # elements, which is overly restrictive. | |
14 | |
15 namespace local = "" | |
16 default namespace xsl = "http://www.w3.org/1999/XSL/Transform" | |
17 | |
18 start = | |
19 stylesheet.element | |
20 | transform.element | |
21 | literal-result-element-as-stylesheet | |
22 version = "1.0" | |
23 top-level-elements.model = | |
24 (top-level-element.category | top-level-extension)* | |
25 top-level-extension = | |
26 element * - (xsl:* | local:*) { | |
27 grammar { | |
28 start = any | |
29 any = | |
30 (attribute * { text } | |
31 | text | |
32 | element * { any })* | |
33 } | |
34 } | |
35 template.model = (instruction.category | literal-result-element | text)* | |
36 literal-result-element-as-stylesheet = | |
37 element * - xsl:* { | |
38 attribute xsl:version { version }, | |
39 literal-result-element-no-version.atts, | |
40 template.model | |
41 } | |
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 = | |
53 include.element | |
54 | strip-space.element | |
55 | preserve-space.element | |
56 | template.element | |
57 | namespace-alias.element | |
58 | attribute-set.element | |
59 | variable.element | |
60 | param.element | |
61 | key.element | |
62 | decimal-format.element | |
63 | output.element | |
64 instruction.category = | |
65 apply-templates.element | |
66 | apply-imports.element | |
67 | call-template.element | |
68 | element.element | |
69 | attribute.element | |
70 | text.element | |
71 | processing-instruction.element | |
72 | comment.element | |
73 | copy.element | |
74 | value-of.element | |
75 | number.element | |
76 | for-each.element | |
77 | if.element | |
78 | choose.element | |
79 | variable.element | |
80 | copy-of.element | |
81 | message.element | |
82 | fallback.element | |
83 extension.atts = attribute * - (xsl:* | local:*) { text }* | |
84 stylesheet.element = element stylesheet { stylesheet.model } | |
85 transform.element = element transform { stylesheet.model } | |
86 stylesheet.model = | |
87 extension.atts, | |
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) | |
93 include.element = | |
94 element include { | |
95 extension.atts, | |
96 attribute href { xsd:anyURI } | |
97 } | |
98 import.element = | |
99 element import { | |
100 extension.atts, | |
101 attribute href { xsd:anyURI } | |
102 } | |
103 strip-space.element = | |
104 element strip-space { | |
105 extension.atts, | |
106 attribute elements { wildcards.datatype } | |
107 } | |
108 preserve-space.element = | |
109 element preserve-space { | |
110 extension.atts, | |
111 attribute elements { wildcards.datatype } | |
112 } | |
113 template.element = | |
114 element template { | |
115 extension.atts, | |
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) | |
121 } | |
122 apply-templates.element = | |
123 element apply-templates { | |
124 extension.atts, | |
125 attribute select { expression.datatype }?, | |
126 attribute mode { qname.datatype }?, | |
127 (sort.element | with-param.element)* | |
128 } | |
129 apply-imports.element = element apply-imports { extension.atts } | |
130 call-template.element = | |
131 element call-template { | |
132 extension.atts, | |
133 attribute name { qname.datatype }, | |
134 with-param.element* | |
135 } | |
136 namespace-alias.element = | |
137 element namespace-alias { | |
138 extension.atts, | |
139 attribute stylesheet-prefix { prefix.datatype }, | |
140 attribute result-prefix { prefix.datatype } | |
141 } | |
142 element.element = | |
143 element element { | |
144 extension.atts, | |
145 attribute name { qname.datatype | expr-avt.datatype }, | |
146 attribute namespace { xsd:anyURI | brace-avt.datatype }?, | |
147 attribute use-attribute-sets { qnames.datatype }?, | |
148 template.model | |
149 } | |
150 attribute.element = | |
151 element attribute { | |
152 extension.atts, | |
153 attribute name { qname.datatype | expr-avt.datatype }, | |
154 attribute namespace { xsd:anyURI | brace-avt.datatype }?, | |
155 template.model | |
156 } | |
157 attribute-set.element = | |
158 element attribute-set { | |
159 extension.atts, | |
160 attribute name { qname.datatype }, | |
161 attribute use-attribute-sets { qnames.datatype }?, | |
162 attribute.element* | |
163 } | |
164 text.element = | |
165 element text { | |
166 extension.atts, | |
167 attribute disable-output-escaping { | |
168 xsd:string "yes" | xsd:string "no" | |
169 }?, | |
170 text | |
171 } | |
172 processing-instruction.element = | |
173 element processing-instruction { | |
174 extension.atts, | |
175 attribute name { xsd:NCName | expr-avt.datatype }, | |
176 template.model | |
177 } | |
178 comment.element = element comment { extension.atts, template.model } | |
179 copy.element = | |
180 element copy { | |
181 extension.atts, | |
182 attribute use-attribute-sets { qnames.datatype }?, | |
183 template.model | |
184 } | |
185 value-of.element = | |
186 element value-of { | |
187 extension.atts, | |
188 attribute select { expression.datatype }, | |
189 attribute disable-output-escaping { | |
190 xsd:string "yes" | xsd:string "no" | |
191 }? | |
192 } | |
193 number.element = | |
194 element number { | |
195 extension.atts, | |
196 attribute level { | |
197 xsd:string "single" | xsd:string "multiple" | xsd:string "any" | |
198 }?, | |
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" | |
207 | expr-avt.datatype | |
208 }?, | |
209 attribute grouping-separator { char.datatype | expr-avt.datatype }?, | |
210 attribute grouping-size { number.datatype | expr-avt.datatype }? | |
211 } | |
212 for-each.element = | |
213 element for-each { | |
214 extension.atts, | |
215 attribute select { expression.datatype }, | |
216 (sort.element*, template.model) | |
217 } | |
218 if.element = | |
219 element if { | |
220 extension.atts, | |
221 attribute test { expression.datatype }, | |
222 template.model | |
223 } | |
224 choose.element = | |
225 element choose { extension.atts, (when.element+, otherwise.element?) } | |
226 when.element = | |
227 element when { | |
228 extension.atts, | |
229 attribute test { expression.datatype }, | |
230 template.model | |
231 } | |
232 otherwise.element = element otherwise { extension.atts, template.model } | |
233 sort.element = | |
234 element sort { | |
235 extension.atts, | |
236 attribute select { expression.datatype }?, | |
237 attribute lang { xsd:NMTOKEN | expr-avt.datatype }?, | |
238 attribute data-type { | |
239 xsd:string "text" | |
240 | xsd:string "number" | |
241 | qname-but-not-ncname.datatype | |
242 | expr-avt.datatype | |
243 }?, | |
244 attribute order { | |
245 xsd:string "ascending" | |
246 | xsd:string "descending" | |
247 | expr-avt.datatype | |
248 }?, | |
249 attribute case-order { | |
250 xsd:string "upper-first" | |
251 | xsd:string "lower-first" | |
252 | expr-avt.datatype | |
253 }? | |
254 } | |
255 variable.element = | |
256 element variable { | |
257 extension.atts, | |
258 attribute name { qname.datatype }, | |
259 (attribute select { expression.datatype } | |
260 | template.model) | |
261 } | |
262 param.element = | |
263 element param { | |
264 extension.atts, | |
265 attribute name { qname.datatype }, | |
266 (attribute select { expression.datatype } | |
267 | template.model) | |
268 } | |
269 copy-of.element = | |
270 element copy-of { | |
271 extension.atts, | |
272 attribute select { expression.datatype } | |
273 } | |
274 with-param.element = | |
275 element with-param { | |
276 extension.atts, | |
277 attribute name { qname.datatype }, | |
278 (attribute select { expression.datatype } | |
279 | template.model) | |
280 } | |
281 key.element = | |
282 element key { | |
283 extension.atts, | |
284 attribute name { qname.datatype }, | |
285 attribute match { pattern.datatype }, | |
286 attribute use { expression.datatype } | |
287 } | |
288 decimal-format.element = | |
289 element decimal-format { | |
290 extension.atts, | |
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 }? | |
302 } | |
303 message.element = | |
304 element message { | |
305 extension.atts, | |
306 attribute terminate { xsd:string "yes" | xsd:string "no" }?, | |
307 template.model | |
308 } | |
309 fallback.element = element fallback { extension.atts, template.model } | |
310 output.element = | |
311 element output { | |
312 extension.atts, | |
313 attribute method { | |
314 xsd:string "xml" | |
315 | xsd:string "html" | |
316 | xsd:string "text" | |
317 | qname-but-not-ncname.datatype | |
318 }?, | |
319 attribute version { xsd:NMTOKEN }?, | |
320 attribute encoding { text }?, | |
321 attribute omit-xml-declaration { | |
322 xsd:string "yes" | xsd:string "no" | |
323 }?, | |
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 }? | |
330 } | |
331 prefixes.datatype = list { (xsd:NCName | "#default")* } | |
332 prefix.datatype = xsd:NCName | "#default" | |
333 wildcards.datatype = | |
334 list { | |
335 (xsd:QName | |
336 | xsd:token { pattern = "\*|\i\c*:\*" })* | |
337 } | |
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. | |
346 expr-avt.datatype = | |
347 xsd:string { | |
348 pattern = | |
349 """([^\{\}]|\{\{|\}\})*\{([^"'\{\}]|"[^"]*"|'[^']*')+\}([^\{\}]|\{\{|\}\}|\{([^"'\{\}]|"[^"]*"|'[^']*')+\})*""" | |
350 } | |
351 # An AVT containing at least one brace; ie where instantiated AVT | |
352 # is not the same as the literal AVT. | |
353 brace-avt.datatype = | |
354 xsd:string { | |
355 pattern = | |
356 """[^\{\}]*(\{\{|\}\}|\{([^"'\{\}]|"[^"]*"|'[^']*')+\})([^\{\}]|\{\{|\}\}|\{([^"'\{\}]|"[^"]*"|'[^']*')+\})*""" | |
357 } | |
358 avt.datatype = | |
359 xsd:string { | |
360 pattern = | |
361 """([^\{\}]|\{\{|\}\}|\{([^"'\{\}]|"[^"]*"|'[^']*')+\})*""" | |
362 } |