summaryrefslogtreecommitdiff
path: root/xml/relaxng/src/resources/html5-schema/html5/common.rnc
blob: 09afb1454233f0213c775fbf6710e7495a015edd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
datatypes w = "http://whattf.org/datatype-draft"

# #####################################################################
##  RELAX NG Schema for HTML 5: Common Definitions                    #
# #####################################################################


# #####################################################################
##  Language Parameters - redefine in inclusion block as necessary    #
# #####################################################################

## HTML vs. XHTML restrictions

	XMLonly = empty
	HTMLonly = notAllowed

## HTML 4 Compatibility - set to notAllowed to disallow markup introduced in HTML 5
#                         (This only affects mixed-version modules; wholly HTML5
#                          modules should simply be left out of the inclusion list.)

	v5only = empty

## HTML Compatibility Switches - set to notAllowed to disallow

	## XML features that can't be roundtripped HTML <-> XHTML
	#  (xml:base on elements other than <html>)
	nonRoundtrippable = empty

	## XML features that can't be serialized as HTML
	nonHTMLizable = empty

## features that are not part of the W3C HTML spec
	nonW3C = empty

# #####################################################################
##  Wildcards                                                         #
# #####################################################################

## Any attribute from any namespace

	common.attr.anything =
		attribute * { text }*

## Any element from any namespace

	common.elem.anything =
		element * { common.inner.anything & common.attr.anything }

## Any content from any namespace

	common.inner.anything =
		(	text
		&	common.elem.anything*
		)

# #####################################################################
##  Common Element Classes                                            #
# #####################################################################

## Metadata Elements

	common.elem.metadata =
		( notAllowed )

## Phrase Elements

	common.elem.phrasing =
		( notAllowed )

## Prose Elements

	common.elem.flow =
		( common.elem.phrasing )


# #####################################################################
##  Common Content Models                                             #
# #####################################################################

## Metadata Content

	common.inner.metadata =
		( common.elem.metadata* )

## Phrase Content

	common.inner.phrasing =
		( text & common.elem.phrasing* )

## Prose Content

	common.inner.transparent.flow =
		( text & common.elem.flow* )

	common.inner.flow =
		(	style.elem.scoped*,
			(	text
			&	common.elem.flow*
			)
		)

# #####################################################################
##  Common Attributes                                                 #
# #####################################################################

# When updating, check <bdo> definition too

common.attrs =
	(	common.attrs.basic
	&	common.attrs.i18n
	&	common.attrs.present
	&	common.attrs.other
	)

common.attrs.basic =
	(	common.attrs.id?
	&	common.attrs.class?
	&	common.attrs.title?
	&	common.attrs.base?
	&	common.attrs.space?
	)
	common.attrs.id =
		attribute id {
			common.data.id
		}
	common.attrs.class =
		attribute class {
			common.data.tokens
		}
	common.attrs.title =
		attribute title {
			text
		}
	common.attrs.base =
		common.attrs.xmlbase
		& nonRoundtrippable
	common.attrs.xmlbase =
		attribute xml:base {
			common.data.uri
		} & XMLonly
	common.attrs.space =
		common.attrs.xmlspace
	common.attrs.xmlspace =
		attribute xml:space {
			string "preserve" | string "default"
		} & XMLonly

common.attrs.i18n =
	(	common.attrs.dir?
	&	common.attrs.language?
	&	common.attrs.translate?
	)
	common.attrs.dir =
		attribute dir {
			w:string "ltr" | w:string "rtl" | w:string "auto"
		}
	# This lang definition is a hack for enviroments where
	# the HTML5 parser maps lang to xml:lang.
	# Sameness check left to Schematron
	common.attrs.language =
		(	common.attrs.xmllang?
		&	common.attrs.lang?
		)
	common.attrs.lang =
		attribute lang {
			common.data.langcode
		} & XMLonly
	common.attrs.xmllang =
		attribute xml:lang {
			common.data.langcode
		}
#	common.attrs.language =
#		(	common.attrs.lang
#		|	common.attrs.xmllang
#		)
#	common.attrs.lang =
#		attribute lang {
#			common.data.langcode
#		} & HTMLonly
#	common.attrs.xmllang =
#		attribute xml:lang {
#			common.data.langcode
#		} & XMLonly
	common.attrs.translate =
		attribute translate {
			w:string "" | w:string "yes" | w:string "no"
		}

common.attrs.present =
	(	common.attrs.style?
	&	common.attrs.tabindex?
	&	common.attrs.accesskey?
	)
	common.attrs.style =
		attribute style {
			string
		}
	common.attrs.tabindex =
		attribute tabindex {
			common.data.integer
		}
		# REVISIT move style to a module and bundle tabindex with ARIA
	common.attrs.accesskey =
		attribute accesskey {
			common.data.keylabellist
		}

common.attrs.other =
	empty

# #####################################################################
##  Common Datatypes                                                  #
# #####################################################################

## Names and Tokens

	common.data.tokens =
		list { token* }

	common.data.browsing-context =
		w:browsing-context

	common.data.browsing-context-or-keyword =
		w:browsing-context-or-keyword
#		xsd:string {
#			pattern = "()|([^_].*)|(_[bB][lL][aA][nN][kK])|(_[sS][eE][lL][fF])|(_[pP][aA][rR][eE][nN][tT])|(_[tT][oO][pP])"
#		}


## IDs and IDREFs

	common.data.id =
		w:ID
#		xsd:string {
#			pattern = "\S+"
#		}

	common.data.idref =
		w:IDREF
		
	common.data.idrefs =
		w:IDREFS

	common.data.name =
		w:ID #FIXME

	common.data.hash-name =
		w:hash-name	
#		xsd:string {
#			pattern = "#.+"
#		}

## Numerical

	common.data.integer =
		w:integer
#		xsd:string {
#			pattern = "-?[0-9]+"
#		}

	common.data.integer.positive =
		w:integer-positive
#		xsd:string {
#			pattern = "0*[1-9][0-9]*"
#		}

	common.data.integer.non-negative =
		w:integer-non-negative
#		xsd:string {
#			pattern = "[0-9]+"
#		}
		
#	common.data.percent =
#		xsd:string {
#			pattern = "(100)|([1-9]?[0-9](\.[0-9]+)?)%"
#		}
		
	common.data.float =
		w:float
#		xsd:string {
#			pattern = "-?[0-9]+(\.[0-9]+)?([eE]-?[0-9]+)?"
#		}

	common.data.float.positive =
		w:float-positive
#		xsd:string {
#			pattern = "(0*[1-9][0-9]*(\.[0-9]+)?)|([0-9]+(\.0*[1-9][0-9]*)?)([eE]-?[0-9]+)?"
#		}
		
	common.data.float.non-negative =
		w:float-non-negative
#		xsd:string {
#			pattern = "[0-9]+(\.[0-9]+)?([eE]-?[0-9]+)?"
#		}
		
## Temporal

	common.data.datetime =
		w:datetime-tz

	common.data.date-or-time =
		w:date-or-time

	common.data.date =
		w:date

	common.data.time-datetime =
		w:time-datetime

## IRIs

	common.data.uri =
		# allow either a non-empty IRI ref or zero or more HTML
		# space characters (which are: space, tab, LF, FF, CR)
		(	w:iri-ref
		|	xsd:string {
				pattern = "[ \x{0A}-\x{0D}]*"
				# NOTE The range above incorrectly allows U+000B
				# in addition to the HTML space characters; but
				# that's not a problem in practice because HTML
				# and XML parsers will both catch any U+000B
				# and report an error for it before that pattern
				# ever gets evaluated.
		 	}
		)

	common.data.uri.non-empty =
		w:iri-ref

	common.data.uris =
		list { w:iri-ref* }

	common.data.uri.absolute =
		w:iri

## <link type='icon'> sizes

	common.data.sizes =
#		list { w:sizes }
		list {
			xsd:string {
				pattern = "[1-9][0-9]*x[1-9][0-9]*"
			}+
		}

## MIME types

	common.data.mimetype =
		w:mime-type

## Encodings

	common.data.charset =
		w:charset

	common.data.meta-charset =
		w:meta-charset

## Refresh

	common.data.refresh =
		w:refresh

## Default style

	common.data.default-style =
        string
#		w:default-style

## Media Queries

	common.data.mediaquery =
		w:media-query

## Language Codes

	common.data.langcode =
		w:string "" | w:language

## List of Key Labels
	common.data.keylabellist =
		w:keylabellist

## List of Source Sizes
	common.data.source.size.list =
		w:source-size-list

## Microdata Properties
  common.data.microdata-properties =
    list { w:microdata-property+ }

## Zero
  common.data.zero =
    w:zero

## ECMAScript FunctionBody
  common.data.functionbody =
    w:functionbody

# #####################################################################
##  WF2 Module Hook                                                   #
# #####################################################################
		
common-form.attrs.form = ( notAllowed )

# #####################################################################
##  Script-supporting elements
# #####################################################################

common.elem.script-supporting = ( notAllowed )

# #####################################################################
##  ARIA Module Hooks                                                 #
# #####################################################################

common.attrs.aria = ( notAllowed )
common.attrs.aria.role.alert = ( notAllowed )
common.attrs.aria.role.alertdialog = ( notAllowed )
common.attrs.aria.role.application = ( notAllowed )
common.attrs.aria.role.article = ( notAllowed )
common.attrs.aria.role.banner = ( notAllowed )
common.attrs.aria.role.button = ( notAllowed )
common.attrs.aria.role.checkbox = ( notAllowed )
common.attrs.aria.role.combobox = ( notAllowed )
common.attrs.aria.role.complementary = ( notAllowed )
common.attrs.aria.role.contentinfo = ( notAllowed )
common.attrs.aria.role.dialog = ( notAllowed )
common.attrs.aria.role.directory = ( notAllowed )
common.attrs.aria.role.document = ( notAllowed )
common.attrs.aria.role.group = ( notAllowed )
common.attrs.aria.role.heading = ( notAllowed )
common.attrs.aria.role.img = ( notAllowed )
common.attrs.aria.role.link = ( notAllowed )
common.attrs.aria.role.list = ( notAllowed )
common.attrs.aria.role.listitem = ( notAllowed )
common.attrs.aria.role.log = ( notAllowed )
common.attrs.aria.role.listbox = ( notAllowed )
common.attrs.aria.role.main = ( notAllowed )
common.attrs.aria.role.marquee = ( notAllowed )
common.attrs.aria.role.menu = ( notAllowed )
common.attrs.aria.role.menubar = ( notAllowed )
common.attrs.aria.role.menuitem = ( notAllowed )
common.attrs.aria.role.menuitemcheckbox = ( notAllowed )
common.attrs.aria.role.menuitemradio = ( notAllowed )
common.attrs.aria.role.note = ( notAllowed )
common.attrs.aria.role.option = ( notAllowed )
common.attrs.aria.role.presentation = ( notAllowed )
common.attrs.aria.role.progressbar = ( notAllowed )
common.attrs.aria.role.radio = ( notAllowed )
common.attrs.aria.role.region = ( notAllowed )
common.attrs.aria.role.search = ( notAllowed )
common.attrs.aria.role.separator = ( notAllowed )
common.attrs.aria.role.slider = ( notAllowed )
common.attrs.aria.role.spinbutton = ( notAllowed )
common.attrs.aria.role.status = ( notAllowed )
common.attrs.aria.role.tab = ( notAllowed )
common.attrs.aria.role.tablist = ( notAllowed )
common.attrs.aria.role.tabpanel = ( notAllowed )
common.attrs.aria.role.textbox = ( notAllowed )
common.attrs.aria.role.toolbar = ( notAllowed )
common.attrs.aria.role.tree = ( notAllowed )
common.attrs.aria.role.treeitem = ( notAllowed )
common.attrs.aria.implicit.article = ( notAllowed )
common.attrs.aria.implicit.banner = ( notAllowed )
common.attrs.aria.implicit.button = ( notAllowed )
common.attrs.aria.implicit.checkbox = ( notAllowed )
common.attrs.aria.implicit.column-or-row-header = ( notAllowed )
common.attrs.aria.implicit.combobox = ( notAllowed )
common.attrs.aria.implicit.complementary = ( notAllowed )
common.attrs.aria.implicit.contentinfo = ( notAllowed )
common.attrs.aria.implicit.dialog = ( notAllowed )
common.attrs.aria.implicit.document = ( notAllowed )
common.attrs.aria.implicit.group = ( notAllowed )
common.attrs.aria.implicit.heading = ( notAllowed )
common.attrs.aria.implicit.img = ( notAllowed )
common.attrs.aria.implicit.landmark = ( notAllowed )
common.attrs.aria.implicit.link = ( notAllowed )
common.attrs.aria.implicit.list = ( notAllowed )
common.attrs.aria.implicit.listbox = ( notAllowed )
common.attrs.aria.implicit.listitem = ( notAllowed )
common.attrs.aria.implicit.main = ( notAllowed )
common.attrs.aria.implicit.navigation = ( notAllowed )
common.attrs.aria.implicit.option = ( notAllowed )
common.attrs.aria.implicit.progressbar = ( notAllowed )
common.attrs.aria.implicit.radio = ( notAllowed )
common.attrs.aria.implicit.region = ( notAllowed )
common.attrs.aria.implicit.section = ( notAllowed )
common.attrs.aria.implicit.select = ( notAllowed )
common.attrs.aria.implicit.slider = ( notAllowed )
common.attrs.aria.implicit.spinbutton = ( notAllowed )
common.attrs.aria.implicit.status = ( notAllowed )
common.attrs.aria.implicit.structure = ( notAllowed )
common.attrs.aria.implicit.textbox = ( notAllowed )
common.attrs.aria.implicit.toolbar = ( notAllowed )
common.attrs.aria.prop.readonly = ( notAllowed )
common.attrs.aria.landmark.application = ( notAllowed )
common.attrs.aria.landmark.banner = ( notAllowed )
common.attrs.aria.landmark.complementary = ( notAllowed )
common.attrs.aria.landmark.contentinfo = ( notAllowed )
common.attrs.aria.landmark.form = ( notAllowed )
common.attrs.aria.landmark.main = ( notAllowed )
common.attrs.aria.landmark.navigation = ( notAllowed )
common.attrs.aria.landmark.search = ( notAllowed )
# per ARIA spec: article, document, and note are not actually landmarks
common.attrs.aria.landmark.article = ( notAllowed )
common.attrs.aria.landmark.document = ( notAllowed )
common.attrs.aria.landmark.note = ( notAllowed )