1 datatypes w = "http://whattf.org/datatype-draft"
3 # #####################################################################
4 ## RELAX NG Schema for HTML 5: Global Structure & Metadata #
5 # #####################################################################
7 ## Root Element: <html>
10 element html { html.inner & html.attrs }
13 & ( common.attrs.aria.role.presentation
14 | common.attrs.aria.role.menuitem
22 ## Metadata Container: <head>
25 element head { head.inner & head.attrs }
28 # & head.attrs.profile?
29 & ( common.attrs.aria.role.presentation
30 | common.attrs.aria.role.menuitem
33 # head.attrs.profile =
35 # common.data.uris #REVISIT should these be absolute (zero or more)
39 & base.elem? # REVISIT need a non-schema checker or Schematron
40 & common.inner.metadata # Limit encoding decl position in Schematron
43 # ( meta.elem.encoding?
45 # & base.elem? # REVISIT need a non-schema checker or Schematron
46 # & common.inner.metadata
50 ## Content Container: <body>
53 element body { body.inner & body.attrs }
56 & ( common.attrs.aria.landmark.application
57 | common.attrs.aria.landmark.document
58 | common.attrs.aria.role.presentation
59 | common.attrs.aria.implicit.document
61 & body.attrs.onafterprint?
62 & body.attrs.onbeforeprint?
63 & body.attrs.onbeforeunload?
64 & body.attrs.onhashchange?
65 & body.attrs.onmessage?
66 & body.attrs.onoffline?
67 & body.attrs.ononline?
68 & body.attrs.onpagehide?
69 & body.attrs.onpageshow?
70 & body.attrs.onpopstate?
71 & body.attrs.onresize?
72 & body.attrs.onstorage?
73 & body.attrs.onunload?
78 body.attrs.onafterprint =
79 attribute onafterprint { common.data.functionbody }
80 body.attrs.onbeforeprint =
81 attribute onbeforeprint { common.data.functionbody }
82 body.attrs.onbeforeunload =
83 attribute onbeforeunload { common.data.functionbody }
84 body.attrs.onhashchange =
85 attribute onhashchange { common.data.functionbody }
86 body.attrs.onmessage =
87 attribute onmessage { common.data.functionbody }
88 body.attrs.onoffline =
89 attribute onoffline { common.data.functionbody }
91 attribute ononline { common.data.functionbody }
92 body.attrs.onpopstate =
93 attribute onpopstate { common.data.functionbody }
94 body.attrs.onpagehide =
95 attribute onpagehide { common.data.functionbody }
96 body.attrs.onpageshow =
97 attribute onpageshow { common.data.functionbody }
99 attribute onredo { common.data.functionbody }
100 body.attrs.onresize =
101 attribute onresize { common.data.functionbody }
102 body.attrs.onstorage =
103 attribute onstorage { common.data.functionbody }
105 attribute onundo { common.data.functionbody }
106 body.attrs.onunload =
107 attribute onunload { common.data.functionbody }
109 ## Document Title: <title>
112 element title { title.inner & title.attrs }
115 & ( common.attrs.aria.role.presentation
116 | common.attrs.aria.role.menuitem
125 element base { base.inner & base.attrs }
129 & common.attrs.present
131 & ( ( base.attrs.href
136 & ( common.attrs.aria.role.presentation
137 | common.attrs.aria.role.menuitem
146 common.data.browsing-context-or-keyword
151 ## Global Relationships: <link>
154 element link { link.inner & link.attrs }
158 & common.attrs.present
162 & shared-hyperlink.attrs.hreflang?
163 & shared-hyperlink.attrs.media?
164 & shared-hyperlink.attrs.type?
166 # link.attrs.title included in common.attrs
167 & embedded.content.attrs.crossorigin?
168 & ( common.attrs.aria.role.link
169 | common.attrs.aria.role.presentation
170 | common.attrs.aria.role.menuitem
175 common.data.uri.non-empty
183 w:string "any" | common.data.sizes
188 common.elem.metadata |= link.elem
190 ## Global Style: <style>
193 element style { style.inner & style.attrs }
198 # style.attrs.title included in common.attrs
199 & ( common.attrs.aria.role.presentation
200 | common.attrs.aria.role.menuitem
209 common.data.mediaquery
212 ( common.inner.anything )
214 common.elem.metadata |= style.elem
216 ## Scoped Style: <style scoped>
219 element style { style.inner & style.scoped.attrs }
225 # style.attrs.title included in common.attrs
226 & ( common.attrs.aria.role.presentation
227 | common.attrs.aria.role.menuitem
232 w:string "scoped" | w:string ""
235 ## Name-Value Metadata: <meta name>
238 element meta { meta.inner & meta.name.attrs }
242 & common.attrs.present
244 & meta.name.attrs.name
245 & meta.name.attrs.content
246 & ( common.attrs.aria.role.presentation
247 | common.attrs.aria.role.menuitem
250 meta.name.attrs.name =
254 meta.name.attrs.content =
261 common.elem.metadata |= meta.name.elem
263 ## "refresh" pragma directive: <meta http-equiv='refresh'>
265 meta.http-equiv.refresh.elem =
266 element meta { meta.inner & meta.http-equiv.refresh.attrs }
267 meta.http-equiv.refresh.attrs =
270 & common.attrs.present
272 & meta.http-equiv.attrs.http-equiv.refresh
273 & meta.http-equiv.attrs.content.refresh
274 & ( common.attrs.aria.role.presentation
275 | common.attrs.aria.role.menuitem
278 meta.http-equiv.attrs.http-equiv.refresh =
279 attribute http-equiv {
282 meta.http-equiv.attrs.content.refresh =
286 common.elem.metadata |= meta.http-equiv.refresh.elem # not quite right per spec
287 # if the definition is
288 # reused in another language
290 ## "default-style" pragma directive: <meta http-equiv='default-style'>
292 meta.http-equiv.default-style.elem =
293 element meta { meta.inner & meta.http-equiv.default-style.attrs }
294 meta.http-equiv.default-style.attrs =
297 & common.attrs.present
299 & meta.http-equiv.attrs.http-equiv.default-style
300 & meta.http-equiv.attrs.content.default-style
301 & ( common.attrs.aria.role.presentation
302 | common.attrs.aria.role.menuitem
305 meta.http-equiv.attrs.http-equiv.default-style =
306 attribute http-equiv {
307 w:string "default-style"
309 meta.http-equiv.attrs.content.default-style =
311 common.data.default-style
314 common.elem.metadata |= meta.http-equiv.default-style.elem # not quite right per spec
315 # if the definition is
316 # reused in another language
318 ## "x-ua-compatible" pragma directive: <meta http-equiv='x-ua-compatible'>
320 meta.http-equiv.x-ua-compatible.elem =
321 element meta { meta.inner & meta.http-equiv.x-ua-compatible.attrs }
322 meta.http-equiv.x-ua-compatible.attrs =
325 & common.attrs.present
327 & meta.http-equiv.attrs.http-equiv.x-ua-compatible
328 & meta.http-equiv.attrs.content.x-ua-compatible
329 & ( common.attrs.aria.role.presentation
330 | common.attrs.aria.role.menuitem
333 meta.http-equiv.attrs.http-equiv.x-ua-compatible =
334 attribute http-equiv {
335 w:string "x-ua-compatible"
337 meta.http-equiv.attrs.content.x-ua-compatible =
339 common.data.x-ua-compatible
341 common.elem.metadata |= meta.http-equiv.x-ua-compatible.elem
343 ## Inline Character Encoding Statement for HTML: <meta charset>
346 element meta { meta.inner & meta.charset.attrs }
350 & common.attrs.present
352 & meta.charset.attrs.charset
353 & ( common.attrs.aria.role.presentation
354 | common.attrs.aria.role.menuitem
357 meta.charset.attrs.charset =
359 (common.data.charset & HTMLonly)
361 pattern = "[uU][tT][fF]-8"
365 ## Inline Character Encoding Statement for HTML: <meta http-equiv='content-type'>
367 meta.http-equiv.content-type.elem =
368 element meta { meta.inner & meta.http-equiv.content-type.attrs }
370 meta.http-equiv.content-type.attrs =
373 & common.attrs.present
375 & meta.http-equiv.attrs.http-equiv.content-type
376 & meta.http-equiv.attrs.content.content-type
377 & ( common.attrs.aria.role.presentation
378 | common.attrs.aria.role.menuitem
381 meta.http-equiv.attrs.http-equiv.content-type =
382 attribute http-equiv {
383 w:string "content-type"
385 meta.http-equiv.attrs.content.content-type =
387 common.data.meta-charset
390 common.elem.metadata |= ( meta.charset.elem | meta.http-equiv.content-type.elem )