]> code.delx.au - gnu-emacs-elpa/blob - packages/html5-schema/web-forms2.rnc
Merge commit '0cda39255827f283e7578cd469ae42daad9556a2' from js2-mode
[gnu-emacs-elpa] / packages / html5-schema / web-forms2.rnc
1 datatypes w = "http://whattf.org/datatype-draft"
2
3 # #####################################################################
4 ## RELAX NG Schema for HTML 5: Web Forms 2.0 markup #
5 # #####################################################################
6
7 ## Shared attributes for form controls
8
9 common-form.attrs &=
10 ( common-form.attrs.form? )
11
12 common-form.attrs.form |=
13 attribute form {
14 common.data.idref
15 }
16
17 shared-form.attrs.formaction =
18 attribute formaction {
19 common.data.uri.non-empty
20 }
21
22 shared-form.attrs.formenctype =
23 attribute formenctype {
24 shared-form.attrs.formenctype.data
25 }
26 shared-form.attrs.formenctype.data =
27 ( w:string "application/x-www-form-urlencoded"
28 | w:string "multipart/form-data"
29 | w:string "text/plain"
30 )
31
32 shared-form.attrs.formmethod =
33 attribute formmethod {
34 shared-form.attrs.formmethod.data
35 }
36 shared-form.attrs.formmethod.data =
37 ( w:string "get"
38 | w:string "post"
39 )
40
41 shared-form.attrs.formtarget =
42 attribute formtarget {
43 common.data.browsing-context-or-keyword
44 }
45
46 shared-form.attrs.formnovalidate =
47 attribute formnovalidate {
48 w:string "formnovalidate" | w:string ""
49 }
50
51 shared-form.attrs.autofocus =
52 attribute autofocus {
53 w:string "autofocus" | w:string ""
54 }
55
56 shared-form.attrs.pattern =
57 attribute pattern {
58 form.data.pattern
59 }
60
61 shared-form.attrs.template =
62 attribute template {
63 common.data.idref
64 }
65
66 shared-form.attrs.required =
67 attribute required {
68 w:string "required" | w:string ""
69 }
70
71 shared-form.attrs.placeholder =
72 attribute placeholder {
73 form.data.stringwithoutlinebreaks
74 }
75
76 shared-form.attrs.dirname =
77 attribute dirname {
78 form.data.nonemptystring
79 }
80
81 shared-form.attrs.inputmode =
82 attribute inputmode {
83 string
84 }
85
86 shared-form.attrs.minlength =
87 attribute minlength {
88 common.data.integer.non-negative
89 }
90
91 ## Shared attributes for <input>
92
93 shared-input.attrs =
94 ( input.attrs.autocomplete?
95 & shared-form.attrs.autofocus?
96 & input.attrs.list?
97 & shared-form.attrs.maxlength?
98 & shared-form.attrs.minlength?
99 & shared-form.attrs.pattern?
100 & shared-form.attrs.placeholder?
101 & shared-form.attrs.readonly?
102 & shared-form.attrs.required?
103 & shared-form.attrs.size?
104 )
105
106 input.attrs.autocomplete =
107 attribute autocomplete {
108 w:string "on" | w:string "off"
109 }
110
111 input.attrs.list =
112 attribute list {
113 common.data.idref
114 }
115
116 input.attrs.step.float =
117 attribute step {
118 w:string "any" | common.data.float.positive
119 }
120
121 input.attrs.step.integer =
122 attribute step {
123 w:string "any" | common.data.integer.positive
124 }
125
126 input.attrs.multiple =
127 attribute multiple {
128 w:string "multiple" | w:string ""
129 }
130
131 ## Text Field: <input type='text'>, Extensions
132
133 input.text.attrs &=
134 ( input.attrs.autocomplete?
135 & shared-form.attrs.autofocus?
136 & shared-form.attrs.dirname?
137 & input.attrs.list?
138 & shared-form.attrs.pattern?
139 & shared-form.attrs.required?
140 & shared-form.attrs.placeholder?
141 & shared-form.attrs.inputmode?
142 & shared-form.attrs.minlength?
143 )
144
145 ## Password Field: <input type='password'>, Extensions
146
147 input.password.attrs &=
148 ( input.attrs.autocomplete?
149 & shared-form.attrs.autofocus?
150 & input.attrs.list?
151 & shared-form.attrs.pattern?
152 & shared-form.attrs.placeholder?
153 & shared-form.attrs.required?
154 & shared-form.attrs.minlength?
155 )
156
157 ## Checkbox <input type='checkbox'>, Extensions
158
159 input.checkbox.attrs &=
160 ( shared-input.attrs )
161
162 ## Radiobutton: <input type='radio'>, Extensions
163
164 input.radio.attrs &=
165 ( shared-input.attrs )
166
167 ## Scripting Hook Button: <input type='button'>, Extensions
168
169 input.button.attrs &=
170 ( shared-input.attrs )
171
172 ## Submit Button: <input type='submit'>, Extensions
173
174 input.submit.attrs &=
175 ( shared-input.attrs
176 & shared-form.attrs.formaction?
177 & shared-form.attrs.formenctype?
178 & shared-form.attrs.formmethod?
179 & shared-form.attrs.formtarget?
180 & shared-form.attrs.formnovalidate?
181 )
182
183 ## Reset Button: <input type='reset'>, Extensions
184
185 input.reset.attrs &=
186 ( shared-input.attrs )
187
188 ## File Upload: <input type='file'>, Extensions
189
190 input.file.attrs &=
191 ( shared-input.attrs
192 & input.attrs.multiple?
193 )
194
195 ## Image Submit Button: <input type='image'>, Extensions
196
197 input.image.attrs &=
198 ( shared-input.attrs
199 & shared-form.attrs.formaction?
200 & shared-form.attrs.formenctype?
201 & shared-form.attrs.formmethod?
202 & shared-form.attrs.formtarget?
203 & shared-form.attrs.formnovalidate?
204 & input.image.attrs.height?
205 & input.image.attrs.width?
206 )
207 input.image.attrs.height =
208 attribute height {
209 common.data.integer.non-negative
210 }
211 input.image.attrs.width =
212 attribute width {
213 common.data.integer.non-negative
214 }
215
216 ## Global Date and Time: <input type='datetime'>
217
218 input.datetime.elem =
219 element input { input.datetime.attrs }
220 input.datetime.attrs =
221 ( common.attrs
222 & common-form.attrs
223 & shared-input.attrs
224 & input.datetime.attrs.type
225 & input.datetime.attrs.min?
226 & input.datetime.attrs.max?
227 & input.attrs.step.float?
228 & input.datetime.attrs.value?
229 & common.attrs.aria?
230 )
231 input.datetime.attrs.type =
232 attribute type {
233 w:string "datetime"
234 }
235 input.datetime.attrs.min =
236 attribute min {
237 common.data.datetime
238 }
239 input.datetime.attrs.max =
240 attribute max {
241 common.data.datetime
242 }
243 input.datetime.attrs.value =
244 attribute value {
245 w:string "" | common.data.datetime
246 }
247
248 input.elem |= input.datetime.elem
249
250 ## Date and Time with No Time Zone Information: <input type='datetime-local'>
251
252 input.datetime-local.elem =
253 element input { input.datetime-local.attrs }
254 input.datetime-local.attrs =
255 ( common.attrs
256 & common-form.attrs
257 & shared-input.attrs
258 & input.datetime-local.attrs.type
259 & input.datetime-local.attrs.min?
260 & input.datetime-local.attrs.max?
261 & input.attrs.step.float?
262 & input.datetime-local.attrs.value?
263 & common.attrs.aria?
264 )
265 input.datetime-local.attrs.type =
266 attribute type {
267 w:string "datetime-local"
268 }
269 input.datetime-local.attrs.min =
270 attribute min {
271 form.data.datetime-local
272 }
273 input.datetime-local.attrs.max =
274 attribute max {
275 form.data.datetime-local
276 }
277 input.datetime-local.attrs.value =
278 attribute value {
279 w:string "" | form.data.datetime-local
280 }
281
282 input.elem |= input.datetime-local.elem
283
284 ## Date: <input type='date'>
285
286 input.date.elem =
287 element input { input.date.attrs }
288 input.date.attrs =
289 ( common.attrs
290 & common-form.attrs
291 & shared-input.attrs
292 & input.date.attrs.type
293 & input.date.attrs.min?
294 & input.date.attrs.max?
295 & input.attrs.step.integer?
296 & input.date.attrs.value?
297 & common.attrs.aria?
298 )
299 input.date.attrs.type =
300 attribute type {
301 w:string "date"
302 }
303 input.date.attrs.min =
304 attribute min {
305 form.data.date
306 }
307 input.date.attrs.max =
308 attribute max {
309 form.data.date
310 }
311 input.date.attrs.value =
312 attribute value {
313 w:string "" | form.data.date
314 }
315
316 input.elem |= input.date.elem
317
318 ## Year and Month: <input type='month'>
319
320 input.month.elem =
321 element input { input.month.attrs }
322 input.month.attrs =
323 ( common.attrs
324 & common-form.attrs
325 & shared-input.attrs
326 & input.month.attrs.type
327 & input.month.attrs.min?
328 & input.month.attrs.max?
329 & input.attrs.step.integer?
330 & input.month.attrs.value?
331 & common.attrs.aria?
332 )
333 input.month.attrs.type =
334 attribute type {
335 w:string "month"
336 }
337 input.month.attrs.min =
338 attribute min {
339 form.data.month
340 }
341 input.month.attrs.max =
342 attribute max {
343 form.data.month
344 }
345 input.month.attrs.value =
346 attribute value {
347 w:string "" | form.data.month
348 }
349
350 input.elem |= input.month.elem
351
352 ## Time without Time Zone Information: <input type='time'>
353
354 input.time.elem =
355 element input { input.time.attrs }
356 input.time.attrs =
357 ( common.attrs
358 & common-form.attrs
359 & shared-input.attrs
360 & input.time.attrs.type
361 & input.time.attrs.min?
362 & input.time.attrs.max?
363 & input.attrs.step.float?
364 & input.time.attrs.value?
365 & common.attrs.aria?
366 )
367 input.time.attrs.type =
368 attribute type {
369 w:string "time"
370 }
371 input.time.attrs.min =
372 attribute min {
373 form.data.time
374 }
375 input.time.attrs.max =
376 attribute max {
377 form.data.time
378 }
379 input.time.attrs.value =
380 attribute value {
381 w:string "" | form.data.time
382 }
383
384 input.elem |= input.time.elem
385
386 ## Year and Week: <input type='week'>
387
388 input.week.elem =
389 element input { input.week.attrs }
390 input.week.attrs =
391 ( common.attrs
392 & common-form.attrs
393 & shared-input.attrs
394 & input.week.attrs.type
395 & input.week.attrs.min?
396 & input.week.attrs.max?
397 & input.attrs.step.integer?
398 & input.week.attrs.value?
399 & common.attrs.aria?
400 )
401 input.week.attrs.type =
402 attribute type {
403 w:string "week"
404 }
405 input.week.attrs.min =
406 attribute min {
407 form.data.week
408 }
409 input.week.attrs.max =
410 attribute max {
411 form.data.week
412 }
413 input.week.attrs.value =
414 attribute value {
415 w:string "" | form.data.week
416 }
417
418 input.elem |= input.week.elem
419
420 ## Number: <input type='number'>
421
422 input.number.elem =
423 element input { input.number.attrs }
424 input.number.attrs =
425 ( common.attrs
426 & common-form.attrs
427 & shared-input.attrs
428 & input.number.attrs.type
429 & input.number.attrs.min?
430 & input.number.attrs.max?
431 & input.attrs.step.float?
432 & input.number.attrs.value?
433 & ( common.attrs.aria.implicit.spinbutton
434 | common.attrs.aria.role.spinbutton
435 )?
436 )
437 input.number.attrs.type =
438 attribute type {
439 w:string "number"
440 }
441 input.number.attrs.min =
442 attribute min {
443 common.data.float
444 }
445 input.number.attrs.max =
446 attribute max {
447 common.data.float
448 }
449 input.number.attrs.value =
450 attribute value {
451 w:string "" | common.data.float
452 }
453
454 input.elem |= input.number.elem
455
456 ## Imprecise Number: <input type='range'>
457
458 input.range.elem =
459 element input { input.range.attrs }
460 input.range.attrs =
461 ( common.attrs
462 & common-form.attrs
463 & shared-input.attrs
464 & input.range.attrs.type
465 & input.range.attrs.min?
466 & input.range.attrs.max?
467 & input.attrs.step.float?
468 & input.range.attrs.value?
469 & ( common.attrs.aria.implicit.slider
470 | common.attrs.aria.role.slider
471 )?
472 )
473 input.range.attrs.type =
474 attribute type {
475 w:string "range"
476 }
477 input.range.attrs.min =
478 attribute min {
479 common.data.float
480 }
481 input.range.attrs.max =
482 attribute max {
483 common.data.float
484 }
485 input.range.attrs.value =
486 attribute value {
487 common.data.float
488 }
489
490 input.elem |= input.range.elem
491
492 ## Email Address: <input type='email'>
493
494 input.email.elem =
495 element input { input.email.attrs }
496 input.email.attrs =
497 ( common.attrs
498 & common-form.attrs
499 & shared-input.attrs
500 & input.email.attrs.type
501 & ( ( input.attrs.multiple
502 & input.email.attrs.value.multiple?
503 )
504 | input.email.attrs.value.single?
505 )?
506 & ( common.attrs.aria.implicit.textbox
507 | common.attrs.aria.implicit.combobox
508 | common.attrs.aria.role.textbox
509 | common.attrs.aria.role.combobox
510 )?
511 )
512 input.email.attrs.type =
513 attribute type {
514 w:string "email"
515 }
516 input.email.attrs.value.single =
517 attribute value {
518 form.data.emailaddress
519 }
520 input.email.attrs.value.multiple =
521 attribute value {
522 form.data.emailaddresslist
523 }
524
525 input.elem |= input.email.elem
526
527 ## IRI: <input type='url'>
528
529 input.url.elem =
530 element input { input.url.attrs }
531 input.url.attrs =
532 ( common.attrs
533 & common-form.attrs
534 & shared-input.attrs
535 & input.url.attrs.type
536 & input.url.attrs.value?
537 & ( common.attrs.aria.implicit.textbox
538 | common.attrs.aria.implicit.combobox
539 | common.attrs.aria.role.textbox
540 | common.attrs.aria.role.combobox
541 )?
542 )
543 input.url.attrs.type =
544 attribute type {
545 w:string "url"
546 }
547 input.url.attrs.value =
548 attribute value {
549 w:string "" | common.data.uri.absolute
550 }
551
552 input.elem |= input.url.elem
553
554 ## Search: <input type='search'>
555
556 input.search.elem =
557 element input { input.search.attrs }
558 input.search.attrs =
559 ( common.attrs
560 & common-form.attrs
561 & shared-input.attrs
562 & input.search.attrs.type
563 & input.search.attrs.value?
564 & shared-form.attrs.dirname?
565 & ( common.attrs.aria.implicit.textbox
566 | common.attrs.aria.implicit.combobox
567 | common.attrs.aria.role.textbox
568 | common.attrs.aria.role.combobox
569 )?
570 )
571 input.search.attrs.type =
572 attribute type {
573 w:string "search"
574 }
575 input.search.attrs.value =
576 attribute value {
577 form.data.stringwithoutlinebreaks
578 }
579
580 input.elem |= input.search.elem
581
582 ## Telephone Number: <input type='tel'>
583
584 input.tel.elem =
585 element input { input.tel.attrs }
586 input.tel.attrs =
587 ( common.attrs
588 & common-form.attrs
589 & shared-input.attrs
590 & input.tel.attrs.type
591 & input.tel.attrs.value?
592 & ( common.attrs.aria.implicit.textbox
593 | common.attrs.aria.implicit.combobox
594 | common.attrs.aria.role.textbox
595 | common.attrs.aria.role.combobox
596 )?
597 )
598 input.tel.attrs.type =
599 attribute type {
600 w:string "tel"
601 }
602 input.tel.attrs.value =
603 attribute value {
604 form.data.stringwithoutlinebreaks
605 }
606
607 input.elem |= input.tel.elem
608
609 ## Color: <input type='color'>
610
611 input.color.elem =
612 element input { input.color.attrs }
613 input.color.attrs =
614 ( common.attrs
615 & common-form.attrs
616 & input.color.attrs.type
617 & input.color.attrs.value?
618 & shared-input.attrs
619 & common.attrs.aria?
620 )
621 input.color.attrs.type =
622 attribute type {
623 w:string "color"
624 }
625 input.color.attrs.value =
626 attribute value {
627 w:string "" | form.data.color
628 }
629
630 input.elem |= input.color.elem
631
632 ## Form Output: <output>
633
634 output.elem =
635 element output { output.inner & output.attrs }
636 output.attrs =
637 ( common.attrs
638 & common-form.attrs.name?
639 & common-form.attrs.form?
640 & output.attrs.for?
641 & ( common.attrs.aria.implicit.status
642 | common.attrs.aria
643 )?
644 )
645 output.attrs.for =
646 attribute for {
647 common.data.idrefs #REVISIT spec says space--not whitespace
648 }
649 output.inner =
650 ( common.inner.phrasing )
651
652 common.elem.phrasing |= output.elem
653
654 ## Text Area: <textarea>, extensions
655
656 textarea.attrs.rows-and-cols-wf1.inner &=
657 notAllowed
658 textarea.attrs.rows-and-cols-wf1 |=
659 empty
660 textarea.attrs &=
661 ( shared-form.attrs.maxlength?
662 & shared-form.attrs.minlength?
663 & shared-form.attrs.autofocus?
664 & shared-form.attrs.required?
665 & shared-form.attrs.placeholder?
666 & shared-form.attrs.dirname?
667 & textarea.attrs.rows?
668 & ( ( textarea.attrs.wrap.hard
669 & textarea.attrs.cols
670 )
671 | ( textarea.attrs.wrap.soft?
672 & textarea.attrs.cols?
673 )
674 )
675 & shared-form.attrs.inputmode?
676 )
677 textarea.attrs.wrap.hard =
678 attribute wrap {
679 w:string "hard"
680 }
681 textarea.attrs.wrap.soft =
682 attribute wrap {
683 w:string "soft"
684 }
685
686 ## List of Prefill Data: <datalist>
687
688 #REVISIT should the options in datalist be non-selectable?
689
690 datalist.elem =
691 element datalist { datalist.inner & datalist.attrs }
692 datalist.inner =
693 ( option.elem* & common.inner.phrasing )
694 datalist.attrs =
695 ( common.attrs
696 & ( common.attrs.aria.role.listbox # aria-multiselectable must be false; check by assertions
697 | common.attrs.aria.role.presentation
698 | common.attrs.aria.role.menuitem
699 )?
700 )
701
702 common.elem.phrasing |= datalist.elem
703
704 ## Complex Submit Button: <button type='submit'>, extensions
705
706 button.submit.attrs &=
707 ( shared-form.attrs.formaction?
708 & shared-form.attrs.autofocus?
709 & shared-form.attrs.formenctype?
710 & shared-form.attrs.formmethod?
711 & shared-form.attrs.formtarget?
712 & shared-form.attrs.formnovalidate?
713 )
714
715 ## Complex Reset Button: <button type='reset'>, extensions
716
717 button.reset.attrs &=
718 ( shared-form.attrs.autofocus? )
719
720 ## Complex Push Button: <button type='button'>, extensions
721
722 button.button.attrs &=
723 ( shared-form.attrs.autofocus? )
724
725 ## Form: <form>, extensions
726 form.attrs &=
727 ( form.attrs.novalidate?
728 & form.attrs.target?
729 & form.attrs.autocomplete?
730 )
731 form.attrs.novalidate =
732 attribute novalidate {
733 w:string "novalidate" | w:string ""
734 }
735 form.attrs.target =
736 attribute target {
737 common.data.browsing-context-or-keyword
738 }
739 form.attrs.autocomplete =
740 attribute autocomplete {
741 w:string "on" | w:string "off"
742 }
743 # REVISIT should this be case-insensitive in conforming XHTML documents?
744 form.attrs.enctype.data |=
745 ( w:string "text/plain" )
746
747 ## Fieldset: <fieldset>, extensions
748
749 fieldset.attrs &=
750 ( common-form.attrs )
751
752 ## Label: <label>, extensions
753
754 label.attrs &=
755 ( common-form.attrs.form? )
756
757 ## Key-pair generator/input control: <keygen>
758
759 keygen.elem =
760 element keygen { keygen.inner & keygen.attrs }
761 keygen.attrs =
762 ( common.attrs
763 & keygen.attrs.challenge?
764 & keygen.attrs.keytype?
765 & shared-form.attrs.autofocus?
766 & common-form.attrs?
767 & ( common.attrs.aria.role.presentation
768 | common.attrs.aria.role.menuitem
769 )?
770 )
771 keygen.attrs.challenge =
772 attribute challenge {
773 string
774 }
775 keygen.attrs.keytype =
776 attribute keytype {
777 w:string "rsa"
778 }
779 keygen.inner =
780 ( empty )
781
782 common.elem.phrasing |= keygen.elem
783
784 ## Selection Menu: <select>, Extensions
785
786 select.attrs &=
787 ( shared-form.attrs.autofocus?
788 & shared-form.attrs.required?
789 )