html5-syntax: trang -I rnc -O rng

This commit is contained in:
Astro 2010-09-25 01:55:09 +02:00
parent 32ffce7e55
commit 1ff3aa433d
48 changed files with 9759 additions and 5868 deletions

View File

@ -1,260 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Web Application Features #
# #####################################################################
## Additions to Common Attributes
common.attrs.interact &=
( common.attrs.contextmenu?
& common.attrs.contenteditable?
& common.attrs.draggable?
& common.attrs.hidden?
& common.attrs.spellcheck?
)
common.attrs.other &= common.attrs.interact
## Context Menu: contextmenu
common.attrs.contextmenu =
attribute contextmenu {
common.data.idref
}
## Editable Content: contenteditable
common.attrs.contenteditable =
attribute contenteditable {
w:string "true" | w:string "false" | w:string ""
}
## Draggable Element: draggable
common.attrs.draggable =
attribute draggable {
w:string "true" | w:string "false"
}
## Hidden Element: hidden
common.attrs.hidden =
attribute hidden {
w:string "hidden" | w:string ""
}
## Spellchecking and grammar checking: spellcheck
common.attrs.spellcheck =
attribute spellcheck{
w:string "true" | w:string "false" | w:string ""
}
## Application Cache: manifest
html.attrs.manifest =
attribute manifest {
common.data.uri
}
html.attrs &= html.attrs.manifest?
## Progess Indicator: <progress>
progress.elem =
element progress { progress.inner & progress.attrs }
progress.attrs =
( common.attrs
& progress.attrs.value?
& progress.attrs.max?
)
progress.attrs.value =
attribute value {
common.data.float.non-negative
}
progress.attrs.max =
attribute max {
common.data.float.positive
}
progress.inner =
( common.inner.phrasing ) #Cannot enforce textContent format here
common.elem.phrasing |= progress.elem
## Command with an associated action: <command type='command'>
command.command.elem =
element command { command.inner & command.command.attrs }
command.command.attrs =
( common.attrs
& command.command.attrs.type?
& common-command.attrs
)
command.command.attrs.type =
attribute type {
w:string "command"
}
command.elem = command.command.elem
## Selection of one item from a list of items: <command type='radio'>
command.radio.elem =
element command { command.inner & command.radio.attrs }
command.radio.attrs =
( common.attrs
& ( command.radio.attrs.type
& command.radio.attrs.radiogroup #REVISIT taking liberties here
& command.radio.attrs.checked?
)
& common-command.attrs
)
command.radio.attrs.type =
attribute type {
w:string "radio"
}
command.radio.attrs.radiogroup =
attribute radiogroup {
string #REVISIT need special format here?
}
command.radio.attrs.checked =
attribute checked {
w:string "checked" | w:string ""
}
command.elem |= command.radio.elem
## State or option that can be toggled: <command type='checkbox'>
command.checkbox.elem =
element command { command.inner & command.checkbox.attrs }
command.checkbox.attrs =
( common.attrs
& ( command.checkbox.attrs.type
& command.checkbox.attrs.checked?
)
& common-command.attrs
)
command.checkbox.attrs.type =
attribute type {
w:string "checkbox"
}
command.checkbox.attrs.checked =
attribute checked {
w:string "checked" | w:string ""
}
command.elem |= command.checkbox.elem
common-command.attrs =
( command.attrs.label?
& command.attrs.icon?
& command.attrs.disabled?
)
command.attrs.label =
attribute label {
string
}
command.attrs.icon =
attribute icon {
common.data.uri
}
command.attrs.disabled =
attribute disabled {
w:string "disabled" | w:string ""
}
command.inner =
( empty )
common.elem.metadata |=
( command.elem & nonHTMLizable )
common.elem.phrasing |= command.elem
## Menu: <menu>
menu.elem =
element menu { menu.inner & menu.attrs }
menu.attrs =
( common.attrs
& menu.attrs.type?
& menu.attrs.label?
)
menu.attrs.type =
attribute type {
w:string "toolbar" | w:string "context"
}
menu.attrs.label =
attribute label {
string
}
menu.inner =
( mli.elem*
| common.inner.flow
)
common.elem.flow |= menu.elem
# REVISIT allow nested menus
## Menu Item: <li>
mli.elem =
element li { mli.inner & mli.attrs }
mli.attrs =
( common.attrs )
mli.inner =
( common.inner.flow )
## Canvas for Dynamic Graphics: <canvas>
canvas.elem.flow =
element canvas { canvas.inner.flow & canvas.attrs }
canvas.elem.phrasing =
element canvas { canvas.inner.phrasing & canvas.attrs }
canvas.attrs =
( common.attrs
& canvas.attrs.height?
& canvas.attrs.width?
& common.attrs.aria?
)
canvas.attrs.height =
attribute height {
common.data.integer.non-negative
}
canvas.attrs.width =
attribute width {
common.data.integer.non-negative
}
canvas.inner.flow =
( common.inner.flow )
canvas.inner.phrasing =
( common.inner.phrasing )
common.elem.flow |= canvas.elem.flow
common.elem.phrasing |= canvas.elem.phrasing
## Additional On-Demand Information: <details>
details.elem =
element details { details.inner & details.attrs }
details.attrs =
( common.attrs
& details.attrs.open?
& common.attrs.aria.implicit.region?
)
details.attrs.open =
attribute open {
w:string "open" | w:string ""
}
details.inner =
( summary.elem?
, common.inner.flow
)
common.elem.flow |= details.elem
## Caption/summary for details element: <summary>
summary.elem =
element summary { summary.inner & summary.attrs }
summary.attrs =
( common.attrs )
summary.inner =
( common.inner.phrasing )

View File

@ -0,0 +1,437 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<define name="common.attrs.interact" combine="interleave">
<a:documentation> RELAX NG Schema for HTML 5: Web Application Features #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Additions to Common Attributes</a:documentation>
<interleave>
<optional>
<ref name="common.attrs.contextmenu"/>
</optional>
<optional>
<ref name="common.attrs.contenteditable"/>
</optional>
<optional>
<ref name="common.attrs.draggable"/>
</optional>
<optional>
<ref name="common.attrs.hidden"/>
</optional>
<optional>
<ref name="common.attrs.spellcheck"/>
</optional>
</interleave>
</define>
<define name="common.attrs.other" combine="interleave">
<ref name="common.attrs.interact"/>
</define>
<define name="common.attrs.contextmenu">
<a:documentation>Context Menu: contextmenu</a:documentation>
<attribute name="contextmenu">
<ref name="common.data.idref"/>
</attribute>
</define>
<define name="common.attrs.contenteditable">
<a:documentation>Editable Content: contenteditable</a:documentation>
<attribute name="contenteditable">
<choice>
<value type="string">true</value>
<value type="string">false</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="common.attrs.draggable">
<a:documentation>Draggable Element: draggable</a:documentation>
<attribute name="draggable">
<choice>
<value type="string">true</value>
<value type="string">false</value>
</choice>
</attribute>
</define>
<define name="common.attrs.hidden">
<a:documentation>Hidden Element: hidden</a:documentation>
<attribute name="hidden">
<choice>
<value type="string">hidden</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="common.attrs.spellcheck">
<a:documentation>Spellchecking and grammar checking: spellcheck</a:documentation>
<attribute name="spellcheck">
<choice>
<value type="string">true</value>
<value type="string">false</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="html.attrs.manifest">
<a:documentation>Application Cache: manifest</a:documentation>
<attribute name="manifest">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="html.attrs" combine="interleave">
<optional>
<ref name="html.attrs.manifest"/>
</optional>
</define>
<define name="progress.elem">
<a:documentation>Progess Indicator: &lt;progress&gt;</a:documentation>
<element name="progress">
<interleave>
<ref name="progress.inner"/>
<ref name="progress.attrs"/>
</interleave>
</element>
</define>
<define name="progress.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="progress.attrs.value"/>
</optional>
<optional>
<ref name="progress.attrs.max"/>
</optional>
</interleave>
</define>
<define name="progress.attrs.value">
<attribute name="value">
<ref name="common.data.float.non-negative"/>
</attribute>
</define>
<define name="progress.attrs.max">
<attribute name="max">
<ref name="common.data.float.positive"/>
</attribute>
</define>
<define name="progress.inner">
<ref name="common.inner.phrasing"/>
</define>
<!-- Cannot enforce textContent format here -->
<define name="common.elem.phrasing" combine="choice">
<ref name="progress.elem"/>
</define>
<define name="command.command.elem">
<a:documentation>Command with an associated action: &lt;command type='command'&gt;</a:documentation>
<element name="command">
<interleave>
<ref name="command.inner"/>
<ref name="command.command.attrs"/>
</interleave>
</element>
</define>
<define name="command.command.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="command.command.attrs.type"/>
</optional>
<ref name="common-command.attrs"/>
</interleave>
</define>
<define name="command.command.attrs.type">
<attribute name="type">
<value type="string">command</value>
</attribute>
</define>
<define name="command.elem">
<ref name="command.command.elem"/>
</define>
<define name="command.radio.elem">
<a:documentation>Selection of one item from a list of items: &lt;command type='radio'&gt;</a:documentation>
<element name="command">
<interleave>
<ref name="command.inner"/>
<ref name="command.radio.attrs"/>
</interleave>
</element>
</define>
<define name="command.radio.attrs">
<interleave>
<ref name="common.attrs"/>
<interleave>
<ref name="command.radio.attrs.type"/>
<ref name="command.radio.attrs.radiogroup"/>
<optional>
<!-- REVISIT taking liberties here -->
<ref name="command.radio.attrs.checked"/>
</optional>
</interleave>
<ref name="common-command.attrs"/>
</interleave>
</define>
<define name="command.radio.attrs.type">
<attribute name="type">
<value type="string">radio</value>
</attribute>
</define>
<define name="command.radio.attrs.radiogroup">
<attribute name="radiogroup">
<data type="string" datatypeLibrary=""/>
<!-- REVISIT need special format here? -->
</attribute>
</define>
<define name="command.radio.attrs.checked">
<attribute name="checked">
<choice>
<value type="string">checked</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="command.elem" combine="choice">
<ref name="command.radio.elem"/>
</define>
<define name="command.checkbox.elem">
<a:documentation>State or option that can be toggled: &lt;command type='checkbox'&gt;</a:documentation>
<element name="command">
<interleave>
<ref name="command.inner"/>
<ref name="command.checkbox.attrs"/>
</interleave>
</element>
</define>
<define name="command.checkbox.attrs">
<interleave>
<ref name="common.attrs"/>
<interleave>
<ref name="command.checkbox.attrs.type"/>
<optional>
<ref name="command.checkbox.attrs.checked"/>
</optional>
</interleave>
<ref name="common-command.attrs"/>
</interleave>
</define>
<define name="command.checkbox.attrs.type">
<attribute name="type">
<value type="string">checkbox</value>
</attribute>
</define>
<define name="command.checkbox.attrs.checked">
<attribute name="checked">
<choice>
<value type="string">checked</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="command.elem" combine="choice">
<ref name="command.checkbox.elem"/>
</define>
<define name="common-command.attrs">
<interleave>
<optional>
<ref name="command.attrs.label"/>
</optional>
<optional>
<ref name="command.attrs.icon"/>
</optional>
<optional>
<ref name="command.attrs.disabled"/>
</optional>
</interleave>
</define>
<define name="command.attrs.label">
<attribute name="label">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="command.attrs.icon">
<attribute name="icon">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="command.attrs.disabled">
<attribute name="disabled">
<choice>
<value type="string">disabled</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="command.inner">
<empty/>
</define>
<define name="common.elem.metadata" combine="choice">
<interleave>
<ref name="command.elem"/>
<ref name="nonHTMLizable"/>
</interleave>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="command.elem"/>
</define>
<define name="menu.elem">
<a:documentation>Menu: &lt;menu&gt;</a:documentation>
<element name="menu">
<interleave>
<ref name="menu.inner"/>
<ref name="menu.attrs"/>
</interleave>
</element>
</define>
<define name="menu.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="menu.attrs.type"/>
</optional>
<optional>
<ref name="menu.attrs.label"/>
</optional>
</interleave>
</define>
<define name="menu.attrs.type">
<attribute name="type">
<choice>
<value type="string">toolbar</value>
<value type="string">context</value>
</choice>
</attribute>
</define>
<define name="menu.attrs.label">
<attribute name="label">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="menu.inner">
<choice>
<zeroOrMore>
<ref name="mli.elem"/>
</zeroOrMore>
<ref name="common.inner.flow"/>
</choice>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="menu.elem"/>
</define>
<!-- REVISIT allow nested menus -->
<define name="mli.elem">
<a:documentation>Menu Item: &lt;li&gt;</a:documentation>
<element name="li">
<interleave>
<ref name="mli.inner"/>
<ref name="mli.attrs"/>
</interleave>
</element>
</define>
<define name="mli.attrs">
<ref name="common.attrs"/>
</define>
<define name="mli.inner">
<ref name="common.inner.flow"/>
</define>
<define name="canvas.elem.flow">
<a:documentation>Canvas for Dynamic Graphics: &lt;canvas&gt;</a:documentation>
<element name="canvas">
<interleave>
<ref name="canvas.inner.flow"/>
<ref name="canvas.attrs"/>
</interleave>
</element>
</define>
<define name="canvas.elem.phrasing">
<element name="canvas">
<interleave>
<ref name="canvas.inner.phrasing"/>
<ref name="canvas.attrs"/>
</interleave>
</element>
</define>
<define name="canvas.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="canvas.attrs.height"/>
</optional>
<optional>
<ref name="canvas.attrs.width"/>
</optional>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="canvas.attrs.height">
<attribute name="height">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="canvas.attrs.width">
<attribute name="width">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="canvas.inner.flow">
<ref name="common.inner.flow"/>
</define>
<define name="canvas.inner.phrasing">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="canvas.elem.flow"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="canvas.elem.phrasing"/>
</define>
<define name="details.elem">
<a:documentation>Additional On-Demand Information: &lt;details&gt;</a:documentation>
<element name="details">
<interleave>
<ref name="details.inner"/>
<ref name="details.attrs"/>
</interleave>
</element>
</define>
<define name="details.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="details.attrs.open"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.region"/>
</optional>
</interleave>
</define>
<define name="details.attrs.open">
<attribute name="open">
<choice>
<value type="string">open</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="details.inner">
<optional>
<ref name="summary.elem"/>
</optional>
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="details.elem"/>
</define>
<define name="summary.elem">
<a:documentation>Caption/summary for details element: &lt;summary&gt;</a:documentation>
<element name="summary">
<interleave>
<ref name="summary.inner"/>
<ref name="summary.attrs"/>
</interleave>
</element>
</define>
<define name="summary.attrs">
<ref name="common.attrs"/>
</define>
<define name="summary.inner">
<ref name="common.inner.phrasing"/>
</define>
</grammar>

File diff suppressed because it is too large Load Diff

1674
html5-syntax/aria.rng Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,196 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Basic Prose Markup #
# #####################################################################
# #####################################################################
## Paragraph-Level
## Paragraph: <p>
p.elem =
element p { p.inner & p.attrs }
p.attrs =
( common.attrs
& common.attrs.aria?
)
p.inner =
( common.inner.phrasing ) # REVISIT lists in span?
common.elem.flow |= p.elem
## Hint Transition: <hr>
hr.elem =
element hr { hr.inner & hr.attrs }
hr.attrs =
( common.attrs )
hr.inner =
( empty )
common.elem.flow |= hr.elem
# #####################################################################
## Preformatting Blocks
## Preformatted Text: <pre>
pre.elem =
element pre { pre.inner & pre.attrs }
pre.attrs =
( common.attrs
& common.attrs.aria?
)
pre.inner =
( common.inner.phrasing )
common.elem.flow |= pre.elem
# #####################################################################
## Simple Lists
## Unordered List: <ul>
ul.elem =
element ul { ul.inner & ul.attrs }
ul.attrs =
( common.attrs
& ( common.attrs.aria
| common.attrs.aria.implicit.region
)?
)
ul.inner =
( li.elem* )
common.elem.flow |= ul.elem
## Unordered List Item: <li>
li.elem =
element li { li.inner & li.attrs }
li.attrs =
( common.attrs
& ( common.attrs.aria
| common.attrs.aria.implicit.listitem
)?
)
li.inner =
( common.inner.flow )
## Ordered List: <ol>
ol.elem =
element ol { ol.inner & ol.attrs }
ol.attrs =
( common.attrs
& ol.attrs.start?
& ol.attrs.reversed?
& ( common.attrs.aria
| common.attrs.aria.implicit.region
)?
)
ol.attrs.start =
attribute start {
common.data.integer
}
ol.attrs.reversed =
attribute reversed {
w:string "reversed" | w:string ""
}
ol.inner =
( oli.elem* )
common.elem.flow |= ol.elem
## Ordered List Item: <li>
oli.elem =
element li { oli.inner & oli.attrs }
oli.attrs =
( common.attrs
& oli.attrs.value?
& ( common.attrs.aria
| common.attrs.aria.implicit.listitem
)?
)
oli.attrs.value =
attribute value {
common.data.integer
}
oli.inner =
( common.inner.flow )
# #####################################################################
## Definition Lists
## Definition List: <dl>
dl.elem =
element dl { dl.inner & dl.attrs }
dl.attrs =
( common.attrs
& common.attrs.aria?
)
dl.inner =
( ( dt.elem+
, dd.elem+
)*
)
common.elem.flow |= dl.elem
## Definition Term: <dt>
dt.elem =
element dt { dt.inner & dt.attrs }
dt.attrs =
( common.attrs
& common.attrs.aria?
)
dt.inner =
( common.inner.phrasing )
## Definition Description: <dd>
dd.elem =
element dd { dd.inner & dd.attrs }
dd.elem.phrasing =
element dd { dd.inner.phrasing & dd.attrs }
dd.attrs =
( common.attrs
& common.attrs.aria?
)
dd.inner =
( common.inner.flow )
dd.inner.phrasing =
( common.inner.phrasing )
# #####################################################################
## Miscellaneous Elements
## Generic Container: <div>
div.elem =
element div { div.inner & div.attrs }
div.attrs =
( common.attrs
& common.attrs.aria?
)
div.inner =
( style.elem.scoped*
, common.inner.flow
)
common.elem.flow |= div.elem
## Title or Explanatory Caption: <legend>
legend.elem =
element legend { legend.inner & legend.attrs }
legend.attrs =
( common.attrs
& common.attrs.aria.implicit.region?
)
legend.inner =
( common.inner.phrasing )

337
html5-syntax/block.rng Normal file
View File

@ -0,0 +1,337 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<define name="p.elem">
<a:documentation> RELAX NG Schema for HTML 5: Basic Prose Markup #</a:documentation>
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<a:documentation>Paragraph-Level</a:documentation>
<a:documentation>Paragraph: &lt;p&gt;</a:documentation>
<element name="p">
<interleave>
<ref name="p.inner"/>
<ref name="p.attrs"/>
</interleave>
</element>
</define>
<define name="p.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="p.inner">
<ref name="common.inner.phrasing"/>
</define>
<!-- REVISIT lists in span? -->
<define name="common.elem.flow" combine="choice">
<ref name="p.elem"/>
</define>
<define name="hr.elem">
<a:documentation>Hint Transition: &lt;hr&gt;</a:documentation>
<element name="hr">
<interleave>
<ref name="hr.inner"/>
<ref name="hr.attrs"/>
</interleave>
</element>
</define>
<define name="hr.attrs">
<ref name="common.attrs"/>
</define>
<define name="hr.inner">
<empty/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="hr.elem"/>
</define>
<!-- ##################################################################### -->
<define name="pre.elem">
<a:documentation>Preformatting Blocks</a:documentation>
<a:documentation>Preformatted Text: &lt;pre&gt;</a:documentation>
<element name="pre">
<interleave>
<ref name="pre.inner"/>
<ref name="pre.attrs"/>
</interleave>
</element>
</define>
<define name="pre.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="pre.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="pre.elem"/>
</define>
<!-- ##################################################################### -->
<define name="ul.elem">
<a:documentation>Simple Lists</a:documentation>
<a:documentation>Unordered List: &lt;ul&gt;</a:documentation>
<element name="ul">
<interleave>
<ref name="ul.inner"/>
<ref name="ul.attrs"/>
</interleave>
</element>
</define>
<define name="ul.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.region"/>
</choice>
</optional>
</interleave>
</define>
<define name="ul.inner">
<zeroOrMore>
<ref name="li.elem"/>
</zeroOrMore>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="ul.elem"/>
</define>
<define name="li.elem">
<a:documentation>Unordered List Item: &lt;li&gt;</a:documentation>
<element name="li">
<interleave>
<ref name="li.inner"/>
<ref name="li.attrs"/>
</interleave>
</element>
</define>
<define name="li.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.listitem"/>
</choice>
</optional>
</interleave>
</define>
<define name="li.inner">
<ref name="common.inner.flow"/>
</define>
<define name="ol.elem">
<a:documentation>Ordered List: &lt;ol&gt;</a:documentation>
<element name="ol">
<interleave>
<ref name="ol.inner"/>
<ref name="ol.attrs"/>
</interleave>
</element>
</define>
<define name="ol.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="ol.attrs.start"/>
</optional>
<optional>
<ref name="ol.attrs.reversed"/>
</optional>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.region"/>
</choice>
</optional>
</interleave>
</define>
<define name="ol.attrs.start">
<attribute name="start">
<ref name="common.data.integer"/>
</attribute>
</define>
<define name="ol.attrs.reversed">
<attribute name="reversed">
<choice>
<value type="string">reversed</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="ol.inner">
<zeroOrMore>
<ref name="oli.elem"/>
</zeroOrMore>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="ol.elem"/>
</define>
<define name="oli.elem">
<a:documentation>Ordered List Item: &lt;li&gt;</a:documentation>
<element name="li">
<interleave>
<ref name="oli.inner"/>
<ref name="oli.attrs"/>
</interleave>
</element>
</define>
<define name="oli.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="oli.attrs.value"/>
</optional>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.listitem"/>
</choice>
</optional>
</interleave>
</define>
<define name="oli.attrs.value">
<attribute name="value">
<ref name="common.data.integer"/>
</attribute>
</define>
<define name="oli.inner">
<ref name="common.inner.flow"/>
</define>
<!-- ##################################################################### -->
<define name="dl.elem">
<a:documentation>Definition Lists</a:documentation>
<a:documentation>Definition List: &lt;dl&gt;</a:documentation>
<element name="dl">
<interleave>
<ref name="dl.inner"/>
<ref name="dl.attrs"/>
</interleave>
</element>
</define>
<define name="dl.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="dl.inner">
<zeroOrMore>
<oneOrMore>
<ref name="dt.elem"/>
</oneOrMore>
<oneOrMore>
<ref name="dd.elem"/>
</oneOrMore>
</zeroOrMore>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="dl.elem"/>
</define>
<define name="dt.elem">
<a:documentation>Definition Term: &lt;dt&gt;</a:documentation>
<element name="dt">
<interleave>
<ref name="dt.inner"/>
<ref name="dt.attrs"/>
</interleave>
</element>
</define>
<define name="dt.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="dt.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="dd.elem">
<a:documentation>Definition Description: &lt;dd&gt;</a:documentation>
<element name="dd">
<interleave>
<ref name="dd.inner"/>
<ref name="dd.attrs"/>
</interleave>
</element>
</define>
<define name="dd.elem.phrasing">
<element name="dd">
<interleave>
<ref name="dd.inner.phrasing"/>
<ref name="dd.attrs"/>
</interleave>
</element>
</define>
<define name="dd.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="dd.inner">
<ref name="common.inner.flow"/>
</define>
<define name="dd.inner.phrasing">
<ref name="common.inner.phrasing"/>
</define>
<!-- ##################################################################### -->
<define name="div.elem">
<a:documentation>Miscellaneous Elements</a:documentation>
<a:documentation>Generic Container: &lt;div&gt;</a:documentation>
<element name="div">
<interleave>
<ref name="div.inner"/>
<ref name="div.attrs"/>
</interleave>
</element>
</define>
<define name="div.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="div.inner">
<zeroOrMore>
<ref name="style.elem.scoped"/>
</zeroOrMore>
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="div.elem"/>
</define>
<define name="legend.elem">
<a:documentation>Title or Explanatory Caption: &lt;legend&gt;</a:documentation>
<element name="legend">
<interleave>
<ref name="legend.inner"/>
<ref name="legend.attrs"/>
</interleave>
</element>
</define>
<define name="legend.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.region"/>
</optional>
</interleave>
</define>
<define name="legend.inner">
<ref name="common.inner.phrasing"/>
</define>
</grammar>

View File

@ -1,393 +0,0 @@
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
# #####################################################################
## 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.flow =
( text & common.elem.flow* ) # REVISIT <style scoped>
# #####################################################################
## 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.xml-id
)? # REVISIT assuming only either one is allowed
& common.attrs.class?
& common.attrs.title?
& common.attrs.base?
& common.attrs.space?
)
common.attrs.id =
attribute id {
common.data.id
}
common.attrs.xml-id =
attribute xml:id {
xsd:NCName
} & XMLonly
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" # REVISIT this is not allowed per spec
} & XMLonly
common.attrs.i18n =
( common.attrs.dir?
& common.attrs.language?
)
common.attrs.dir =
attribute dir {
w:string "ltr" | w:string "rtl"
}
# 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.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
## IRIs
common.data.uri =
w:string "" | 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
## Microdata Identifier
common.data.microdata-identifier =
w:microdata-identifier
## Zero
common.data.zero =
w:zero
# #####################################################################
## WF2 Module Hook #
# #####################################################################
common-form.attrs.form = ( notAllowed )
# #####################################################################
## ARIA Module Hooks #
# #####################################################################
common.attrs.aria = ( notAllowed )
common.attrs.aria.implicit.button = ( notAllowed )
common.attrs.aria.implicit.input = ( notAllowed )
common.attrs.aria.implicit.region = ( notAllowed )
common.attrs.aria.implicit.group = ( notAllowed )
common.attrs.aria.implicit.th = ( notAllowed )
common.attrs.aria.implicit.structure = ( notAllowed )
common.attrs.aria.implicit.link = ( notAllowed )
common.attrs.aria.implicit.listitem = ( notAllowed )
common.attrs.aria.implicit.img = ( notAllowed )
common.attrs.aria.implicit.select = ( 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.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 )

536
html5-syntax/common.rng Normal file
View File

@ -0,0 +1,536 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- ##################################################################### -->
<define name="XMLonly">
<a:documentation> RELAX NG Schema for HTML 5: Common Definitions #</a:documentation>
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<a:documentation> Language Parameters - redefine in inclusion block as necessary #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>HTML vs. XHTML restrictions</a:documentation>
<empty/>
</define>
<define name="HTMLonly">
<notAllowed/>
</define>
<!--
(This only affects mixed-version modules; wholly HTML5
modules should simply be left out of the inclusion list.)
-->
<define name="v5only">
<a:documentation>HTML 4 Compatibility - set to notAllowed to disallow markup introduced in HTML 5</a:documentation>
<empty/>
</define>
<!-- (xml:base on elements other than <html>) -->
<define name="nonRoundtrippable">
<a:documentation>HTML Compatibility Switches - set to notAllowed to disallow</a:documentation>
<a:documentation>XML features that can't be roundtripped HTML &lt;-&gt; XHTML</a:documentation>
<empty/>
</define>
<define name="nonHTMLizable">
<a:documentation>XML features that can't be serialized as HTML</a:documentation>
<empty/>
</define>
<!-- ##################################################################### -->
<define name="common.attr.anything">
<a:documentation> Wildcards #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Any attribute from any namespace</a:documentation>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
</define>
<define name="common.elem.anything">
<a:documentation>Any element from any namespace</a:documentation>
<element>
<anyName/>
<interleave>
<ref name="common.inner.anything"/>
<ref name="common.attr.anything"/>
</interleave>
</element>
</define>
<define name="common.inner.anything">
<a:documentation>Any content from any namespace</a:documentation>
<interleave>
<text/>
<zeroOrMore>
<ref name="common.elem.anything"/>
</zeroOrMore>
</interleave>
</define>
<!-- ##################################################################### -->
<define name="common.elem.metadata">
<a:documentation> Common Element Classes #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Metadata Elements</a:documentation>
<notAllowed/>
</define>
<define name="common.elem.phrasing">
<a:documentation>Phrase Elements</a:documentation>
<notAllowed/>
</define>
<define name="common.elem.flow">
<a:documentation>Prose Elements</a:documentation>
<ref name="common.elem.phrasing"/>
</define>
<!-- ##################################################################### -->
<define name="common.inner.metadata">
<a:documentation> Common Content Models #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Metadata Content</a:documentation>
<zeroOrMore>
<ref name="common.elem.metadata"/>
</zeroOrMore>
</define>
<define name="common.inner.phrasing">
<a:documentation>Phrase Content</a:documentation>
<interleave>
<text/>
<zeroOrMore>
<ref name="common.elem.phrasing"/>
</zeroOrMore>
</interleave>
</define>
<define name="common.inner.flow">
<a:documentation>Prose Content</a:documentation>
<interleave>
<text/>
<zeroOrMore>
<ref name="common.elem.flow"/>
</zeroOrMore>
</interleave>
</define>
<!-- REVISIT <style scoped> -->
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<!-- When updating, check <bdo> definition too -->
<define name="common.attrs">
<a:documentation> Common Attributes #</a:documentation>
<interleave>
<ref name="common.attrs.basic"/>
<ref name="common.attrs.i18n"/>
<ref name="common.attrs.present"/>
<ref name="common.attrs.other"/>
</interleave>
</define>
<define name="common.attrs.basic">
<interleave>
<optional>
<choice>
<ref name="common.attrs.id"/>
<ref name="common.attrs.xml-id"/>
</choice>
</optional>
<optional>
<!-- REVISIT assuming only either one is allowed -->
<ref name="common.attrs.class"/>
</optional>
<optional>
<ref name="common.attrs.title"/>
</optional>
<optional>
<ref name="common.attrs.base"/>
</optional>
<optional>
<ref name="common.attrs.space"/>
</optional>
</interleave>
</define>
<define name="common.attrs.id">
<attribute name="id">
<ref name="common.data.id"/>
</attribute>
</define>
<define name="common.attrs.xml-id">
<interleave>
<attribute name="xml:id">
<data type="NCName"/>
</attribute>
<ref name="XMLonly"/>
</interleave>
</define>
<define name="common.attrs.class">
<attribute name="class">
<ref name="common.data.tokens"/>
</attribute>
</define>
<define name="common.attrs.title">
<attribute name="title"/>
</define>
<define name="common.attrs.base">
<interleave>
<ref name="common.attrs.xmlbase"/>
<ref name="nonRoundtrippable"/>
</interleave>
</define>
<define name="common.attrs.xmlbase">
<interleave>
<attribute name="xml:base">
<ref name="common.data.uri"/>
</attribute>
<ref name="XMLonly"/>
</interleave>
</define>
<define name="common.attrs.space">
<ref name="common.attrs.xmlspace"/>
</define>
<define name="common.attrs.xmlspace">
<interleave>
<attribute name="xml:space">
<value type="string" datatypeLibrary="">preserve</value>
<!-- REVISIT this is not allowed per spec -->
</attribute>
<ref name="XMLonly"/>
</interleave>
</define>
<define name="common.attrs.i18n">
<interleave>
<optional>
<ref name="common.attrs.dir"/>
</optional>
<optional>
<ref name="common.attrs.language"/>
</optional>
</interleave>
</define>
<define name="common.attrs.dir">
<attribute name="dir">
<choice>
<value type="string" datatypeLibrary="http://whattf.org/datatype-draft">ltr</value>
<value type="string" datatypeLibrary="http://whattf.org/datatype-draft">rtl</value>
</choice>
</attribute>
</define>
<!--
This lang definition is a hack for enviroments where
the HTML5 parser maps lang to xml:lang.
Sameness check left to Schematron
-->
<define name="common.attrs.language">
<interleave>
<optional>
<ref name="common.attrs.xmllang"/>
</optional>
<optional>
<ref name="common.attrs.lang"/>
</optional>
</interleave>
</define>
<define name="common.attrs.lang">
<interleave>
<attribute name="lang">
<ref name="common.data.langcode"/>
</attribute>
<ref name="XMLonly"/>
</interleave>
</define>
<define name="common.attrs.xmllang">
<attribute name="xml:lang">
<ref name="common.data.langcode"/>
</attribute>
</define>
<!--
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
-->
<define name="common.attrs.present">
<interleave>
<optional>
<ref name="common.attrs.style"/>
</optional>
<optional>
<ref name="common.attrs.tabindex"/>
</optional>
<optional>
<ref name="common.attrs.accesskey"/>
</optional>
</interleave>
</define>
<define name="common.attrs.style">
<attribute name="style">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="common.attrs.tabindex">
<attribute name="tabindex">
<ref name="common.data.integer"/>
</attribute>
</define>
<!-- REVISIT move style to a module and bundle tabindex with ARIA -->
<define name="common.attrs.accesskey">
<attribute name="accesskey">
<ref name="common.data.keylabellist"/>
</attribute>
</define>
<define name="common.attrs.other">
<empty/>
</define>
<!-- ##################################################################### -->
<define name="common.data.tokens">
<a:documentation> Common Datatypes #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Names and Tokens</a:documentation>
<list>
<zeroOrMore>
<data type="token" datatypeLibrary=""/>
</zeroOrMore>
</list>
</define>
<define name="common.data.browsing-context">
<data type="browsing-context" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.browsing-context-or-keyword">
<data type="browsing-context-or-keyword" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!--
xsd:string {
pattern = "()|([^_].*)|(_[bB][lL][aA][nN][kK])|(_[sS][eE][lL][fF])|(_[pP][aA][rR][eE][nN][tT])|(_[tT][oO][pP])"
}
-->
<define name="common.data.id">
<a:documentation>IDs and IDREFs</a:documentation>
<data type="ID" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!--
xsd:string {
pattern = "\S+"
}
-->
<define name="common.data.idref">
<data type="IDREF" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.idrefs">
<data type="IDREFS" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.name">
<data type="ID" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!-- FIXME -->
<define name="common.data.hash-name">
<data type="hash-name" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!--
xsd:string {
pattern = "#.+"
}
-->
<define name="common.data.integer">
<a:documentation>Numerical</a:documentation>
<data type="integer" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!--
xsd:string {
pattern = "-?[0-9]+"
}
-->
<define name="common.data.integer.positive">
<data type="integer-positive" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!--
xsd:string {
pattern = "0*[1-9][0-9]*"
}
-->
<define name="common.data.integer.non-negative">
<data type="integer-non-negative" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!--
xsd:string {
pattern = "[0-9]+"
}
-->
<!--
common.data.percent =
xsd:string {
pattern = "(100)|([1-9]?[0-9](\.[0-9]+)?)%"
}
-->
<define name="common.data.float">
<data type="float" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!--
xsd:string {
pattern = "-?[0-9]+(\.[0-9]+)?([eE]-?[0-9]+)?"
}
-->
<define name="common.data.float.positive">
<data type="float-positive" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!--
xsd:string {
pattern = "(0*[1-9][0-9]*(\.[0-9]+)?)|([0-9]+(\.0*[1-9][0-9]*)?)([eE]-?[0-9]+)?"
}
-->
<define name="common.data.float.non-negative">
<data type="float-non-negative" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!--
xsd:string {
pattern = "[0-9]+(\.[0-9]+)?([eE]-?[0-9]+)?"
}
-->
<define name="common.data.datetime">
<a:documentation>Temporal</a:documentation>
<data type="datetime-tz" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.date-or-time">
<data type="date-or-time" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.uri">
<a:documentation>IRIs</a:documentation>
<choice>
<value type="string" datatypeLibrary="http://whattf.org/datatype-draft"/>
<data type="iri-ref" datatypeLibrary="http://whattf.org/datatype-draft"/>
</choice>
</define>
<define name="common.data.uris">
<list>
<zeroOrMore>
<data type="iri-ref" datatypeLibrary="http://whattf.org/datatype-draft"/>
</zeroOrMore>
</list>
</define>
<define name="common.data.uri.absolute">
<data type="iri" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.sizes">
<a:documentation>&lt;link type='icon'&gt; sizes</a:documentation>
<!-- list { w:sizes } -->
<list>
<oneOrMore>
<data type="string">
<param name="pattern">[1-9][0-9]*x[1-9][0-9]*</param>
</data>
</oneOrMore>
</list>
</define>
<define name="common.data.mimetype">
<a:documentation>MIME types</a:documentation>
<data type="mime-type" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.charset">
<a:documentation>Encodings</a:documentation>
<data type="charset" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.meta-charset">
<data type="meta-charset" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.refresh">
<a:documentation>Refresh</a:documentation>
<data type="refresh" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.default-style">
<a:documentation>Default style</a:documentation>
<data type="string" datatypeLibrary=""/>
</define>
<!-- w:default-style -->
<define name="common.data.mediaquery">
<a:documentation>Media Queries</a:documentation>
<data type="media-query" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.langcode">
<a:documentation>Language Codes</a:documentation>
<choice>
<value type="string" datatypeLibrary="http://whattf.org/datatype-draft"/>
<data type="language" datatypeLibrary="http://whattf.org/datatype-draft"/>
</choice>
</define>
<define name="common.data.keylabellist">
<a:documentation>List of Key Labels</a:documentation>
<data type="keylabellist" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.microdata-identifier">
<a:documentation>Microdata Identifier</a:documentation>
<data type="microdata-identifier" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<define name="common.data.zero">
<a:documentation>Zero</a:documentation>
<data type="zero" datatypeLibrary="http://whattf.org/datatype-draft"/>
</define>
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<define name="common-form.attrs.form">
<a:documentation> WF2 Module Hook #</a:documentation>
<notAllowed/>
</define>
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<define name="common.attrs.aria">
<a:documentation> ARIA Module Hooks #</a:documentation>
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.button">
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.input">
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.region">
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.group">
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.th">
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.structure">
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.link">
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.listitem">
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.img">
<notAllowed/>
</define>
<define name="common.attrs.aria.implicit.select">
<notAllowed/>
</define>
<define name="common.attrs.aria.landmark.application">
<notAllowed/>
</define>
<define name="common.attrs.aria.landmark.banner">
<notAllowed/>
</define>
<define name="common.attrs.aria.landmark.complementary">
<notAllowed/>
</define>
<define name="common.attrs.aria.landmark.contentinfo">
<notAllowed/>
</define>
<define name="common.attrs.aria.landmark.main">
<notAllowed/>
</define>
<define name="common.attrs.aria.landmark.navigation">
<notAllowed/>
</define>
<define name="common.attrs.aria.landmark.search">
<notAllowed/>
</define>
<!-- per ARIA spec: article, document, and note are not actually landmarks -->
<define name="common.attrs.aria.landmark.article">
<notAllowed/>
</define>
<define name="common.attrs.aria.landmark.document">
<notAllowed/>
</define>
<define name="common.attrs.aria.landmark.note">
<notAllowed/>
</define>
</grammar>

View File

@ -1,331 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Core Scripting #
# #####################################################################
# #####################################################################
## Scripting Elements
## Inline Scripts: <script>
script.elem.embedded =
element script { script.inner.embedded & script.attrs.embedded }
script.attrs.embedded =
( common.attrs
& script.attrs.type?
& script.attrs.language? # restricted in Schematron
)
script.elem.imported =
element script { script.inner.imported & script.attrs.imported }
script.attrs.imported =
( common.attrs
& script.attrs.src
& script.attrs.defer?
& script.attrs.async?
& script.attrs.type?
& script.attrs.charset?
& script.attrs.language? # restricted in Schematron
)
script.attrs.src =
attribute src {
common.data.uri
}
script.attrs.defer =
attribute defer {
w:string "defer" | w:string ""
}
script.attrs.async =
attribute async {
w:string "async" | w:string ""
} & v5only
script.attrs.type =
attribute type {
common.data.mimetype # XXX without charset parameter!
}
script.attrs.charset =
attribute charset {
common.data.charset
}
script.attrs.language =
attribute language {
string
}
script.inner.embedded =
( common.inner.anything )
script.inner.imported =
( common.inner.anything )
script.elem =
( script.elem.embedded
| script.elem.imported
)
common.elem.metadata |= script.elem
common.elem.phrasing |= script.elem
## Fallback Unscripted Content: <noscript>
noscript.elem.head =
element noscript { noscript.inner.head & noscript.attrs }
& HTMLonly
noscript.inner.head =
( link.elem
| meta.http-equiv.default-style.elem
| meta.http-equiv.refresh.elem
| style.elem
)*
noscript.elem.phrasing =
element noscript { noscript.inner.phrasing & noscript.attrs }
& HTMLonly
noscript.inner.phrasing =
( common.inner.phrasing )
noscript.elem.flow =
element noscript { noscript.inner.flow & noscript.attrs }
& HTMLonly
noscript.inner.flow =
( common.inner.flow )
noscript.attrs =
( common.attrs )
common.elem.metadata |= noscript.elem.head
common.elem.phrasing |= noscript.elem.phrasing
common.elem.flow |= noscript.elem.flow
# #####################################################################
## Event Handler Attribute Definitions
common.attrs.scripting &=
( scripting.attr.onabort?
& scripting.attr.onblur?
& scripting.attr.oncanplay?
& scripting.attr.oncanplaythrough?
& scripting.attr.onchange?
& scripting.attr.onclick?
& scripting.attr.oncontextmenu?
& scripting.attr.ondblclick?
& scripting.attr.ondrag?
& scripting.attr.ondragend?
& scripting.attr.ondragenter?
& scripting.attr.ondragleave?
& scripting.attr.ondragover?
& scripting.attr.ondragstart?
& scripting.attr.ondrop?
& scripting.attr.ondurationchange?
& scripting.attr.onemptied?
& scripting.attr.onended?
& scripting.attr.onerror?
& scripting.attr.onfocus?
& scripting.attr.onformchange?
& scripting.attr.onforminput?
& scripting.attr.oninput?
& scripting.attr.oninvalid?
& scripting.attr.onkeydown?
& scripting.attr.onkeypress?
& scripting.attr.onkeyup?
& scripting.attr.onload?
& scripting.attr.onloadeddata?
& scripting.attr.onloadedmetadata?
& scripting.attr.onloadstart?
& scripting.attr.onmousedown?
& scripting.attr.onmousemove?
& scripting.attr.onmouseout?
& scripting.attr.onmouseover?
& scripting.attr.onmouseup?
& scripting.attr.onmousewheel?
& scripting.attr.onpause?
& scripting.attr.onplay?
& scripting.attr.onplaying?
& scripting.attr.onprogress?
& scripting.attr.onratechange?
& scripting.attr.onreadystatechange?
& scripting.attr.onscroll?
& scripting.attr.onseeked?
& scripting.attr.onseeking?
& scripting.attr.onselect?
& scripting.attr.onshow?
& scripting.attr.onstalled?
& scripting.attr.onsubmit?
& scripting.attr.onsuspend?
& scripting.attr.ontimeupdate?
& scripting.attr.onvolumechange?
& scripting.attr.onwaiting?
)
common.attrs.other &= common.attrs.scripting
scripting.attr.onabort =
attribute onabort { string }
scripting.attr.onblur =
attribute onblur { string }
scripting.attr.oncanplay =
attribute oncanplay { string }
scripting.attr.oncanplaythrough =
attribute oncanplaythrough { string }
scripting.attr.onchange =
attribute onchange { string }
scripting.attr.onclick =
attribute onclick { string }
scripting.attr.oncontextmenu =
attribute oncontextmenu { string }
scripting.attr.ondblclick =
attribute ondblclick { string }
scripting.attr.ondrag =
attribute ondrag { string }
scripting.attr.ondragend =
attribute ondragend { string }
scripting.attr.ondragenter =
attribute ondragenter { string }
scripting.attr.ondragleave =
attribute ondragleave { string }
scripting.attr.ondragover =
attribute ondragover { string }
scripting.attr.ondragstart =
attribute ondragstart { string }
scripting.attr.ondrop =
attribute ondrop { string }
scripting.attr.ondurationchange =
attribute ondurationchange { string }
scripting.attr.onemptied =
attribute onemptied { string }
scripting.attr.onended =
attribute onended { string }
scripting.attr.onerror =
attribute onerror { string }
scripting.attr.onfocus =
attribute onfocus { string }
scripting.attr.onformchange =
attribute onformchange { string }
scripting.attr.onforminput =
attribute onforminput { string }
scripting.attr.oninput =
attribute oninput { string }
scripting.attr.oninvalid =
attribute oninvalid { string }
scripting.attr.onkeydown =
attribute onkeydown { string }
scripting.attr.onkeypress =
attribute onkeypress { string }
scripting.attr.onkeyup =
attribute onkeyup { string }
scripting.attr.onload =
attribute onload { string }
scripting.attr.onloadeddata =
attribute onloadeddata { string }
scripting.attr.onloadedmetadata =
attribute onloadedmetadata { string }
scripting.attr.onloadstart =
attribute onloadstart { string }
scripting.attr.onmousedown =
attribute onmousedown { string }
scripting.attr.onmousemove =
attribute onmousemove { string }
scripting.attr.onmouseout =
attribute onmouseout { string }
scripting.attr.onmouseover =
attribute onmouseover { string }
scripting.attr.onmouseup =
attribute onmouseup { string }
scripting.attr.onmousewheel =
attribute onmousewheel { string }
scripting.attr.onpause =
attribute onpause { string }
scripting.attr.onplay =
attribute onplay { string }
scripting.attr.onplaying =
attribute onplaying { string }
scripting.attr.onprogress =
attribute onprogress { string }
scripting.attr.onratechange =
attribute onratechange { string }
scripting.attr.onreadystatechange =
attribute onreadystatechange { string }
scripting.attr.onscroll =
attribute onscroll { string }
scripting.attr.onseeked =
attribute onseeked { string }
scripting.attr.onseeking =
attribute onseeking { string }
scripting.attr.onselect =
attribute onselect { string }
scripting.attr.onshow =
attribute onshow { string }
scripting.attr.onstalled =
attribute onstalled { string }
scripting.attr.onsubmit =
attribute onsubmit { string }
scripting.attr.onsuspend =
attribute onsuspend { string }
scripting.attr.ontimeupdate =
attribute ontimeupdate { string }
scripting.attr.onvolumechange =
attribute onvolumechange { string }
scripting.attr.onwaiting =
attribute onwaiting { string }
# scripting.attr.common =
# ( scripting.attr.mouse
# & scripting.attr.keyboard
# & scripting.attr.focus
# )
#
# scripting.attr.mouse =
# ( scripting.attr.mouse.click?
# & scripting.attr.mouse.dblclick?
# & scripting.attr.mouse.down?
# & scripting.attr.mouse.up?
# & scripting.attr.mouse.over?
# & scripting.attr.mouse.move?
# & scripting.attr.mouse.out?
# )
# scripting.attr.mouse.click =
# attribute onclick { string }
# scripting.attr.mouse.dblclick =
# attribute ondblclick { string }
# scripting.attr.mouse.down =
# attribute onmousedown { string }
# scripting.attr.mouse.up =
# attribute onmouseup { string }
# scripting.attr.mouse.over =
# attribute onmouseover { string }
# scripting.attr.mouse.move =
# attribute onmousemove { string }
# scripting.attr.mouse.out =
# attribute onmouseout { string }
#
# scripting.attr.keyboard =
# ( scripting.attr.keyboard.press?
# & scripting.attr.keyboard.down?
# & scripting.attr.keyboard.up?
# )
# scripting.attr.keyboard.press =
# attribute onkeypress { string }
# scripting.attr.keyboard.down =
# attribute onkeydown { string }
# scripting.attr.keyboard.up =
# attribute onkeyup { string }
#
#
# scripting.attr.focus =
# ( scripting.attr.focus.gain?
# & scripting.attr.focus.lose?
# )
# scripting.attr.focus.gain =
# attribute onfocus { string }
# scripting.attr.focus.lose =
# attribute onblur { string }
#
# scripting.attr.loading =
# ( scripting.attr.loading.load?
# & scripting.attr.loading.unload?
# )
# scripting.attr.loading.load =
# attribute onload { string }
# scripting.attr.loading.unload =
# attribute onunload { string }
# #####################################################################
# Event Handler Attribute Assignments
# body.attrs &= scripting.attr.loading

View File

@ -0,0 +1,687 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<define name="script.elem.embedded">
<a:documentation> RELAX NG Schema for HTML 5: Core Scripting #</a:documentation>
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<a:documentation>Scripting Elements</a:documentation>
<a:documentation>Inline Scripts: &lt;script&gt;</a:documentation>
<element name="script">
<interleave>
<ref name="script.inner.embedded"/>
<ref name="script.attrs.embedded"/>
</interleave>
</element>
</define>
<define name="script.attrs.embedded">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="script.attrs.type"/>
</optional>
<optional>
<ref name="script.attrs.language"/>
</optional>
</interleave>
<!-- restricted in Schematron -->
</define>
<define name="script.elem.imported">
<element name="script">
<interleave>
<ref name="script.inner.imported"/>
<ref name="script.attrs.imported"/>
</interleave>
</element>
</define>
<define name="script.attrs.imported">
<interleave>
<ref name="common.attrs"/>
<ref name="script.attrs.src"/>
<optional>
<ref name="script.attrs.defer"/>
</optional>
<optional>
<ref name="script.attrs.async"/>
</optional>
<optional>
<ref name="script.attrs.type"/>
</optional>
<optional>
<ref name="script.attrs.charset"/>
</optional>
<optional>
<ref name="script.attrs.language"/>
</optional>
</interleave>
<!-- restricted in Schematron -->
</define>
<define name="script.attrs.src">
<attribute name="src">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="script.attrs.defer">
<attribute name="defer">
<choice>
<value type="string">defer</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="script.attrs.async">
<interleave>
<attribute name="async">
<choice>
<value type="string">async</value>
<value type="string"/>
</choice>
</attribute>
<ref name="v5only"/>
</interleave>
</define>
<define name="script.attrs.type">
<attribute name="type">
<ref name="common.data.mimetype"/>
<!-- XXX without charset parameter! -->
</attribute>
</define>
<define name="script.attrs.charset">
<attribute name="charset">
<ref name="common.data.charset"/>
</attribute>
</define>
<define name="script.attrs.language">
<attribute name="language">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="script.inner.embedded">
<ref name="common.inner.anything"/>
</define>
<define name="script.inner.imported">
<ref name="common.inner.anything"/>
</define>
<define name="script.elem">
<choice>
<ref name="script.elem.embedded"/>
<ref name="script.elem.imported"/>
</choice>
</define>
<define name="common.elem.metadata" combine="choice">
<ref name="script.elem"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="script.elem"/>
</define>
<define name="noscript.elem.head">
<a:documentation>Fallback Unscripted Content: &lt;noscript&gt;</a:documentation>
<interleave>
<element name="noscript">
<interleave>
<ref name="noscript.inner.head"/>
<ref name="noscript.attrs"/>
</interleave>
</element>
<ref name="HTMLonly"/>
</interleave>
</define>
<define name="noscript.inner.head">
<zeroOrMore>
<choice>
<ref name="link.elem"/>
<ref name="meta.http-equiv.default-style.elem"/>
<ref name="meta.http-equiv.refresh.elem"/>
<ref name="style.elem"/>
</choice>
</zeroOrMore>
</define>
<define name="noscript.elem.phrasing">
<interleave>
<element name="noscript">
<interleave>
<ref name="noscript.inner.phrasing"/>
<ref name="noscript.attrs"/>
</interleave>
</element>
<ref name="HTMLonly"/>
</interleave>
</define>
<define name="noscript.inner.phrasing">
<ref name="common.inner.phrasing"/>
</define>
<define name="noscript.elem.flow">
<interleave>
<element name="noscript">
<interleave>
<ref name="noscript.inner.flow"/>
<ref name="noscript.attrs"/>
</interleave>
</element>
<ref name="HTMLonly"/>
</interleave>
</define>
<define name="noscript.inner.flow">
<ref name="common.inner.flow"/>
</define>
<define name="noscript.attrs">
<ref name="common.attrs"/>
</define>
<define name="common.elem.metadata" combine="choice">
<ref name="noscript.elem.head"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="noscript.elem.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="noscript.elem.flow"/>
</define>
<!-- ##################################################################### -->
<define name="common.attrs.scripting" combine="interleave">
<a:documentation>Event Handler Attribute Definitions</a:documentation>
<interleave>
<optional>
<ref name="scripting.attr.onabort"/>
</optional>
<optional>
<ref name="scripting.attr.onblur"/>
</optional>
<optional>
<ref name="scripting.attr.oncanplay"/>
</optional>
<optional>
<ref name="scripting.attr.oncanplaythrough"/>
</optional>
<optional>
<ref name="scripting.attr.onchange"/>
</optional>
<optional>
<ref name="scripting.attr.onclick"/>
</optional>
<optional>
<ref name="scripting.attr.oncontextmenu"/>
</optional>
<optional>
<ref name="scripting.attr.ondblclick"/>
</optional>
<optional>
<ref name="scripting.attr.ondrag"/>
</optional>
<optional>
<ref name="scripting.attr.ondragend"/>
</optional>
<optional>
<ref name="scripting.attr.ondragenter"/>
</optional>
<optional>
<ref name="scripting.attr.ondragleave"/>
</optional>
<optional>
<ref name="scripting.attr.ondragover"/>
</optional>
<optional>
<ref name="scripting.attr.ondragstart"/>
</optional>
<optional>
<ref name="scripting.attr.ondrop"/>
</optional>
<optional>
<ref name="scripting.attr.ondurationchange"/>
</optional>
<optional>
<ref name="scripting.attr.onemptied"/>
</optional>
<optional>
<ref name="scripting.attr.onended"/>
</optional>
<optional>
<ref name="scripting.attr.onerror"/>
</optional>
<optional>
<ref name="scripting.attr.onfocus"/>
</optional>
<optional>
<ref name="scripting.attr.onformchange"/>
</optional>
<optional>
<ref name="scripting.attr.onforminput"/>
</optional>
<optional>
<ref name="scripting.attr.oninput"/>
</optional>
<optional>
<ref name="scripting.attr.oninvalid"/>
</optional>
<optional>
<ref name="scripting.attr.onkeydown"/>
</optional>
<optional>
<ref name="scripting.attr.onkeypress"/>
</optional>
<optional>
<ref name="scripting.attr.onkeyup"/>
</optional>
<optional>
<ref name="scripting.attr.onload"/>
</optional>
<optional>
<ref name="scripting.attr.onloadeddata"/>
</optional>
<optional>
<ref name="scripting.attr.onloadedmetadata"/>
</optional>
<optional>
<ref name="scripting.attr.onloadstart"/>
</optional>
<optional>
<ref name="scripting.attr.onmousedown"/>
</optional>
<optional>
<ref name="scripting.attr.onmousemove"/>
</optional>
<optional>
<ref name="scripting.attr.onmouseout"/>
</optional>
<optional>
<ref name="scripting.attr.onmouseover"/>
</optional>
<optional>
<ref name="scripting.attr.onmouseup"/>
</optional>
<optional>
<ref name="scripting.attr.onmousewheel"/>
</optional>
<optional>
<ref name="scripting.attr.onpause"/>
</optional>
<optional>
<ref name="scripting.attr.onplay"/>
</optional>
<optional>
<ref name="scripting.attr.onplaying"/>
</optional>
<optional>
<ref name="scripting.attr.onprogress"/>
</optional>
<optional>
<ref name="scripting.attr.onratechange"/>
</optional>
<optional>
<ref name="scripting.attr.onreadystatechange"/>
</optional>
<optional>
<ref name="scripting.attr.onscroll"/>
</optional>
<optional>
<ref name="scripting.attr.onseeked"/>
</optional>
<optional>
<ref name="scripting.attr.onseeking"/>
</optional>
<optional>
<ref name="scripting.attr.onselect"/>
</optional>
<optional>
<ref name="scripting.attr.onshow"/>
</optional>
<optional>
<ref name="scripting.attr.onstalled"/>
</optional>
<optional>
<ref name="scripting.attr.onsubmit"/>
</optional>
<optional>
<ref name="scripting.attr.onsuspend"/>
</optional>
<optional>
<ref name="scripting.attr.ontimeupdate"/>
</optional>
<optional>
<ref name="scripting.attr.onvolumechange"/>
</optional>
<optional>
<ref name="scripting.attr.onwaiting"/>
</optional>
</interleave>
</define>
<define name="common.attrs.other" combine="interleave">
<ref name="common.attrs.scripting"/>
</define>
<define name="scripting.attr.onabort">
<attribute name="onabort">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onblur">
<attribute name="onblur">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.oncanplay">
<attribute name="oncanplay">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.oncanplaythrough">
<attribute name="oncanplaythrough">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onchange">
<attribute name="onchange">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onclick">
<attribute name="onclick">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.oncontextmenu">
<attribute name="oncontextmenu">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ondblclick">
<attribute name="ondblclick">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ondrag">
<attribute name="ondrag">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ondragend">
<attribute name="ondragend">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ondragenter">
<attribute name="ondragenter">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ondragleave">
<attribute name="ondragleave">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ondragover">
<attribute name="ondragover">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ondragstart">
<attribute name="ondragstart">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ondrop">
<attribute name="ondrop">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ondurationchange">
<attribute name="ondurationchange">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onemptied">
<attribute name="onemptied">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onended">
<attribute name="onended">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onerror">
<attribute name="onerror">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onfocus">
<attribute name="onfocus">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onformchange">
<attribute name="onformchange">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onforminput">
<attribute name="onforminput">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.oninput">
<attribute name="oninput">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.oninvalid">
<attribute name="oninvalid">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onkeydown">
<attribute name="onkeydown">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onkeypress">
<attribute name="onkeypress">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onkeyup">
<attribute name="onkeyup">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onload">
<attribute name="onload">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onloadeddata">
<attribute name="onloadeddata">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onloadedmetadata">
<attribute name="onloadedmetadata">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onloadstart">
<attribute name="onloadstart">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onmousedown">
<attribute name="onmousedown">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onmousemove">
<attribute name="onmousemove">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onmouseout">
<attribute name="onmouseout">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onmouseover">
<attribute name="onmouseover">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onmouseup">
<attribute name="onmouseup">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onmousewheel">
<attribute name="onmousewheel">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onpause">
<attribute name="onpause">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onplay">
<attribute name="onplay">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onplaying">
<attribute name="onplaying">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onprogress">
<attribute name="onprogress">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onratechange">
<attribute name="onratechange">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onreadystatechange">
<attribute name="onreadystatechange">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onscroll">
<attribute name="onscroll">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onseeked">
<attribute name="onseeked">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onseeking">
<attribute name="onseeking">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onselect">
<attribute name="onselect">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onshow">
<attribute name="onshow">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onstalled">
<attribute name="onstalled">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onsubmit">
<attribute name="onsubmit">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onsuspend">
<attribute name="onsuspend">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.ontimeupdate">
<attribute name="ontimeupdate">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onvolumechange">
<attribute name="onvolumechange">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="scripting.attr.onwaiting">
<attribute name="onwaiting">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
</grammar>
<!--
scripting.attr.common =
( scripting.attr.mouse
& scripting.attr.keyboard
& scripting.attr.focus
)
scripting.attr.mouse =
( scripting.attr.mouse.click?
& scripting.attr.mouse.dblclick?
& scripting.attr.mouse.down?
& scripting.attr.mouse.up?
& scripting.attr.mouse.over?
& scripting.attr.mouse.move?
& scripting.attr.mouse.out?
)
scripting.attr.mouse.click =
attribute onclick { string }
scripting.attr.mouse.dblclick =
attribute ondblclick { string }
scripting.attr.mouse.down =
attribute onmousedown { string }
scripting.attr.mouse.up =
attribute onmouseup { string }
scripting.attr.mouse.over =
attribute onmouseover { string }
scripting.attr.mouse.move =
attribute onmousemove { string }
scripting.attr.mouse.out =
attribute onmouseout { string }
scripting.attr.keyboard =
( scripting.attr.keyboard.press?
& scripting.attr.keyboard.down?
& scripting.attr.keyboard.up?
)
scripting.attr.keyboard.press =
attribute onkeypress { string }
scripting.attr.keyboard.down =
attribute onkeydown { string }
scripting.attr.keyboard.up =
attribute onkeyup { string }
scripting.attr.focus =
( scripting.attr.focus.gain?
& scripting.attr.focus.lose?
)
scripting.attr.focus.gain =
attribute onfocus { string }
scripting.attr.focus.lose =
attribute onblur { string }
scripting.attr.loading =
( scripting.attr.loading.load?
& scripting.attr.loading.unload?
)
scripting.attr.loading.load =
attribute onload { string }
scripting.attr.loading.unload =
attribute onunload { string }
-->
<!--
#####################################################################
Event Handler Attribute Assignments
-->
<!-- body.attrs &= scripting.attr.loading -->

View File

@ -1,69 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Static Data Markup #
# #####################################################################
## Time: <time>
time.elem =
element time { time.inner & time.attrs }
time.attrs =
( common.attrs
& time.attrs.datetime?
& time.attrs.pubdate?
)
time.attrs.datetime =
attribute datetime {
common.data.date-or-time #REVISIT check format
}
time.attrs.pubdate =
attribute pubdate {
w:string "pubdate" | w:string ""
}
time.inner =
( common.inner.phrasing ) #Cannot enforce textContent format here
common.elem.phrasing |= time.elem
## Scalar Gauge: <meter>
meter.elem =
element meter { meter.inner & meter.attrs }
meter.attrs =
( common.attrs
& meter.attrs.value
& meter.attrs.min?
& meter.attrs.low?
& meter.attrs.high?
& meter.attrs.max?
& meter.attrs.optimum?
)
meter.attrs.value =
attribute value {
common.data.float
}
meter.attrs.min =
attribute min {
common.data.float
}
meter.attrs.low =
attribute low {
common.data.float
}
meter.attrs.high =
attribute high {
common.data.float
}
meter.attrs.max =
attribute max {
common.data.float
}
meter.attrs.optimum =
attribute optimum {
common.data.float
}
meter.inner =
( common.inner.phrasing ) #Cannot enforce textContent format here
common.elem.phrasing |= meter.elem

114
html5-syntax/data.rng Normal file
View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<define name="time.elem">
<a:documentation> RELAX NG Schema for HTML 5: Static Data Markup #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Time: &lt;time&gt;</a:documentation>
<element name="time">
<interleave>
<ref name="time.inner"/>
<ref name="time.attrs"/>
</interleave>
</element>
</define>
<define name="time.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="time.attrs.datetime"/>
</optional>
<optional>
<ref name="time.attrs.pubdate"/>
</optional>
</interleave>
</define>
<define name="time.attrs.datetime">
<attribute name="datetime">
<ref name="common.data.date-or-time"/>
<!-- REVISIT check format -->
</attribute>
</define>
<define name="time.attrs.pubdate">
<attribute name="pubdate">
<choice>
<value type="string">pubdate</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="time.inner">
<ref name="common.inner.phrasing"/>
</define>
<!-- Cannot enforce textContent format here -->
<define name="common.elem.phrasing" combine="choice">
<ref name="time.elem"/>
</define>
<define name="meter.elem">
<a:documentation>Scalar Gauge: &lt;meter&gt;</a:documentation>
<element name="meter">
<interleave>
<ref name="meter.inner"/>
<ref name="meter.attrs"/>
</interleave>
</element>
</define>
<define name="meter.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="meter.attrs.value"/>
<optional>
<ref name="meter.attrs.min"/>
</optional>
<optional>
<ref name="meter.attrs.low"/>
</optional>
<optional>
<ref name="meter.attrs.high"/>
</optional>
<optional>
<ref name="meter.attrs.max"/>
</optional>
<optional>
<ref name="meter.attrs.optimum"/>
</optional>
</interleave>
</define>
<define name="meter.attrs.value">
<attribute name="value">
<ref name="common.data.float"/>
</attribute>
</define>
<define name="meter.attrs.min">
<attribute name="min">
<ref name="common.data.float"/>
</attribute>
</define>
<define name="meter.attrs.low">
<attribute name="low">
<ref name="common.data.float"/>
</attribute>
</define>
<define name="meter.attrs.high">
<attribute name="high">
<ref name="common.data.float"/>
</attribute>
</define>
<define name="meter.attrs.max">
<attribute name="max">
<ref name="common.data.float"/>
</attribute>
</define>
<define name="meter.attrs.optimum">
<attribute name="optimum">
<ref name="common.data.float"/>
</attribute>
</define>
<define name="meter.inner">
<ref name="common.inner.phrasing"/>
</define>
<!-- Cannot enforce textContent format here -->
<define name="common.elem.phrasing" combine="choice">
<ref name="meter.elem"/>
</define>
</grammar>

View File

@ -1,565 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
namespace local = ""
# #####################################################################
## RELAX NG Schema for HTML 5: Embedded Content #
# #####################################################################
#######################################################################
## Replaced Content
## Images: <img>
img.elem =
element img { img.inner & img.attrs }
img.attrs =
( common.attrs
& img.attrs.src
& img.attrs.alt?
& img.attrs.height?
& img.attrs.width?
& img.attrs.usemap?
& img.attrs.ismap?
& img.attrs.border? # obsolete
& common.attrs.aria?
)
img.attrs.src =
attribute src {
common.data.uri
}
img.attrs.alt =
attribute alt {
text
}
img.attrs.height =
attribute height {
common.data.integer.non-negative
}
img.attrs.width =
attribute width {
common.data.integer.non-negative
}
img.attrs.usemap =
attribute usemap {
common.data.hash-name
}
img.attrs.ismap =
attribute ismap {
w:string "ismap" | w:string ""
}
img.attrs.border =
attribute border {
common.data.zero
}
img.inner =
empty
common.elem.phrasing |= img.elem
## Plug-ins: <embed>
embed.elem =
element embed { embed.inner & embed.attrs }
embed.attrs =
( common.attrs
& embed.attrs.src?
& embed.attrs.type?
& embed.attrs.height?
& embed.attrs.width?
& embed.attrs.other*
)
embed.attrs.src =
attribute src {
common.data.uri
}
embed.attrs.type =
attribute type {
common.data.mimetype
}
embed.attrs.height =
attribute height {
common.data.integer.non-negative
}
embed.attrs.width =
attribute width {
common.data.integer.non-negative
}
embed.attrs.other = # REVISIT common.attrs
attribute local:* - ( src
| type
| height
| width
| id
| class
| title
| dir
| lang
| style
| tabindex
| contextmenu
| contenteditable
| draggable
| hidden
| onabort
| onblur
| oncanplay
| oncanplaythrough
| onchange
| onclick
| oncontextmenu
| ondblclick
| ondrag
| ondragend
| ondragenter
| ondragleave
| ondragover
| ondragstart
| ondrop
| ondurationchange
| onemptied
| onended
| onerror
| onfocus
| onformchange
| onforminput
| oninput
| oninvalid
| onkeydown
| onkeypress
| onkeyup
| onload
| onloadeddata
| onloadedmetadata
| onloadstart
| onmousedown
| onmousemove
| onmouseout
| onmouseover
| onmouseup
| onmousewheel
| onpause
| onplay
| onplaying
| onprogress
| onratechange
| onreadystatechange
| onscroll
| onseeked
| onseeking
| onselect
| onshow
| onstalled
| onsubmit
| onsuspend
| ontimeupdate
| onvolumechange
| onwaiting
| onafterprint
| onbeforeprint
| onbeforeunload
| onhashchange
| onmessage
| onoffline
| ononline
| onpopstate
| onredo
| onresize
| onstorage
| onundo
| onunload
| role
| aria-atomic
| aria-busy
| aria-controls
| aria-describedby
| aria-disabled
| aria-dropeffect
| aria-flowto
| aria-grabbed
| aria-haspopup
| aria-hidden
| aria-invalid
| aria-label
| aria-labelledby
| aria-live
| aria-owns
| aria-relevant
| aria-required
| spellcheck
| accesskey
| itemref
| itemprop
| itemscope
| itemtype
| itemid
| name
| align
)
{
string
}
embed.inner =
empty
common.elem.phrasing |= embed.elem
## Generic Objects: <object>
object.elem.flow =
element object { object.inner.flow & object.attrs }
object.elem.phrasing =
element object { object.inner.phrasing & object.attrs }
object.attrs =
( common.attrs
& ( ( object.attrs.data
& object.attrs.type?
)
| object.attrs.type
)
# & object.attrs.classid?
# & object.attrs.codebase?
# & object.attrs.codetype?
& object.attrs.height?
& object.attrs.width?
& object.attrs.usemap?
& object.attrs.name?
& common-form.attrs.form?
& common.attrs.aria?
)
object.attrs.data =
attribute data {
common.data.uri
}
object.attrs.type =
attribute type {
common.data.mimetype
}
object.attrs.height =
attribute height {
common.data.integer.non-negative
}
object.attrs.width =
attribute width {
common.data.integer.non-negative
}
object.attrs.usemap =
attribute usemap {
common.data.hash-name
}
object.attrs.name =
attribute name {
common.data.browsing-context
}
object.inner.flow =
( param.elem*
, common.inner.flow
)
object.inner.phrasing =
( param.elem*
, common.inner.phrasing
)
common.elem.flow |= object.elem.flow
common.elem.phrasing |= object.elem.phrasing
## Initialization Parameters: <param>
param.elem =
element param { param.inner & param.attrs }
param.attrs =
( common.attrs
& param.attrs.name
& param.attrs.value
)
param.attrs.name =
attribute name {
string
}
param.attrs.value =
attribute value {
string
}
param.inner =
( empty )
## Inline Frame: <iframe>
iframe.elem =
element iframe { iframe.inner & iframe.attrs }
iframe.attrs =
( common.attrs
& iframe.attrs.src?
& iframe.attrs.name?
& iframe.attrs.width?
& iframe.attrs.height?
& iframe.attrs.sandbox?
& iframe.attrs.seamless?
& ( common.attrs.aria
| common.attrs.aria.implicit.region
)?
)
iframe.attrs.src =
attribute src {
common.data.uri
}
iframe.attrs.name =
attribute name {
common.data.browsing-context
}
iframe.attrs.height =
attribute height {
common.data.integer.non-negative
}
iframe.attrs.width =
attribute width {
common.data.integer.non-negative
}
iframe.attrs.seamless =
attribute seamless {
w:string "seamless" | w:string ""
} & v5only
iframe.attrs.sandbox =
attribute sandbox
{ list
{ ( w:string "allow-top-navigation" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-scripts" )?
}
| list
{ ( w:string "allow-top-navigation" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-forms" )?
}
| list
{ ( w:string "allow-top-navigation" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-scripts" )?
}
| list
{ ( w:string "allow-top-navigation" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-same-origin" )?
}
| list
{ ( w:string "allow-top-navigation" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-forms" )?
}
| list
{ ( w:string "allow-top-navigation" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-same-origin" )?
}
| list
{ ( w:string "allow-same-origin" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-scripts" )?
}
| list
{ ( w:string "allow-same-origin" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-forms" )?
}
| list
{ ( w:string "allow-forms" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-scripts" )?
}
| list
{ ( w:string "allow-forms" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-same-origin" )?
}
| list
{ ( w:string "allow-scripts" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-forms" )?
}
| list
{ ( w:string "allow-scripts" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-same-origin" )?
}
| list
{ ( w:string "allow-same-origin" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-scripts" )?
}
| list
{ ( w:string "allow-same-origin" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-forms" )?
}
| list
{ ( w:string "allow-forms" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-scripts" )?
}
| list
{ ( w:string "allow-forms" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-same-origin" )?
}
| list
{ ( w:string "allow-scripts" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-forms" )?
}
| list
{ ( w:string "allow-scripts" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-top-navigation" )?
, ( w:string "allow-same-origin" )?
}
| list
{ ( w:string "allow-same-origin" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-top-navigation" )?
}
| list
{ ( w:string "allow-same-origin" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-top-navigation" )?
}
| list
{ ( w:string "allow-forms" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-top-navigation" )?
}
| list
{ ( w:string "allow-forms" )?
, ( w:string "allow-scripts" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-top-navigation" )?
}
| list
{ ( w:string "allow-scripts" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-top-navigation" )?
}
| list
{ ( w:string "allow-scripts" )?
, ( w:string "allow-forms" )?
, ( w:string "allow-same-origin" )?
, ( w:string "allow-top-navigation" )?
}
} & v5only
iframe.inner =
( text )
common.elem.phrasing |= iframe.elem
#######################################################################
## Image Maps
## Map Definition: <map>
map.elem.flow =
element map { map.inner.flow & map.attrs }
map.elem.phrasing =
element map { map.inner.phrasing & map.attrs }
map.attrs =
( common.attrs
& map.attrs.name
) # REVISIT make id required in Schematron
map.attrs.name =
attribute name {
common.data.name
}
map.inner.flow =
( common.inner.flow )
map.inner.phrasing =
( common.inner.phrasing )
common.elem.flow |= map.elem.flow
common.elem.phrasing |= map.elem.phrasing
## Map Area Definition: <area>
area.elem =
element area { area.inner & area.attrs }
area.attrs =
( common.attrs
& ( area.attrs.alt
& shared-hyperlink.attrs.href
)?
& shared-hyperlink.attrs.target?
& shared-hyperlink.attrs.ping?
& shared-hyperlink.attrs.rel?
& shared-hyperlink.attrs.media?
& shared-hyperlink.attrs.hreflang?
& shared-hyperlink.attrs.type?
& area.attrs.shape?
)
area.attrs.alt =
attribute alt {
text
}
area.attrs.shape =
( ( area.attrs.shape.rect? & area.attrs.coords.rect )
| ( area.attrs.shape.circle & area.attrs.coords.circle )
| ( area.attrs.shape.poly & area.attrs.coords.poly )
| ( area.attrs.shape.default )
)
area.attrs.shape.rect =
attribute shape {
w:string "rect"
}
area.attrs.coords.rect =
attribute coords {
w:rectangle
# xsd:token {
# pattern = "-?[0-9]+,-?[0-9]+,-?[0-9]+,-?[0-9]+"
# }
}
area.attrs.shape.circle =
attribute shape {
w:string "circle"
}
area.attrs.coords.circle =
attribute coords {
w:circle
# xsd:token {
# pattern = "-?[0-9]+,-?[0-9]+,[0-9]+"
# }
}
area.attrs.shape.poly =
attribute shape {
w:string "poly"
}
area.attrs.coords.poly =
attribute coords {
w:polyline
# xsd:token {
# pattern = "-?[0-9]+,-?[0-9]+,-?[0-9]+,-?[0-9]+,-?[0-9]+,-?[0-9]+(,-?[0-9]+,-?[0-9]+)*"
# }
}
area.attrs.shape.default =
attribute shape {
w:string "default"
}
area.inner =
( empty )
common.elem.phrasing |= area.elem

974
html5-syntax/embed.rng Normal file
View File

@ -0,0 +1,974 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<define name="img.elem">
<a:documentation> RELAX NG Schema for HTML 5: Embedded Content #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>
Replaced Content</a:documentation>
<a:documentation>Images: &lt;img&gt;</a:documentation>
<element name="img">
<interleave>
<ref name="img.inner"/>
<ref name="img.attrs"/>
</interleave>
</element>
</define>
<define name="img.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="img.attrs.src"/>
<optional>
<ref name="img.attrs.alt"/>
</optional>
<optional>
<ref name="img.attrs.height"/>
</optional>
<optional>
<ref name="img.attrs.width"/>
</optional>
<optional>
<ref name="img.attrs.usemap"/>
</optional>
<optional>
<ref name="img.attrs.ismap"/>
</optional>
<optional>
<ref name="img.attrs.border"/>
</optional>
<optional>
<!-- obsolete -->
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="img.attrs.src">
<attribute name="src">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="img.attrs.alt">
<attribute name="alt"/>
</define>
<define name="img.attrs.height">
<attribute name="height">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="img.attrs.width">
<attribute name="width">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="img.attrs.usemap">
<attribute name="usemap">
<ref name="common.data.hash-name"/>
</attribute>
</define>
<define name="img.attrs.ismap">
<attribute name="ismap">
<choice>
<value type="string">ismap</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="img.attrs.border">
<attribute name="border">
<ref name="common.data.zero"/>
</attribute>
</define>
<define name="img.inner">
<empty/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="img.elem"/>
</define>
<define name="embed.elem">
<a:documentation>Plug-ins: &lt;embed&gt;</a:documentation>
<element name="embed">
<interleave>
<ref name="embed.inner"/>
<ref name="embed.attrs"/>
</interleave>
</element>
</define>
<define name="embed.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="embed.attrs.src"/>
</optional>
<optional>
<ref name="embed.attrs.type"/>
</optional>
<optional>
<ref name="embed.attrs.height"/>
</optional>
<optional>
<ref name="embed.attrs.width"/>
</optional>
<zeroOrMore>
<ref name="embed.attrs.other"/>
</zeroOrMore>
</interleave>
</define>
<define name="embed.attrs.src">
<attribute name="src">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="embed.attrs.type">
<attribute name="type">
<ref name="common.data.mimetype"/>
</attribute>
</define>
<define name="embed.attrs.height">
<attribute name="height">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="embed.attrs.width">
<attribute name="width">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="embed.attrs.other">
<!-- REVISIT common.attrs -->
<attribute>
<nsName ns="">
<except>
<name>src</name>
<name>type</name>
<name>height</name>
<name>width</name>
<name>id</name>
<name>class</name>
<name>title</name>
<name>dir</name>
<name>lang</name>
<name>style</name>
<name>tabindex</name>
<name>contextmenu</name>
<name>contenteditable</name>
<name>draggable</name>
<name>hidden</name>
<name>onabort</name>
<name>onblur</name>
<name>oncanplay</name>
<name>oncanplaythrough</name>
<name>onchange</name>
<name>onclick</name>
<name>oncontextmenu</name>
<name>ondblclick</name>
<name>ondrag</name>
<name>ondragend</name>
<name>ondragenter</name>
<name>ondragleave</name>
<name>ondragover</name>
<name>ondragstart</name>
<name>ondrop</name>
<name>ondurationchange</name>
<name>onemptied</name>
<name>onended</name>
<name>onerror</name>
<name>onfocus</name>
<name>onformchange</name>
<name>onforminput</name>
<name>oninput</name>
<name>oninvalid</name>
<name>onkeydown</name>
<name>onkeypress</name>
<name>onkeyup</name>
<name>onload</name>
<name>onloadeddata</name>
<name>onloadedmetadata</name>
<name>onloadstart</name>
<name>onmousedown</name>
<name>onmousemove</name>
<name>onmouseout</name>
<name>onmouseover</name>
<name>onmouseup</name>
<name>onmousewheel</name>
<name>onpause</name>
<name>onplay</name>
<name>onplaying</name>
<name>onprogress</name>
<name>onratechange</name>
<name>onreadystatechange</name>
<name>onscroll</name>
<name>onseeked</name>
<name>onseeking</name>
<name>onselect</name>
<name>onshow</name>
<name>onstalled</name>
<name>onsubmit</name>
<name>onsuspend</name>
<name>ontimeupdate</name>
<name>onvolumechange</name>
<name>onwaiting</name>
<name>onafterprint</name>
<name>onbeforeprint</name>
<name>onbeforeunload</name>
<name>onhashchange</name>
<name>onmessage</name>
<name>onoffline</name>
<name>ononline</name>
<name>onpopstate</name>
<name>onredo</name>
<name>onresize</name>
<name>onstorage</name>
<name>onundo</name>
<name>onunload</name>
<name>role</name>
<name>aria-atomic</name>
<name>aria-busy</name>
<name>aria-controls</name>
<name>aria-describedby</name>
<name>aria-disabled</name>
<name>aria-dropeffect</name>
<name>aria-flowto</name>
<name>aria-grabbed</name>
<name>aria-haspopup</name>
<name>aria-hidden</name>
<name>aria-invalid</name>
<name>aria-label</name>
<name>aria-labelledby</name>
<name>aria-live</name>
<name>aria-owns</name>
<name>aria-relevant</name>
<name>aria-required</name>
<name>spellcheck</name>
<name>accesskey</name>
<name>itemref</name>
<name>itemprop</name>
<name>itemscope</name>
<name>itemtype</name>
<name>itemid</name>
<name>name</name>
<name>align</name>
</except>
</nsName>
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="embed.inner">
<empty/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="embed.elem"/>
</define>
<define name="object.elem.flow">
<a:documentation>Generic Objects: &lt;object&gt;</a:documentation>
<element name="object">
<interleave>
<ref name="object.inner.flow"/>
<ref name="object.attrs"/>
</interleave>
</element>
</define>
<define name="object.elem.phrasing">
<element name="object">
<interleave>
<ref name="object.inner.phrasing"/>
<ref name="object.attrs"/>
</interleave>
</element>
</define>
<define name="object.attrs">
<interleave>
<ref name="common.attrs"/>
<choice>
<interleave>
<ref name="object.attrs.data"/>
<optional>
<ref name="object.attrs.type"/>
</optional>
</interleave>
<ref name="object.attrs.type"/>
</choice>
<optional>
<!--
& object.attrs.classid?
& object.attrs.codebase?
& object.attrs.codetype?
-->
<ref name="object.attrs.height"/>
</optional>
<optional>
<ref name="object.attrs.width"/>
</optional>
<optional>
<ref name="object.attrs.usemap"/>
</optional>
<optional>
<ref name="object.attrs.name"/>
</optional>
<optional>
<ref name="common-form.attrs.form"/>
</optional>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="object.attrs.data">
<attribute name="data">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="object.attrs.type">
<attribute name="type">
<ref name="common.data.mimetype"/>
</attribute>
</define>
<define name="object.attrs.height">
<attribute name="height">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="object.attrs.width">
<attribute name="width">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="object.attrs.usemap">
<attribute name="usemap">
<ref name="common.data.hash-name"/>
</attribute>
</define>
<define name="object.attrs.name">
<attribute name="name">
<ref name="common.data.browsing-context"/>
</attribute>
</define>
<define name="object.inner.flow">
<zeroOrMore>
<ref name="param.elem"/>
</zeroOrMore>
<ref name="common.inner.flow"/>
</define>
<define name="object.inner.phrasing">
<zeroOrMore>
<ref name="param.elem"/>
</zeroOrMore>
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="object.elem.flow"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="object.elem.phrasing"/>
</define>
<define name="param.elem">
<a:documentation>Initialization Parameters: &lt;param&gt;</a:documentation>
<element name="param">
<interleave>
<ref name="param.inner"/>
<ref name="param.attrs"/>
</interleave>
</element>
</define>
<define name="param.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="param.attrs.name"/>
<ref name="param.attrs.value"/>
</interleave>
</define>
<define name="param.attrs.name">
<attribute name="name">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="param.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="param.inner">
<empty/>
</define>
<define name="iframe.elem">
<a:documentation>Inline Frame: &lt;iframe&gt;</a:documentation>
<element name="iframe">
<interleave>
<ref name="iframe.inner"/>
<ref name="iframe.attrs"/>
</interleave>
</element>
</define>
<define name="iframe.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="iframe.attrs.src"/>
</optional>
<optional>
<ref name="iframe.attrs.name"/>
</optional>
<optional>
<ref name="iframe.attrs.width"/>
</optional>
<optional>
<ref name="iframe.attrs.height"/>
</optional>
<optional>
<ref name="iframe.attrs.sandbox"/>
</optional>
<optional>
<ref name="iframe.attrs.seamless"/>
</optional>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.region"/>
</choice>
</optional>
</interleave>
</define>
<define name="iframe.attrs.src">
<attribute name="src">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="iframe.attrs.name">
<attribute name="name">
<ref name="common.data.browsing-context"/>
</attribute>
</define>
<define name="iframe.attrs.height">
<attribute name="height">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="iframe.attrs.width">
<attribute name="width">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="iframe.attrs.seamless">
<interleave>
<attribute name="seamless">
<choice>
<value type="string">seamless</value>
<value type="string"/>
</choice>
</attribute>
<ref name="v5only"/>
</interleave>
</define>
<define name="iframe.attrs.sandbox">
<interleave>
<attribute name="sandbox">
<choice>
<list>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
</list>
<list>
<optional>
<value type="string">allow-scripts</value>
</optional>
<optional>
<value type="string">allow-forms</value>
</optional>
<optional>
<value type="string">allow-same-origin</value>
</optional>
<optional>
<value type="string">allow-top-navigation</value>
</optional>
</list>
</choice>
</attribute>
<ref name="v5only"/>
</interleave>
</define>
<define name="iframe.inner">
<text/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="iframe.elem"/>
</define>
<define name="map.elem.flow">
<a:documentation>
Image Maps</a:documentation>
<a:documentation>Map Definition: &lt;map&gt;</a:documentation>
<element name="map">
<interleave>
<ref name="map.inner.flow"/>
<ref name="map.attrs"/>
</interleave>
</element>
</define>
<define name="map.elem.phrasing">
<element name="map">
<interleave>
<ref name="map.inner.phrasing"/>
<ref name="map.attrs"/>
</interleave>
</element>
</define>
<define name="map.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="map.attrs.name"/>
</interleave>
</define>
<!-- REVISIT make id required in Schematron -->
<define name="map.attrs.name">
<attribute name="name">
<ref name="common.data.name"/>
</attribute>
</define>
<define name="map.inner.flow">
<ref name="common.inner.flow"/>
</define>
<define name="map.inner.phrasing">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="map.elem.flow"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="map.elem.phrasing"/>
</define>
<define name="area.elem">
<a:documentation>Map Area Definition: &lt;area&gt;</a:documentation>
<element name="area">
<interleave>
<ref name="area.inner"/>
<ref name="area.attrs"/>
</interleave>
</element>
</define>
<define name="area.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<interleave>
<ref name="area.attrs.alt"/>
<ref name="shared-hyperlink.attrs.href"/>
</interleave>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.target"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.ping"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.rel"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.media"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.hreflang"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.type"/>
</optional>
<optional>
<ref name="area.attrs.shape"/>
</optional>
</interleave>
</define>
<define name="area.attrs.alt">
<attribute name="alt"/>
</define>
<define name="area.attrs.shape">
<choice>
<interleave>
<optional>
<ref name="area.attrs.shape.rect"/>
</optional>
<ref name="area.attrs.coords.rect"/>
</interleave>
<interleave>
<ref name="area.attrs.shape.circle"/>
<ref name="area.attrs.coords.circle"/>
</interleave>
<interleave>
<ref name="area.attrs.shape.poly"/>
<ref name="area.attrs.coords.poly"/>
</interleave>
<ref name="area.attrs.shape.default"/>
</choice>
</define>
<define name="area.attrs.shape.rect">
<attribute name="shape">
<value type="string">rect</value>
</attribute>
</define>
<define name="area.attrs.coords.rect">
<attribute name="coords">
<data type="rectangle"/>
<!--
xsd:token {
pattern = "-?[0-9]+,-?[0-9]+,-?[0-9]+,-?[0-9]+"
}
-->
</attribute>
</define>
<define name="area.attrs.shape.circle">
<attribute name="shape">
<value type="string">circle</value>
</attribute>
</define>
<define name="area.attrs.coords.circle">
<attribute name="coords">
<data type="circle"/>
<!--
xsd:token {
pattern = "-?[0-9]+,-?[0-9]+,[0-9]+"
}
-->
</attribute>
</define>
<define name="area.attrs.shape.poly">
<attribute name="shape">
<value type="string">poly</value>
</attribute>
</define>
<define name="area.attrs.coords.poly">
<attribute name="coords">
<data type="polyline"/>
<!--
xsd:token {
pattern = "-?[0-9]+,-?[0-9]+,-?[0-9]+,-?[0-9]+,-?[0-9]+,-?[0-9]+(,-?[0-9]+,-?[0-9]+)*"
}
-->
</attribute>
</define>
<define name="area.attrs.shape.default">
<attribute name="shape">
<value type="string">default</value>
</attribute>
</define>
<define name="area.inner">
<empty/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="area.elem"/>
</define>
</grammar>

View File

@ -1,52 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Datatypes related to forms #
# #####################################################################
## MIME types
form.data.mimetypelist =
w:mime-type-list
form.data.charsetlist =
string # FIXME should be a "a space- and/or comma-delimited
# list of charset values"
## ECMAScript Regular Expression
form.data.pattern =
w:pattern
## Temporal
form.data.datetime-local =
w:datetime-local
form.data.date =
w:date
form.data.month =
w:month
form.data.week =
w:week
form.data.time =
w:time
## Email
form.data.emailaddress =
w:email-address
form.data.emailaddresslist =
w:email-address-list
## Color
form.data.color =
w:color
# xsd:string {
# pattern = "#[a-fA-F0-9]{6}"
# }

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<define name="form.data.mimetypelist">
<a:documentation> RELAX NG Schema for HTML 5: Datatypes related to forms #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>MIME types</a:documentation>
<data type="mime-type-list"/>
</define>
<define name="form.data.charsetlist">
<data type="string" datatypeLibrary=""/>
</define>
<!--
FIXME should be a "a space- and/or comma-delimited
list of charset values"
-->
<define name="form.data.pattern">
<a:documentation>ECMAScript Regular Expression</a:documentation>
<data type="pattern"/>
</define>
<define name="form.data.datetime-local">
<a:documentation>Temporal</a:documentation>
<data type="datetime-local"/>
</define>
<define name="form.data.date">
<data type="date"/>
</define>
<define name="form.data.month">
<data type="month"/>
</define>
<define name="form.data.week">
<data type="week"/>
</define>
<define name="form.data.time">
<data type="time"/>
</define>
<define name="form.data.emailaddress">
<a:documentation>Email</a:documentation>
<data type="email-address"/>
</define>
<define name="form.data.emailaddresslist">
<data type="email-address-list"/>
</define>
<define name="form.data.color">
<a:documentation>Color</a:documentation>
<data type="color"/>
</define>
</grammar>
<!--
xsd:string {
pattern = "#[a-fA-F0-9]{6}"
}
-->

View File

@ -1,56 +0,0 @@
default namespace = "http://www.w3.org/1999/xhtml"
# #####################################################################
## RELAX NG Schema for HTML 5 #
# #####################################################################
# To validate an HTML 5 document, you must first validate against #
# this schema and then ALSO validate against assertions.sch #
## HTML flavor RELAX NG schemas can only be used after the #
## document has been transformed to well-formed XML. #
## - Insert closing slashes in all empty element tags #
## - Insert all optional start and end tags #
## - Add xmlns "http://www.w3.org/1999/xhtml" #
## - Properly escape <script> and <style> CDATA #
## - Parse and transform all HTML-only entities to numeric #
## character references #
## Obviously, syntax-checking involving these features cannot be #
## done by the RELAX NG schema and must be checked, along with the #
## <!DOCTYPE> requirement, by some other application. #
# #####################################################################
## Schema Framework & Parameters
include "common.rnc" {
# XHTML flavor #
XMLonly = notAllowed
HTMLonly = empty
# HTML 4 compat #
v5only = empty
# HTML-serializability #
nonHTMLizable = notAllowed
# HTML-roundtrippability #
nonRoundtrippable = notAllowed
}
# #####################################################################
## Language Definitions
start = html.elem
include "meta.rnc"
include "phrase.rnc"
include "block.rnc"
include "sectional.rnc"
include "structural.rnc"
include "revision.rnc"
include "embed.rnc"
include "ruby.rnc"
include "media.rnc"
include "core-scripting.rnc"
include "tables.rnc"
include "form-datatypes.rnc"
include "web-forms.rnc"
include "web-forms2.rnc"
include "applications.rnc"
include "data.rnc"

65
html5-syntax/html5.rng Normal file
View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="http://www.w3.org/1999/xhtml" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<!-- ##################################################################### -->
<include href="common.rng">
<a:documentation> RELAX NG Schema for HTML 5 #</a:documentation>
<!-- ##################################################################### -->
<!--
To validate an HTML 5 document, you must first validate against #
this schema and then ALSO validate against assertions.sch #
-->
<a:documentation>HTML flavor RELAX NG schemas can only be used after the #
document has been transformed to well-formed XML. #
- Insert closing slashes in all empty element tags #
- Insert all optional start and end tags #
- Add xmlns "http://www.w3.org/1999/xhtml" #
- Properly escape &lt;script&gt; and &lt;style&gt; CDATA #
- Parse and transform all HTML-only entities to numeric #
character references #
Obviously, syntax-checking involving these features cannot be #
done by the RELAX NG schema and must be checked, along with the #
&lt;!DOCTYPE&gt; requirement, by some other application. #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Schema Framework &amp; Parameters</a:documentation>
<!-- XHTML flavor # -->
<define name="XMLonly">
<notAllowed/>
</define>
<define name="HTMLonly">
<empty/>
</define>
<!-- HTML 4 compat # -->
<define name="v5only">
<empty/>
</define>
<!-- HTML-serializability # -->
<define name="nonHTMLizable">
<notAllowed/>
</define>
<!-- HTML-roundtrippability # -->
<define name="nonRoundtrippable">
<notAllowed/>
</define>
</include>
<!-- ##################################################################### -->
<start>
<a:documentation>Language Definitions</a:documentation>
<ref name="html.elem"/>
</start>
<include href="meta.rng"/>
<include href="phrase.rng"/>
<include href="block.rng"/>
<include href="sectional.rng"/>
<include href="structural.rng"/>
<include href="revision.rng"/>
<include href="embed.rng"/>
<include href="ruby.rng"/>
<include href="media.rng"/>
<include href="core-scripting.rng"/>
<include href="tables.rng"/>
<include href="form-datatypes.rng"/>
<include href="web-forms.rng"/>
<include href="web-forms2.rng"/>
<include href="applications.rng"/>
<include href="data.rng"/>
</grammar>

View File

@ -1,63 +0,0 @@
default namespace = "http://www.w3.org/1999/xhtml"
# #####################################################################
## RELAX NG Schema for (X)HTML 5: Exclusions #
# #####################################################################
## This file is unmaintained. Please use assertions.sch instead.
# #####################################################################
## Schema Framework & Parameters
start = normal.elem.all-inclusive
# #####################################################################
## Normal Element Patterns
## Any attribute from any namespace
normal.attr.anything =
attribute * { text }*
## Any element from any namespace except exceptional elements,
## but allowing those elements as descendants
normal.elem.all =
element * - (dfn) {
normal.elem.all-inclusive
}
## Any element from any namespace including exceptional elements
normal.elem.all-inclusive =
wildcard.elem.exclude-all | dfn.elem.exclude-self
# #####################################################################
## Exclusion Element Patterns
# exclude all exceptional elements from the name classes;
# list them explicitly in content models instead
normal.elem.exclude-dfn =
element * - (dfn) {
normal.elem.exclude-dfn
}
dfn.elem.exclude-self =
element dfn {
( normal.attr.anything
& normal.elem.exclude-dfn
)
}
# FIXME this part was cut off -- hsivonen
wildcard.elem.exclude-all =
notAllowed
#FIXME no nested forms in HTML-serializable docs
#FIXME no nested labels
#FIXME no blockquote inside header or footer
#FIXME exactly one hn in header

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="http://www.w3.org/1999/xhtml" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<!-- ##################################################################### -->
<start>
<a:documentation> RELAX NG Schema for (X)HTML 5: Exclusions #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>This file is unmaintained. Please use assertions.sch instead.</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Schema Framework &amp; Parameters</a:documentation>
<ref name="normal.elem.all-inclusive"/>
</start>
<!-- ##################################################################### -->
<define name="normal.attr.anything">
<a:documentation> Normal Element Patterns</a:documentation>
<a:documentation>Any attribute from any namespace</a:documentation>
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
</define>
<define name="normal.elem.all">
<a:documentation>Any element from any namespace except exceptional elements,
but allowing those elements as descendants</a:documentation>
<element>
<anyName>
<except>
<name>dfn</name>
</except>
</anyName>
<ref name="normal.elem.all-inclusive"/>
</element>
</define>
<define name="normal.elem.all-inclusive">
<a:documentation>Any element from any namespace including exceptional elements</a:documentation>
<choice>
<ref name="wildcard.elem.exclude-all"/>
<ref name="dfn.elem.exclude-self"/>
</choice>
</define>
<!-- ##################################################################### -->
<!--
exclude all exceptional elements from the name classes;
list them explicitly in content models instead
-->
<define name="normal.elem.exclude-dfn">
<a:documentation> Exclusion Element Patterns</a:documentation>
<element>
<anyName>
<except>
<name>dfn</name>
</except>
</anyName>
<ref name="normal.elem.exclude-dfn"/>
</element>
</define>
<define name="dfn.elem.exclude-self">
<element name="dfn">
<interleave>
<ref name="normal.attr.anything"/>
<ref name="normal.elem.exclude-dfn"/>
</interleave>
</element>
</define>
<!-- FIXME this part was cut off - - hsivonen -->
<define name="wildcard.elem.exclude-all">
<notAllowed/>
</define>
</grammar>
<!-- FIXME no nested forms in HTML-serializable docs -->
<!-- FIXME no nested labels -->
<!-- FIXME no blockquote inside header or footer -->
<!-- FIXME exactly one hn in header -->

View File

@ -1,151 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Advanced Embedded Content #
# #####################################################################
## Attributes Common to Media Elements
# src not included
media.attrs =
( media.attrs.autoplay?
& media.attrs.preload?
& media.attrs.controls?
& media.attrs.loop?
)
media.attrs.autoplay =
attribute autoplay {
w:string "autoplay" | w:string ""
}
media.attrs.preload =
attribute preload {
w:string "none" | w:string "metadata" | w:string "auto" | w:string ""
}
media.attrs.controls =
attribute controls {
w:string "controls" | w:string ""
}
media.attrs.loop =
attribute loop {
w:string "loop" | w:string ""
}
## Source: <source>
source.elem =
element source { source.inner & source.attrs }
source.attrs =
( common.attrs
& source.attrs.src
& source.attrs.type?
& source.attrs.media?
)
source.attrs.src =
attribute src {
common.data.uri
}
source.attrs.type =
attribute type {
common.data.mimetype
}
source.attrs.media =
attribute media {
common.data.mediaquery
}
source.inner =
( empty )
## Media Source
media.source =
( media.attrs.src
| source.elem*
)
media.attrs.src =
attribute src {
common.data.uri
}
## Video: <video>
video.elem.flow =
element video { video.inner.flow & video.attrs }
video.elem.phrasing =
element video { video.inner.phrasing & video.attrs }
video.attrs =
( common.attrs
& media.attrs
& video.attrs.poster?
& video.attrs.height?
& video.attrs.width?
)
video.attrs.poster =
attribute poster {
common.data.uri
}
video.attrs.height =
attribute height {
common.data.integer.non-negative
}
video.attrs.width =
attribute width {
common.data.integer.non-negative
}
video.inner.flow =
( media.source
, common.inner.flow
)
video.inner.phrasing =
( media.source
, common.inner.phrasing
)
common.elem.flow |= video.elem.flow
common.elem.phrasing |= video.elem.phrasing
## Audio: <audio>
audio.elem.flow =
element audio { audio.inner.flow & audio.attrs }
audio.elem.phrasing =
element audio { audio.inner.phrasing & audio.attrs }
audio.attrs =
( common.attrs
& media.attrs
)
audio.inner.flow =
( media.source
, common.inner.flow
)
audio.inner.phrasing =
( media.source
, common.inner.phrasing
)
common.elem.flow |= audio.elem.flow
common.elem.phrasing |= audio.elem.phrasing
## Captioned Content: <figure>
figure.elem =
element figure { figure.inner & figure.attrs }
figure.attrs =
( common.attrs
& common.attrs.aria.implicit.img?
)
figure.inner =
( ( figcaption.elem, common.inner.flow )
| ( common.inner.flow, figcaption.elem? )
)
common.elem.flow |= figure.elem
## Figure caption: <figcaption>
figcaption.elem =
element figcaption { figcaption.inner & figcaption.attrs }
figcaption.attrs =
( common.attrs )
figcaption.inner =
( common.inner.flow )

258
html5-syntax/media.rng Normal file
View File

@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<!-- src not included -->
<define name="media.attrs">
<a:documentation> RELAX NG Schema for HTML 5: Advanced Embedded Content #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Attributes Common to Media Elements</a:documentation>
<interleave>
<optional>
<ref name="media.attrs.autoplay"/>
</optional>
<optional>
<ref name="media.attrs.preload"/>
</optional>
<optional>
<ref name="media.attrs.controls"/>
</optional>
<optional>
<ref name="media.attrs.loop"/>
</optional>
</interleave>
</define>
<define name="media.attrs.autoplay">
<attribute name="autoplay">
<choice>
<value type="string">autoplay</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="media.attrs.preload">
<attribute name="preload">
<choice>
<value type="string">none</value>
<value type="string">metadata</value>
<value type="string">auto</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="media.attrs.controls">
<attribute name="controls">
<choice>
<value type="string">controls</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="media.attrs.loop">
<attribute name="loop">
<choice>
<value type="string">loop</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="source.elem">
<a:documentation>Source: &lt;source&gt;</a:documentation>
<element name="source">
<interleave>
<ref name="source.inner"/>
<ref name="source.attrs"/>
</interleave>
</element>
</define>
<define name="source.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="source.attrs.src"/>
<optional>
<ref name="source.attrs.type"/>
</optional>
<optional>
<ref name="source.attrs.media"/>
</optional>
</interleave>
</define>
<define name="source.attrs.src">
<attribute name="src">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="source.attrs.type">
<attribute name="type">
<ref name="common.data.mimetype"/>
</attribute>
</define>
<define name="source.attrs.media">
<attribute name="media">
<ref name="common.data.mediaquery"/>
</attribute>
</define>
<define name="source.inner">
<empty/>
</define>
<define name="media.source">
<a:documentation>Media Source</a:documentation>
<choice>
<ref name="media.attrs.src"/>
<zeroOrMore>
<ref name="source.elem"/>
</zeroOrMore>
</choice>
</define>
<define name="media.attrs.src">
<attribute name="src">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="video.elem.flow">
<a:documentation>Video: &lt;video&gt;</a:documentation>
<element name="video">
<interleave>
<ref name="video.inner.flow"/>
<ref name="video.attrs"/>
</interleave>
</element>
</define>
<define name="video.elem.phrasing">
<element name="video">
<interleave>
<ref name="video.inner.phrasing"/>
<ref name="video.attrs"/>
</interleave>
</element>
</define>
<define name="video.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="media.attrs"/>
<optional>
<ref name="video.attrs.poster"/>
</optional>
<optional>
<ref name="video.attrs.height"/>
</optional>
<optional>
<ref name="video.attrs.width"/>
</optional>
</interleave>
</define>
<define name="video.attrs.poster">
<attribute name="poster">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="video.attrs.height">
<attribute name="height">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="video.attrs.width">
<attribute name="width">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="video.inner.flow">
<ref name="media.source"/>
<ref name="common.inner.flow"/>
</define>
<define name="video.inner.phrasing">
<ref name="media.source"/>
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="video.elem.flow"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="video.elem.phrasing"/>
</define>
<define name="audio.elem.flow">
<a:documentation>Audio: &lt;audio&gt;</a:documentation>
<element name="audio">
<interleave>
<ref name="audio.inner.flow"/>
<ref name="audio.attrs"/>
</interleave>
</element>
</define>
<define name="audio.elem.phrasing">
<element name="audio">
<interleave>
<ref name="audio.inner.phrasing"/>
<ref name="audio.attrs"/>
</interleave>
</element>
</define>
<define name="audio.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="media.attrs"/>
</interleave>
</define>
<define name="audio.inner.flow">
<ref name="media.source"/>
<ref name="common.inner.flow"/>
</define>
<define name="audio.inner.phrasing">
<ref name="media.source"/>
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="audio.elem.flow"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="audio.elem.phrasing"/>
</define>
<define name="figure.elem">
<a:documentation>Captioned Content: &lt;figure&gt;</a:documentation>
<element name="figure">
<interleave>
<ref name="figure.inner"/>
<ref name="figure.attrs"/>
</interleave>
</element>
</define>
<define name="figure.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.img"/>
</optional>
</interleave>
</define>
<define name="figure.inner">
<choice>
<group>
<ref name="figcaption.elem"/>
<ref name="common.inner.flow"/>
</group>
<group>
<ref name="common.inner.flow"/>
<optional>
<ref name="figcaption.elem"/>
</optional>
</group>
</choice>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="figure.elem"/>
</define>
<define name="figcaption.elem">
<a:documentation>Figure caption: &lt;figcaption&gt;</a:documentation>
<element name="figcaption">
<interleave>
<ref name="figcaption.inner"/>
<ref name="figcaption.attrs"/>
</interleave>
</element>
</define>
<define name="figcaption.attrs">
<ref name="common.attrs"/>
</define>
<define name="figcaption.inner">
<ref name="common.inner.flow"/>
</define>
</grammar>

View File

@ -1,331 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Global Structure & Metadata #
# #####################################################################
## Root Element: <html>
html.elem =
element html { html.inner & html.attrs }
html.attrs =
( common.attrs )
html.inner =
( head.elem
, body.elem
)
## Metadata Container: <head>
head.elem =
element head { head.inner & head.attrs }
head.attrs =
( common.attrs
# & head.attrs.profile?
)
# head.attrs.profile =
# attribute profile {
# common.data.uris #REVISIT should these be absolute (zero or more)
# }
head.inner =
( title.elem
& base.elem? # REVISIT need a non-schema checker or Schematron
& common.inner.metadata # Limit encoding decl position in Schematron
)
# head.inner =
# ( meta.elem.encoding?
# , ( title.elem
# & base.elem? # REVISIT need a non-schema checker or Schematron
# & common.inner.metadata
# )
# )
## Content Container: <body>
body.elem =
element body { body.inner & body.attrs }
body.attrs =
( common.attrs
& ( common.attrs.aria.landmark.application
| common.attrs.aria.landmark.document
| common.attrs.aria.implicit.structure
)?
& body.attrs.onafterprint?
& body.attrs.onbeforeprint?
& body.attrs.onbeforeunload?
& body.attrs.onhashchange?
& body.attrs.onmessage?
& body.attrs.onoffline?
& body.attrs.ononline?
& body.attrs.onpopstate?
& body.attrs.onredo?
& body.attrs.onresize?
& body.attrs.onstorage?
& body.attrs.onundo?
& body.attrs.onunload?
)
body.inner =
( common.inner.flow )
body.attrs.onafterprint =
attribute onafterprint { string }
body.attrs.onbeforeprint =
attribute onbeforeprint { string }
body.attrs.onbeforeunload =
attribute onbeforeunload { string }
body.attrs.onhashchange =
attribute onhashchange { string }
body.attrs.onmessage =
attribute onmessage { string }
body.attrs.onoffline =
attribute onoffline { string }
body.attrs.ononline =
attribute ononline { string }
body.attrs.onpopstate =
attribute onpopstate { string }
body.attrs.onredo =
attribute onredo { string }
body.attrs.onresize =
attribute onresize { string }
body.attrs.onstorage =
attribute onstorage { string }
body.attrs.onundo =
attribute onundo { string }
body.attrs.onunload =
attribute onunload { string }
## Document Title: <title>
title.elem =
element title { title.inner & title.attrs }
title.attrs =
( common.attrs )
title.inner =
( text )
## Base URI: <base>
base.elem =
element base { base.inner & base.attrs }
base.attrs =
( common.attrs
& ( ( base.attrs.href
& base.attrs.target?
)
| base.attrs.target
)
)
base.attrs.href =
attribute href {
common.data.uri
}
base.attrs.target =
attribute target {
common.data.browsing-context-or-keyword
}
base.inner =
( empty )
## Global Relationships: <link>
link.elem =
element link { link.inner & link.attrs }
link.attrs =
( common.attrs
& shared-hyperlink.attrs.href
& shared-hyperlink.attrs.rel
& shared-hyperlink.attrs.hreflang?
& shared-hyperlink.attrs.media?
& shared-hyperlink.attrs.type?
& link.attrs.sizes?
# link.attrs.title included in common.attrs
)
link.attrs.sizes =
attribute sizes {
w:string "any" | common.data.sizes
}
link.inner =
( empty )
common.elem.metadata |= link.elem
## Global Style: <style>
style.elem =
element style { style.inner & style.attrs }
style.attrs =
( common.attrs
& style.attrs.type?
& style.attrs.media?
# style.attrs.title included in common.attrs
)
style.attrs.type =
attribute type {
common.data.mimetype
}
style.attrs.media =
attribute media {
common.data.mediaquery
}
style.inner =
( common.inner.anything )
common.elem.metadata |= style.elem
## Scoped Style: <style scoped>
style.elem.scoped =
element style { style.inner & style.scoped.attrs }
style.scoped.attrs =
( common.attrs
& style.attrs.type?
& style.attrs.media?
& style.attrs.scoped
# style.attrs.title included in common.attrs
)
style.attrs.scoped =
attribute scoped {
w:string "scoped" | w:string ""
}
## Name-Value Metadata: <meta name>
meta.name.elem =
element meta { meta.inner & meta.name.attrs }
meta.name.attrs =
( common.attrs.basic
& common.attrs.i18n
& common.attrs.present
& common.attrs.other
& meta.name.attrs.name
& meta.name.attrs.content
)
meta.name.attrs.name =
attribute name {
string
}
meta.name.attrs.content =
attribute content {
string
}
meta.inner =
( empty )
common.elem.metadata |= meta.name.elem
## "refresh" pragma directive: <meta http-equiv='refresh'>
meta.http-equiv.refresh.elem =
element meta { meta.inner & meta.http-equiv.refresh.attrs }
meta.http-equiv.refresh.attrs =
( common.attrs.basic
& common.attrs.i18n
& common.attrs.present
& common.attrs.other
& meta.http-equiv.attrs.http-equiv.refresh
& meta.http-equiv.attrs.content.refresh
)
meta.http-equiv.attrs.http-equiv.refresh =
attribute http-equiv {
w:string "refresh"
}
meta.http-equiv.attrs.content.refresh =
attribute content {
common.data.refresh
}
common.elem.metadata |= meta.http-equiv.refresh.elem # not quite right per spec
# if the definition is
# reused in another language
## "default-style" pragma directive: <meta http-equiv='default-style'>
meta.http-equiv.default-style.elem =
element meta { meta.inner & meta.http-equiv.default-style.attrs }
meta.http-equiv.default-style.attrs =
( common.attrs.basic
& common.attrs.i18n
& common.attrs.present
& common.attrs.other
& meta.http-equiv.attrs.http-equiv.default-style
& meta.http-equiv.attrs.content.default-style
)
meta.http-equiv.attrs.http-equiv.default-style =
attribute http-equiv {
w:string "default-style"
}
meta.http-equiv.attrs.content.default-style =
attribute content {
common.data.default-style
}
common.elem.metadata |= meta.http-equiv.default-style.elem # not quite right per spec
# if the definition is
# reused in another language
## "content-language" pragma directive: <meta http-equiv='content-language'> (obsolete)
meta.http-equiv.content-language.elem =
element meta { meta.inner & meta.http-equiv.content-language.attrs }
meta.http-equiv.content-language.attrs =
( common.attrs.basic
& common.attrs.i18n
& common.attrs.present
& common.attrs.other
& meta.http-equiv.attrs.http-equiv.content-language
& meta.http-equiv.attrs.content.content-language
)
meta.http-equiv.attrs.http-equiv.content-language =
attribute http-equiv {
w:string "content-language"
}
meta.http-equiv.attrs.content.content-language =
attribute content {
common.data.langcode
}
common.elem.metadata |= meta.http-equiv.content-language.elem # not quite right per spec
# if the definition is
# reused in another language
## Inline Character Encoding Statement for HTML: <meta charset>
meta.charset.elem =
element meta { meta.inner & meta.charset.attrs }
meta.charset.attrs =
( common.attrs.basic
& common.attrs.i18n
& common.attrs.present
& common.attrs.other
& meta.charset.attrs.charset
)
meta.charset.attrs.charset =
attribute charset {
(common.data.charset & HTMLonly)
| (xsd:string {
pattern = "[uU][tT][fF]-8"
} & XMLonly )
}
## Inline Character Encoding Statement for HTML: <meta http-equiv='content-type'>
meta.http-equiv.content-type.elem =
element meta { meta.inner & meta.http-equiv.content-type.attrs }
& HTMLonly
meta.http-equiv.content-type.attrs =
( common.attrs.basic
& common.attrs.i18n
& common.attrs.present
& common.attrs.other
& meta.http-equiv.attrs.http-equiv.content-type
& meta.http-equiv.attrs.content.content-type
)
meta.http-equiv.attrs.http-equiv.content-type =
attribute http-equiv {
w:string "content-type"
}
meta.http-equiv.attrs.content.content-type =
attribute content {
common.data.meta-charset
}
common.elem.metadata |= ( meta.charset.elem | meta.http-equiv.content-type.elem )

568
html5-syntax/meta.rng Normal file
View File

@ -0,0 +1,568 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<define name="html.elem">
<a:documentation> RELAX NG Schema for HTML 5: Global Structure &amp; Metadata #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Root Element: &lt;html&gt;</a:documentation>
<element name="html">
<interleave>
<ref name="html.inner"/>
<ref name="html.attrs"/>
</interleave>
</element>
</define>
<define name="html.attrs">
<ref name="common.attrs"/>
</define>
<define name="html.inner">
<ref name="head.elem"/>
<ref name="body.elem"/>
</define>
<define name="head.elem">
<a:documentation>Metadata Container: &lt;head&gt;</a:documentation>
<element name="head">
<interleave>
<ref name="head.inner"/>
<ref name="head.attrs"/>
</interleave>
</element>
</define>
<define name="head.attrs">
<ref name="common.attrs"/>
<!-- & head.attrs.profile? -->
</define>
<!--
head.attrs.profile =
attribute profile {
common.data.uris #REVISIT should these be absolute (zero or more)
}
-->
<define name="head.inner">
<interleave>
<ref name="title.elem"/>
<optional>
<ref name="base.elem"/>
</optional>
<!-- REVISIT need a non-schema checker or Schematron -->
<ref name="common.inner.metadata"/>
</interleave>
<!-- Limit encoding decl position in Schematron -->
</define>
<!--
head.inner =
( meta.elem.encoding?
, ( title.elem
& base.elem? # REVISIT need a non-schema checker or Schematron
& common.inner.metadata
)
)
-->
<define name="body.elem">
<a:documentation>Content Container: &lt;body&gt;</a:documentation>
<element name="body">
<interleave>
<ref name="body.inner"/>
<ref name="body.attrs"/>
</interleave>
</element>
</define>
<define name="body.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<choice>
<ref name="common.attrs.aria.landmark.application"/>
<ref name="common.attrs.aria.landmark.document"/>
<ref name="common.attrs.aria.implicit.structure"/>
</choice>
</optional>
<optional>
<ref name="body.attrs.onafterprint"/>
</optional>
<optional>
<ref name="body.attrs.onbeforeprint"/>
</optional>
<optional>
<ref name="body.attrs.onbeforeunload"/>
</optional>
<optional>
<ref name="body.attrs.onhashchange"/>
</optional>
<optional>
<ref name="body.attrs.onmessage"/>
</optional>
<optional>
<ref name="body.attrs.onoffline"/>
</optional>
<optional>
<ref name="body.attrs.ononline"/>
</optional>
<optional>
<ref name="body.attrs.onpopstate"/>
</optional>
<optional>
<ref name="body.attrs.onredo"/>
</optional>
<optional>
<ref name="body.attrs.onresize"/>
</optional>
<optional>
<ref name="body.attrs.onstorage"/>
</optional>
<optional>
<ref name="body.attrs.onundo"/>
</optional>
<optional>
<ref name="body.attrs.onunload"/>
</optional>
</interleave>
</define>
<define name="body.inner">
<ref name="common.inner.flow"/>
</define>
<define name="body.attrs.onafterprint">
<attribute name="onafterprint">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onbeforeprint">
<attribute name="onbeforeprint">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onbeforeunload">
<attribute name="onbeforeunload">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onhashchange">
<attribute name="onhashchange">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onmessage">
<attribute name="onmessage">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onoffline">
<attribute name="onoffline">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.ononline">
<attribute name="ononline">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onpopstate">
<attribute name="onpopstate">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onredo">
<attribute name="onredo">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onresize">
<attribute name="onresize">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onstorage">
<attribute name="onstorage">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onundo">
<attribute name="onundo">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="body.attrs.onunload">
<attribute name="onunload">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="title.elem">
<a:documentation>Document Title: &lt;title&gt;</a:documentation>
<element name="title">
<interleave>
<ref name="title.inner"/>
<ref name="title.attrs"/>
</interleave>
</element>
</define>
<define name="title.attrs">
<ref name="common.attrs"/>
</define>
<define name="title.inner">
<text/>
</define>
<define name="base.elem">
<a:documentation>Base URI: &lt;base&gt;</a:documentation>
<element name="base">
<interleave>
<ref name="base.inner"/>
<ref name="base.attrs"/>
</interleave>
</element>
</define>
<define name="base.attrs">
<interleave>
<ref name="common.attrs"/>
<choice>
<interleave>
<ref name="base.attrs.href"/>
<optional>
<ref name="base.attrs.target"/>
</optional>
</interleave>
<ref name="base.attrs.target"/>
</choice>
</interleave>
</define>
<define name="base.attrs.href">
<attribute name="href">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="base.attrs.target">
<attribute name="target">
<ref name="common.data.browsing-context-or-keyword"/>
</attribute>
</define>
<define name="base.inner">
<empty/>
</define>
<define name="link.elem">
<a:documentation>Global Relationships: &lt;link&gt;</a:documentation>
<element name="link">
<interleave>
<ref name="link.inner"/>
<ref name="link.attrs"/>
</interleave>
</element>
</define>
<define name="link.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="shared-hyperlink.attrs.href"/>
<ref name="shared-hyperlink.attrs.rel"/>
<optional>
<ref name="shared-hyperlink.attrs.hreflang"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.media"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.type"/>
</optional>
<optional>
<ref name="link.attrs.sizes"/>
</optional>
</interleave>
<!-- link.attrs.title included in common.attrs -->
</define>
<define name="link.attrs.sizes">
<attribute name="sizes">
<choice>
<value type="string">any</value>
<ref name="common.data.sizes"/>
</choice>
</attribute>
</define>
<define name="link.inner">
<empty/>
</define>
<define name="common.elem.metadata" combine="choice">
<ref name="link.elem"/>
</define>
<define name="style.elem">
<a:documentation>Global Style: &lt;style&gt;</a:documentation>
<element name="style">
<interleave>
<ref name="style.inner"/>
<ref name="style.attrs"/>
</interleave>
</element>
</define>
<define name="style.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="style.attrs.type"/>
</optional>
<optional>
<ref name="style.attrs.media"/>
</optional>
</interleave>
<!-- style.attrs.title included in common.attrs -->
</define>
<define name="style.attrs.type">
<attribute name="type">
<ref name="common.data.mimetype"/>
</attribute>
</define>
<define name="style.attrs.media">
<attribute name="media">
<ref name="common.data.mediaquery"/>
</attribute>
</define>
<define name="style.inner">
<ref name="common.inner.anything"/>
</define>
<define name="common.elem.metadata" combine="choice">
<ref name="style.elem"/>
</define>
<define name="style.elem.scoped">
<a:documentation>Scoped Style: &lt;style scoped&gt;</a:documentation>
<element name="style">
<interleave>
<ref name="style.inner"/>
<ref name="style.scoped.attrs"/>
</interleave>
</element>
</define>
<define name="style.scoped.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="style.attrs.type"/>
</optional>
<optional>
<ref name="style.attrs.media"/>
</optional>
<ref name="style.attrs.scoped"/>
</interleave>
<!-- style.attrs.title included in common.attrs -->
</define>
<define name="style.attrs.scoped">
<attribute name="scoped">
<choice>
<value type="string">scoped</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="meta.name.elem">
<a:documentation>Name-Value Metadata: &lt;meta name&gt;</a:documentation>
<element name="meta">
<interleave>
<ref name="meta.inner"/>
<ref name="meta.name.attrs"/>
</interleave>
</element>
</define>
<define name="meta.name.attrs">
<interleave>
<ref name="common.attrs.basic"/>
<ref name="common.attrs.i18n"/>
<ref name="common.attrs.present"/>
<ref name="common.attrs.other"/>
<ref name="meta.name.attrs.name"/>
<ref name="meta.name.attrs.content"/>
</interleave>
</define>
<define name="meta.name.attrs.name">
<attribute name="name">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="meta.name.attrs.content">
<attribute name="content">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="meta.inner">
<empty/>
</define>
<define name="common.elem.metadata" combine="choice">
<ref name="meta.name.elem"/>
</define>
<define name="meta.http-equiv.refresh.elem">
<a:documentation>"refresh" pragma directive: &lt;meta http-equiv='refresh'&gt;</a:documentation>
<element name="meta">
<interleave>
<ref name="meta.inner"/>
<ref name="meta.http-equiv.refresh.attrs"/>
</interleave>
</element>
</define>
<define name="meta.http-equiv.refresh.attrs">
<interleave>
<ref name="common.attrs.basic"/>
<ref name="common.attrs.i18n"/>
<ref name="common.attrs.present"/>
<ref name="common.attrs.other"/>
<ref name="meta.http-equiv.attrs.http-equiv.refresh"/>
<ref name="meta.http-equiv.attrs.content.refresh"/>
</interleave>
</define>
<define name="meta.http-equiv.attrs.http-equiv.refresh">
<attribute name="http-equiv">
<value type="string">refresh</value>
</attribute>
</define>
<define name="meta.http-equiv.attrs.content.refresh">
<attribute name="content">
<ref name="common.data.refresh"/>
</attribute>
</define>
<define name="common.elem.metadata" combine="choice">
<ref name="meta.http-equiv.refresh.elem"/>
</define>
<!--
not quite right per spec
if the definition is
reused in another language
-->
<define name="meta.http-equiv.default-style.elem">
<a:documentation>"default-style" pragma directive: &lt;meta http-equiv='default-style'&gt;</a:documentation>
<element name="meta">
<interleave>
<ref name="meta.inner"/>
<ref name="meta.http-equiv.default-style.attrs"/>
</interleave>
</element>
</define>
<define name="meta.http-equiv.default-style.attrs">
<interleave>
<ref name="common.attrs.basic"/>
<ref name="common.attrs.i18n"/>
<ref name="common.attrs.present"/>
<ref name="common.attrs.other"/>
<ref name="meta.http-equiv.attrs.http-equiv.default-style"/>
<ref name="meta.http-equiv.attrs.content.default-style"/>
</interleave>
</define>
<define name="meta.http-equiv.attrs.http-equiv.default-style">
<attribute name="http-equiv">
<value type="string">default-style</value>
</attribute>
</define>
<define name="meta.http-equiv.attrs.content.default-style">
<attribute name="content">
<ref name="common.data.default-style"/>
</attribute>
</define>
<define name="common.elem.metadata" combine="choice">
<ref name="meta.http-equiv.default-style.elem"/>
</define>
<!--
not quite right per spec
if the definition is
reused in another language
-->
<define name="meta.http-equiv.content-language.elem">
<a:documentation>"content-language" pragma directive: &lt;meta http-equiv='content-language'&gt; (obsolete)</a:documentation>
<element name="meta">
<interleave>
<ref name="meta.inner"/>
<ref name="meta.http-equiv.content-language.attrs"/>
</interleave>
</element>
</define>
<define name="meta.http-equiv.content-language.attrs">
<interleave>
<ref name="common.attrs.basic"/>
<ref name="common.attrs.i18n"/>
<ref name="common.attrs.present"/>
<ref name="common.attrs.other"/>
<ref name="meta.http-equiv.attrs.http-equiv.content-language"/>
<ref name="meta.http-equiv.attrs.content.content-language"/>
</interleave>
</define>
<define name="meta.http-equiv.attrs.http-equiv.content-language">
<attribute name="http-equiv">
<value type="string">content-language</value>
</attribute>
</define>
<define name="meta.http-equiv.attrs.content.content-language">
<attribute name="content">
<ref name="common.data.langcode"/>
</attribute>
</define>
<define name="common.elem.metadata" combine="choice">
<ref name="meta.http-equiv.content-language.elem"/>
</define>
<!--
not quite right per spec
if the definition is
reused in another language
-->
<define name="meta.charset.elem">
<a:documentation>Inline Character Encoding Statement for HTML: &lt;meta charset&gt;</a:documentation>
<element name="meta">
<interleave>
<ref name="meta.inner"/>
<ref name="meta.charset.attrs"/>
</interleave>
</element>
</define>
<define name="meta.charset.attrs">
<interleave>
<ref name="common.attrs.basic"/>
<ref name="common.attrs.i18n"/>
<ref name="common.attrs.present"/>
<ref name="common.attrs.other"/>
<ref name="meta.charset.attrs.charset"/>
</interleave>
</define>
<define name="meta.charset.attrs.charset">
<attribute name="charset">
<choice>
<interleave>
<ref name="common.data.charset"/>
<ref name="HTMLonly"/>
</interleave>
<interleave>
<data type="string" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<param name="pattern">[uU][tT][fF]-8</param>
</data>
<ref name="XMLonly"/>
</interleave>
</choice>
</attribute>
</define>
<define name="meta.http-equiv.content-type.elem">
<a:documentation>Inline Character Encoding Statement for HTML: &lt;meta http-equiv='content-type'&gt;</a:documentation>
<interleave>
<element name="meta">
<interleave>
<ref name="meta.inner"/>
<ref name="meta.http-equiv.content-type.attrs"/>
</interleave>
</element>
<ref name="HTMLonly"/>
</interleave>
</define>
<define name="meta.http-equiv.content-type.attrs">
<interleave>
<ref name="common.attrs.basic"/>
<ref name="common.attrs.i18n"/>
<ref name="common.attrs.present"/>
<ref name="common.attrs.other"/>
<ref name="meta.http-equiv.attrs.http-equiv.content-type"/>
<ref name="meta.http-equiv.attrs.content.content-type"/>
</interleave>
</define>
<define name="meta.http-equiv.attrs.http-equiv.content-type">
<attribute name="http-equiv">
<value type="string">content-type</value>
</attribute>
</define>
<define name="meta.http-equiv.attrs.content.content-type">
<attribute name="content">
<ref name="common.data.meta-charset"/>
</attribute>
</define>
<define name="common.elem.metadata" combine="choice">
<choice>
<ref name="meta.charset.elem"/>
<ref name="meta.http-equiv.content-type.elem"/>
</choice>
</define>
</grammar>

View File

@ -1,80 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Microdata #
# #####################################################################
common.attrs.microdata =
( common.attrs.microdata.itemref?
& common.attrs.microdata.itemprop?
& common.attrs.microdata.itemscope?
& common.attrs.microdata.itemtype?
& common.attrs.microdata.itemid?
)
common.attrs.microdata.itemref =
attribute itemref {
common.data.idrefs
}
common.attrs.microdata.itemprop =
attribute itemprop {
common.data.microdata-identifier
}
common.attrs.microdata.itemscope =
attribute itemscope {
w:string "itemscope" | w:string ""
}
common.attrs.microdata.itemtype =
attribute itemtype {
common.data.uri
}
common.attrs.microdata.itemid =
attribute itemid {
common.data.uri
}
common.attrs &= common.attrs.microdata
link.elem.phrasing =
element link { link.inner & link.phrasing.attrs }
link.phrasing.attrs =
( common.attrs.basic
& common.attrs.i18n
& common.attrs.present
& common.attrs.other
& common.attrs.microdata.itemprop
& common.attrs.microdata.itemref?
& common.attrs.microdata.itemscope?
& common.attrs.microdata.itemtype?
& common.attrs.microdata.itemid?
& shared-hyperlink.attrs.href
& shared-hyperlink.attrs.rel
& shared-hyperlink.attrs.hreflang?
& shared-hyperlink.attrs.media?
& shared-hyperlink.attrs.type?
& link.attrs.sizes?
# link.attrs.title included in common.attrs
)
common.elem.phrasing |= link.elem.phrasing
## Property Metadata: <meta itemprop>
meta.itemprop.elem =
element meta { meta.inner & meta.itemprop.attrs }
meta.itemprop.attrs =
( common.attrs.basic
& common.attrs.i18n
& common.attrs.present
& common.attrs.other
& common.attrs.microdata.itemprop
& common.attrs.microdata.itemref?
& common.attrs.microdata.itemscope?
& common.attrs.microdata.itemtype?
& common.attrs.microdata.itemid?
& meta.itemprop.attrs.content
)
meta.itemprop.attrs.content =
attribute content {
string
}
common.elem.metadata |= meta.itemprop.elem
common.elem.phrasing |= meta.itemprop.elem

145
html5-syntax/microdata.rng Normal file
View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<define name="common.attrs.microdata">
<a:documentation> RELAX NG Schema for HTML 5: Microdata #</a:documentation>
<interleave>
<optional>
<ref name="common.attrs.microdata.itemref"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemprop"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemscope"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemtype"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemid"/>
</optional>
</interleave>
</define>
<define name="common.attrs.microdata.itemref">
<attribute name="itemref">
<ref name="common.data.idrefs"/>
</attribute>
</define>
<define name="common.attrs.microdata.itemprop">
<attribute name="itemprop">
<ref name="common.data.microdata-identifier"/>
</attribute>
</define>
<define name="common.attrs.microdata.itemscope">
<attribute name="itemscope">
<choice>
<value type="string">itemscope</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="common.attrs.microdata.itemtype">
<attribute name="itemtype">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="common.attrs.microdata.itemid">
<attribute name="itemid">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="common.attrs" combine="interleave">
<ref name="common.attrs.microdata"/>
</define>
<define name="link.elem.phrasing">
<element name="link">
<interleave>
<ref name="link.inner"/>
<ref name="link.phrasing.attrs"/>
</interleave>
</element>
</define>
<define name="link.phrasing.attrs">
<interleave>
<ref name="common.attrs.basic"/>
<ref name="common.attrs.i18n"/>
<ref name="common.attrs.present"/>
<ref name="common.attrs.other"/>
<ref name="common.attrs.microdata.itemprop"/>
<optional>
<ref name="common.attrs.microdata.itemref"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemscope"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemtype"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemid"/>
</optional>
<ref name="shared-hyperlink.attrs.href"/>
<ref name="shared-hyperlink.attrs.rel"/>
<optional>
<ref name="shared-hyperlink.attrs.hreflang"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.media"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.type"/>
</optional>
<optional>
<ref name="link.attrs.sizes"/>
</optional>
</interleave>
<!-- link.attrs.title included in common.attrs -->
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="link.elem.phrasing"/>
</define>
<define name="meta.itemprop.elem">
<a:documentation>Property Metadata: &lt;meta itemprop&gt;</a:documentation>
<element name="meta">
<interleave>
<ref name="meta.inner"/>
<ref name="meta.itemprop.attrs"/>
</interleave>
</element>
</define>
<define name="meta.itemprop.attrs">
<interleave>
<ref name="common.attrs.basic"/>
<ref name="common.attrs.i18n"/>
<ref name="common.attrs.present"/>
<ref name="common.attrs.other"/>
<ref name="common.attrs.microdata.itemprop"/>
<optional>
<ref name="common.attrs.microdata.itemref"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemscope"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemtype"/>
</optional>
<optional>
<ref name="common.attrs.microdata.itemid"/>
</optional>
<ref name="meta.itemprop.attrs.content"/>
</interleave>
</define>
<define name="meta.itemprop.attrs.content">
<attribute name="content">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="common.elem.metadata" combine="choice">
<ref name="meta.itemprop.elem"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="meta.itemprop.elem"/>
</define>
</grammar>

View File

@ -1,324 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Phrase Markup #
# #####################################################################
## Contextual Hyperlink: <a>
a.elem.phrasing =
element a { a.inner.phrasing & a.attrs }
a.elem.flow =
element a { a.inner.flow & a.attrs }
a.attrs =
( common.attrs
& a.attrs.name?
& shared-hyperlink.attrs.href?
& shared-hyperlink.attrs.target?
& shared-hyperlink.attrs.rel?
& shared-hyperlink.attrs.hreflang?
& shared-hyperlink.attrs.media?
& shared-hyperlink.attrs.type?
& shared-hyperlink.attrs.ping?
& ( common.attrs.aria
| common.attrs.aria.implicit.link
)?
)
a.attrs.name =
attribute name {
common.data.id # XXX not what the spec says
}
a.inner.phrasing =
( common.inner.phrasing )
a.inner.flow =
( common.inner.flow )
common.elem.phrasing |= a.elem.phrasing
common.elem.flow |= a.elem.flow
## Shared hyperlink attributes
shared-hyperlink.attrs.href =
attribute href {
common.data.uri
}
shared-hyperlink.attrs.target =
attribute target {
common.data.browsing-context-or-keyword
}
shared-hyperlink.attrs.rel =
attribute rel {
common.data.tokens
}
shared-hyperlink.attrs.hreflang =
attribute hreflang {
common.data.langcode
}
shared-hyperlink.attrs.media =
attribute media {
common.data.mediaquery
}
shared-hyperlink.attrs.type =
attribute type {
common.data.mimetype
}
shared-hyperlink.attrs.ping =
attribute ping {
common.data.uris
} & v5only
## Emphatic Stress: <em>
em.elem =
element em { em.inner & em.attrs }
em.attrs =
( common.attrs
& common.attrs.aria?
)
em.inner =
( common.inner.phrasing )
common.elem.phrasing |= em.elem
## Strong Importance: <strong>
strong.elem =
element strong { strong.inner & strong.attrs }
strong.attrs =
( common.attrs
& common.attrs.aria?
)
strong.inner =
( common.inner.phrasing )
common.elem.phrasing |= strong.elem
## Small Print and Side Comments: <small>
small.elem =
element small { small.inner & small.attrs }
small.attrs =
( common.attrs
& common.attrs.aria?
)
small.inner =
( common.inner.phrasing )
common.elem.phrasing |= small.elem
## Marked (Highlighted) Text: <mark>
mark.elem =
element mark { mark.inner & mark.attrs }
& v5only
mark.attrs =
( common.attrs )
mark.inner =
( common.inner.phrasing )
common.elem.phrasing |= mark.elem
## Abbreviation: <abbr>
abbr.elem =
element abbr { abbr.inner & abbr.attrs }
abbr.attrs =
( common.attrs
# abbr.attrs.title included in common.attrs
& common.attrs.aria?
)
abbr.inner =
( common.inner.phrasing )
common.elem.phrasing |= abbr.elem
## Defining Instance: <dfn>
dfn.elem =
element dfn { dfn.inner & dfn.attrs }
dfn.attrs =
( common.attrs
# dfn.attrs.title included in common.attrs
& common.attrs.aria?
)
dfn.inner =
( common.inner.phrasing )
common.elem.phrasing |= dfn.elem
## Italic: <i>
i.elem =
element i { i.inner & i.attrs }
i.attrs =
( common.attrs
& common.attrs.aria?
)
i.inner =
( common.inner.phrasing )
common.elem.phrasing |= i.elem
## Bold: <b>
b.elem =
element b { b.inner & b.attrs }
b.attrs =
( common.attrs
& common.attrs.aria?
)
b.inner =
( common.inner.phrasing )
common.elem.phrasing |= b.elem
## Code Fragment: <code>
code.elem =
element code { code.inner & code.attrs }
code.attrs =
( common.attrs
& common.attrs.aria?
)
code.inner =
( common.inner.phrasing )
common.elem.phrasing |= code.elem
## Variable or Placeholder: <var>
var.elem =
element var { var.inner & var.attrs }
var.attrs =
( common.attrs
& common.attrs.aria?
)
var.inner =
( common.inner.phrasing )
common.elem.phrasing |= var.elem
## (Sample) Output: <samp>
samp.elem =
element samp { samp.inner & samp.attrs }
samp.attrs =
( common.attrs
& common.attrs.aria?
)
samp.inner =
( common.inner.phrasing )
common.elem.phrasing |= samp.elem
## User Input: <kbd>
kbd.elem =
element kbd { kbd.inner & kbd.attrs }
kbd.attrs =
( common.attrs
& common.attrs.aria?
)
kbd.inner =
( common.inner.phrasing )
common.elem.phrasing |= kbd.elem
## Superscript: <sup>
sup.elem =
element sup { sup.inner & sup.attrs }
sup.attrs =
( common.attrs )
sup.inner =
( common.inner.phrasing )
common.elem.phrasing |= sup.elem
## Subscript: <sub>
sub.elem =
element sub { sub.inner & sub.attrs }
sub.attrs =
( common.attrs )
sub.inner =
( common.inner.phrasing )
common.elem.phrasing |= sub.elem
## Quotation: <q>
q.elem =
element q { q.inner & q.attrs }
q.attrs =
( common.attrs
& q.attrs.cite?
& common.attrs.aria?
)
q.attrs.cite =
attribute cite {
common.data.uri
}
q.inner =
( common.inner.phrasing )
common.elem.phrasing |= q.elem
## Title of Work: <cite>
cite.elem =
element cite { cite.inner & cite.attrs }
cite.attrs =
( common.attrs
& common.attrs.aria?
)
cite.inner =
( common.inner.phrasing )
common.elem.phrasing |= cite.elem
## Generic Span: <span>
span.elem =
element span { span.inner & span.attrs }
span.attrs =
( common.attrs
& common.attrs.aria?
)
span.inner =
( common.inner.phrasing ) # REVISIT allow ol and ul?
common.elem.phrasing |= span.elem
## Bidirectional Override: <bdo>
bdo.elem =
element bdo { bdo.inner & bdo.attrs }
bdo.attrs =
( common.attrs ) # dir required in Schematron
bdo.inner =
( common.inner.phrasing )
common.elem.phrasing |= bdo.elem
## Line Break: <br>
br.elem =
element br { br.inner & br.attrs }
br.attrs =
( common.attrs )
br.inner =
( empty )
common.elem.phrasing |= br.elem
## Line-break opportunity: <wbr>
wbr.elem =
element wbr { wbr.inner & wbr.attrs }
wbr.attrs =
( common.attrs )
wbr.inner =
( empty )
common.elem.phrasing |= wbr.elem

560
html5-syntax/phrase.rng Normal file
View File

@ -0,0 +1,560 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<!-- ##################################################################### -->
<define name="a.elem.phrasing">
<a:documentation> RELAX NG Schema for HTML 5: Phrase Markup #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Contextual Hyperlink: &lt;a&gt;</a:documentation>
<element name="a">
<interleave>
<ref name="a.inner.phrasing"/>
<ref name="a.attrs"/>
</interleave>
</element>
</define>
<define name="a.elem.flow">
<element name="a">
<interleave>
<ref name="a.inner.flow"/>
<ref name="a.attrs"/>
</interleave>
</element>
</define>
<define name="a.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="a.attrs.name"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.href"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.target"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.rel"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.hreflang"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.media"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.type"/>
</optional>
<optional>
<ref name="shared-hyperlink.attrs.ping"/>
</optional>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.link"/>
</choice>
</optional>
</interleave>
</define>
<define name="a.attrs.name">
<attribute name="name">
<ref name="common.data.id"/>
<!-- XXX not what the spec says -->
</attribute>
</define>
<define name="a.inner.phrasing">
<ref name="common.inner.phrasing"/>
</define>
<define name="a.inner.flow">
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="a.elem.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="a.elem.flow"/>
</define>
<define name="shared-hyperlink.attrs.href">
<a:documentation>Shared hyperlink attributes</a:documentation>
<attribute name="href">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="shared-hyperlink.attrs.target">
<attribute name="target">
<ref name="common.data.browsing-context-or-keyword"/>
</attribute>
</define>
<define name="shared-hyperlink.attrs.rel">
<attribute name="rel">
<ref name="common.data.tokens"/>
</attribute>
</define>
<define name="shared-hyperlink.attrs.hreflang">
<attribute name="hreflang">
<ref name="common.data.langcode"/>
</attribute>
</define>
<define name="shared-hyperlink.attrs.media">
<attribute name="media">
<ref name="common.data.mediaquery"/>
</attribute>
</define>
<define name="shared-hyperlink.attrs.type">
<attribute name="type">
<ref name="common.data.mimetype"/>
</attribute>
</define>
<define name="shared-hyperlink.attrs.ping">
<interleave>
<attribute name="ping">
<ref name="common.data.uris"/>
</attribute>
<ref name="v5only"/>
</interleave>
</define>
<define name="em.elem">
<a:documentation>Emphatic Stress: &lt;em&gt;</a:documentation>
<element name="em">
<interleave>
<ref name="em.inner"/>
<ref name="em.attrs"/>
</interleave>
</element>
</define>
<define name="em.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="em.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="em.elem"/>
</define>
<define name="strong.elem">
<a:documentation>Strong Importance: &lt;strong&gt;</a:documentation>
<element name="strong">
<interleave>
<ref name="strong.inner"/>
<ref name="strong.attrs"/>
</interleave>
</element>
</define>
<define name="strong.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="strong.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="strong.elem"/>
</define>
<define name="small.elem">
<a:documentation>Small Print and Side Comments: &lt;small&gt;</a:documentation>
<element name="small">
<interleave>
<ref name="small.inner"/>
<ref name="small.attrs"/>
</interleave>
</element>
</define>
<define name="small.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="small.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="small.elem"/>
</define>
<define name="mark.elem">
<a:documentation>Marked (Highlighted) Text: &lt;mark&gt;</a:documentation>
<interleave>
<element name="mark">
<interleave>
<ref name="mark.inner"/>
<ref name="mark.attrs"/>
</interleave>
</element>
<ref name="v5only"/>
</interleave>
</define>
<define name="mark.attrs">
<ref name="common.attrs"/>
</define>
<define name="mark.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="mark.elem"/>
</define>
<define name="abbr.elem">
<a:documentation>Abbreviation: &lt;abbr&gt;</a:documentation>
<element name="abbr">
<interleave>
<ref name="abbr.inner"/>
<ref name="abbr.attrs"/>
</interleave>
</element>
</define>
<define name="abbr.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<!-- abbr.attrs.title included in common.attrs -->
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="abbr.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="abbr.elem"/>
</define>
<define name="dfn.elem">
<a:documentation>Defining Instance: &lt;dfn&gt;</a:documentation>
<element name="dfn">
<interleave>
<ref name="dfn.inner"/>
<ref name="dfn.attrs"/>
</interleave>
</element>
</define>
<define name="dfn.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<!-- dfn.attrs.title included in common.attrs -->
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="dfn.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="dfn.elem"/>
</define>
<define name="i.elem">
<a:documentation>Italic: &lt;i&gt;</a:documentation>
<element name="i">
<interleave>
<ref name="i.inner"/>
<ref name="i.attrs"/>
</interleave>
</element>
</define>
<define name="i.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="i.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="i.elem"/>
</define>
<define name="b.elem">
<a:documentation>Bold: &lt;b&gt;</a:documentation>
<element name="b">
<interleave>
<ref name="b.inner"/>
<ref name="b.attrs"/>
</interleave>
</element>
</define>
<define name="b.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="b.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="b.elem"/>
</define>
<define name="code.elem">
<a:documentation>Code Fragment: &lt;code&gt;</a:documentation>
<element name="code">
<interleave>
<ref name="code.inner"/>
<ref name="code.attrs"/>
</interleave>
</element>
</define>
<define name="code.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="code.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="code.elem"/>
</define>
<define name="var.elem">
<a:documentation>Variable or Placeholder: &lt;var&gt;</a:documentation>
<element name="var">
<interleave>
<ref name="var.inner"/>
<ref name="var.attrs"/>
</interleave>
</element>
</define>
<define name="var.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="var.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="var.elem"/>
</define>
<define name="samp.elem">
<a:documentation>(Sample) Output: &lt;samp&gt;</a:documentation>
<element name="samp">
<interleave>
<ref name="samp.inner"/>
<ref name="samp.attrs"/>
</interleave>
</element>
</define>
<define name="samp.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="samp.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="samp.elem"/>
</define>
<define name="kbd.elem">
<a:documentation>User Input: &lt;kbd&gt;</a:documentation>
<element name="kbd">
<interleave>
<ref name="kbd.inner"/>
<ref name="kbd.attrs"/>
</interleave>
</element>
</define>
<define name="kbd.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="kbd.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="kbd.elem"/>
</define>
<define name="sup.elem">
<a:documentation>Superscript: &lt;sup&gt;</a:documentation>
<element name="sup">
<interleave>
<ref name="sup.inner"/>
<ref name="sup.attrs"/>
</interleave>
</element>
</define>
<define name="sup.attrs">
<ref name="common.attrs"/>
</define>
<define name="sup.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="sup.elem"/>
</define>
<define name="sub.elem">
<a:documentation>Subscript: &lt;sub&gt;</a:documentation>
<element name="sub">
<interleave>
<ref name="sub.inner"/>
<ref name="sub.attrs"/>
</interleave>
</element>
</define>
<define name="sub.attrs">
<ref name="common.attrs"/>
</define>
<define name="sub.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="sub.elem"/>
</define>
<define name="q.elem">
<a:documentation>Quotation: &lt;q&gt;</a:documentation>
<element name="q">
<interleave>
<ref name="q.inner"/>
<ref name="q.attrs"/>
</interleave>
</element>
</define>
<define name="q.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="q.attrs.cite"/>
</optional>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="q.attrs.cite">
<attribute name="cite">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="q.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="q.elem"/>
</define>
<define name="cite.elem">
<a:documentation>Title of Work: &lt;cite&gt;</a:documentation>
<element name="cite">
<interleave>
<ref name="cite.inner"/>
<ref name="cite.attrs"/>
</interleave>
</element>
</define>
<define name="cite.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="cite.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="cite.elem"/>
</define>
<define name="span.elem">
<a:documentation>Generic Span: &lt;span&gt;</a:documentation>
<element name="span">
<interleave>
<ref name="span.inner"/>
<ref name="span.attrs"/>
</interleave>
</element>
</define>
<define name="span.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="span.inner">
<ref name="common.inner.phrasing"/>
</define>
<!-- REVISIT allow ol and ul? -->
<define name="common.elem.phrasing" combine="choice">
<ref name="span.elem"/>
</define>
<define name="bdo.elem">
<a:documentation>Bidirectional Override: &lt;bdo&gt;</a:documentation>
<element name="bdo">
<interleave>
<ref name="bdo.inner"/>
<ref name="bdo.attrs"/>
</interleave>
</element>
</define>
<define name="bdo.attrs">
<ref name="common.attrs"/>
</define>
<!-- dir required in Schematron -->
<define name="bdo.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="bdo.elem"/>
</define>
<define name="br.elem">
<a:documentation>Line Break: &lt;br&gt;</a:documentation>
<element name="br">
<interleave>
<ref name="br.inner"/>
<ref name="br.attrs"/>
</interleave>
</element>
</define>
<define name="br.attrs">
<ref name="common.attrs"/>
</define>
<define name="br.inner">
<empty/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="br.elem"/>
</define>
<define name="wbr.elem">
<a:documentation>Line-break opportunity: &lt;wbr&gt;</a:documentation>
<element name="wbr">
<interleave>
<ref name="wbr.inner"/>
<ref name="wbr.attrs"/>
</interleave>
</element>
</define>
<define name="wbr.attrs">
<ref name="common.attrs"/>
</define>
<define name="wbr.inner">
<empty/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="wbr.elem"/>
</define>
</grammar>

View File

@ -1,52 +0,0 @@
# #####################################################################
## RELAX NG Schema for HTML 5: Revision Annotations #
# #####################################################################
## Common Attributes
edit.attrs.cite =
attribute cite {
common.data.uri
}
edit.attrs.datetime =
attribute datetime {
common.data.datetime
}
## Inserts: <ins>
ins.elem.flow =
element ins { ins.inner.flow & ins.attrs }
ins.elem.phrasing =
element ins { ins.inner.phrasing & ins.attrs }
ins.attrs =
( common.attrs
& edit.attrs.cite?
& edit.attrs.datetime?
)
ins.inner.flow =
( common.inner.flow )
ins.inner.phrasing =
( common.inner.phrasing )
common.elem.flow |= ins.elem.flow
common.elem.phrasing |= ins.elem.phrasing
## Deletions: <del>
del.elem.flow =
element del { del.inner.flow & del.attrs }
del.elem.phrasing =
element del { del.inner.phrasing & del.attrs }
del.attrs =
( common.attrs
& edit.attrs.cite?
& edit.attrs.datetime?
)
del.inner.flow =
( common.inner.flow )
del.inner.phrasing =
( common.inner.phrasing )
common.elem.flow |= del.elem.flow
common.elem.phrasing |= del.elem.phrasing

97
html5-syntax/revision.rng Normal file
View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<!-- ##################################################################### -->
<define name="edit.attrs.cite">
<a:documentation> RELAX NG Schema for HTML 5: Revision Annotations #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Common Attributes</a:documentation>
<attribute name="cite">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="edit.attrs.datetime">
<attribute name="datetime">
<ref name="common.data.datetime"/>
</attribute>
</define>
<define name="ins.elem.flow">
<a:documentation>Inserts: &lt;ins&gt;</a:documentation>
<element name="ins">
<interleave>
<ref name="ins.inner.flow"/>
<ref name="ins.attrs"/>
</interleave>
</element>
</define>
<define name="ins.elem.phrasing">
<element name="ins">
<interleave>
<ref name="ins.inner.phrasing"/>
<ref name="ins.attrs"/>
</interleave>
</element>
</define>
<define name="ins.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="edit.attrs.cite"/>
</optional>
<optional>
<ref name="edit.attrs.datetime"/>
</optional>
</interleave>
</define>
<define name="ins.inner.flow">
<ref name="common.inner.flow"/>
</define>
<define name="ins.inner.phrasing">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="ins.elem.flow"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="ins.elem.phrasing"/>
</define>
<define name="del.elem.flow">
<a:documentation>Deletions: &lt;del&gt;</a:documentation>
<element name="del">
<interleave>
<ref name="del.inner.flow"/>
<ref name="del.attrs"/>
</interleave>
</element>
</define>
<define name="del.elem.phrasing">
<element name="del">
<interleave>
<ref name="del.inner.phrasing"/>
<ref name="del.attrs"/>
</interleave>
</element>
</define>
<define name="del.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="edit.attrs.cite"/>
</optional>
<optional>
<ref name="edit.attrs.datetime"/>
</optional>
</interleave>
</define>
<define name="del.inner.flow">
<ref name="common.inner.flow"/>
</define>
<define name="del.inner.phrasing">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="del.elem.flow"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="del.elem.phrasing"/>
</define>
</grammar>

View File

@ -1,51 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
namespace local = ""
# #####################################################################
## RELAX NG Schema for HTML 5: Ruby #
# #####################################################################
#######################################################################
## Ruby Annotation: <ruby>
ruby.elem =
element ruby { ruby.inner & ruby.attrs }
ruby.attrs =
( common.attrs
& common.attrs.aria?
)
ruby.inner =
( ( common.inner.phrasing
, ( rt.elem
| ( rp.elem
, rt.elem
, rp.elem
)
)
)+
)
common.elem.phrasing |= ruby.elem
## Ruby Text: <rt>
rt.elem =
element rt { rt.inner & rt.attrs }
rt.attrs =
( common.attrs
& common.attrs.aria?
)
rt.inner =
( common.inner.phrasing )
## Ruby Parenthesis: <rp>
rp.elem =
element rp { rp.inner & rp.attrs }
rp.attrs =
( common.attrs
& common.attrs.aria?
)
rp.inner =
( common.inner.phrasing )

80
html5-syntax/ruby.rng Normal file
View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<!-- ##################################################################### -->
<define name="ruby.elem">
<a:documentation> RELAX NG Schema for HTML 5: Ruby #</a:documentation>
<!-- ##################################################################### -->
<a:documentation/>
<a:documentation>Ruby Annotation: &lt;ruby&gt;</a:documentation>
<element name="ruby">
<interleave>
<ref name="ruby.inner"/>
<ref name="ruby.attrs"/>
</interleave>
</element>
</define>
<define name="ruby.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="ruby.inner">
<oneOrMore>
<ref name="common.inner.phrasing"/>
<choice>
<ref name="rt.elem"/>
<group>
<ref name="rp.elem"/>
<ref name="rt.elem"/>
<ref name="rp.elem"/>
</group>
</choice>
</oneOrMore>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="ruby.elem"/>
</define>
<define name="rt.elem">
<a:documentation>Ruby Text: &lt;rt&gt;</a:documentation>
<element name="rt">
<interleave>
<ref name="rt.inner"/>
<ref name="rt.attrs"/>
</interleave>
</element>
</define>
<define name="rt.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="rt.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="rp.elem">
<a:documentation>Ruby Parenthesis: &lt;rp&gt;</a:documentation>
<element name="rp">
<interleave>
<ref name="rp.inner"/>
<ref name="rp.attrs"/>
</interleave>
</element>
</define>
<define name="rp.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="rp.inner">
<ref name="common.inner.phrasing"/>
</define>
</grammar>

View File

@ -1,140 +0,0 @@
# #####################################################################
## RELAX NG Schema for HTML 5: Sectioning Markup #
# #####################################################################
# #####################################################################
## Headings
## Heading (Rank 1): <h1>
h1.elem =
element h1 { h1.inner & h1.attrs }
h1.attrs =
( common.attrs
& common.attrs.aria.implicit.structure?
)
h1.inner =
( common.inner.phrasing )
common.elem.flow |= h1.elem
## Heading (Rank 2): <h2>
h2.elem =
element h2 { h2.inner & h2.attrs }
h2.attrs =
( common.attrs
& common.attrs.aria.implicit.structure?
)
h2.inner =
( common.inner.phrasing )
common.elem.flow |= h2.elem
## Heading (Rank 3): <h3>
h3.elem =
element h3 { h3.inner & h3.attrs }
h3.attrs =
( common.attrs
& common.attrs.aria.implicit.structure?
)
h3.inner =
( common.inner.phrasing )
common.elem.flow |= h3.elem
## Heading (Rank 4): <h4>
h4.elem =
element h4 { h4.inner & h4.attrs }
h4.attrs =
( common.attrs
& common.attrs.aria.implicit.structure?
)
h4.inner =
( common.inner.phrasing )
common.elem.flow |= h4.elem
## Heading (Rank 5): <h5>
h5.elem =
element h5 { h5.inner & h5.attrs }
h5.attrs =
( common.attrs
& common.attrs.aria.implicit.structure?
)
h5.inner =
( common.inner.phrasing )
common.elem.flow |= h5.elem
## Heading (Rank 6): <h6>
h6.elem =
element h6 { h6.inner & h6.attrs }
h6.attrs =
( common.attrs
& common.attrs.aria.implicit.structure?
)
h6.inner =
( common.inner.phrasing )
common.elem.flow |= h6.elem
## Heading Group: <hgroup>
hgroup.elem =
element hgroup { hgroup.inner & hgroup.attrs }
hgroup.attrs =
( common.attrs
& common.attrs.aria.implicit.structure?
)
hgroup.inner =
( h1.elem
| h2.elem
| h3.elem
| h4.elem
| h5.elem
| h6.elem
)+
common.elem.flow |= hgroup.elem
# #####################################################################
## Section Meta
## Contact Info: <address>
address.elem =
element address { address.inner & address.attrs }
address.attrs =
( common.attrs
& common.attrs.aria.implicit.region?
)
address.inner =
( common.inner.flow )
common.elem.flow |= address.elem
# #####################################################################
## Quotations
## Block Quotes: <blockquote>
blockquote.elem =
element blockquote { blockquote.inner & blockquote.attrs }
blockquote.attrs =
( common.attrs
& blockquote.attrs.cite?
& common.attrs.aria?
)
blockquote.attrs.cite =
attribute cite {
common.data.uri
}
blockquote.inner =
( common.inner.flow )
common.elem.flow |= blockquote.elem

236
html5-syntax/sectional.rng Normal file
View File

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<!-- ##################################################################### -->
<define name="h1.elem">
<a:documentation> RELAX NG Schema for HTML 5: Sectioning Markup #</a:documentation>
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<a:documentation>Headings</a:documentation>
<a:documentation>Heading (Rank 1): &lt;h1&gt;</a:documentation>
<element name="h1">
<interleave>
<ref name="h1.inner"/>
<ref name="h1.attrs"/>
</interleave>
</element>
</define>
<define name="h1.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.structure"/>
</optional>
</interleave>
</define>
<define name="h1.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="h1.elem"/>
</define>
<define name="h2.elem">
<a:documentation>Heading (Rank 2): &lt;h2&gt;</a:documentation>
<element name="h2">
<interleave>
<ref name="h2.inner"/>
<ref name="h2.attrs"/>
</interleave>
</element>
</define>
<define name="h2.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.structure"/>
</optional>
</interleave>
</define>
<define name="h2.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="h2.elem"/>
</define>
<define name="h3.elem">
<a:documentation>Heading (Rank 3): &lt;h3&gt;</a:documentation>
<element name="h3">
<interleave>
<ref name="h3.inner"/>
<ref name="h3.attrs"/>
</interleave>
</element>
</define>
<define name="h3.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.structure"/>
</optional>
</interleave>
</define>
<define name="h3.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="h3.elem"/>
</define>
<define name="h4.elem">
<a:documentation>Heading (Rank 4): &lt;h4&gt;</a:documentation>
<element name="h4">
<interleave>
<ref name="h4.inner"/>
<ref name="h4.attrs"/>
</interleave>
</element>
</define>
<define name="h4.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.structure"/>
</optional>
</interleave>
</define>
<define name="h4.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="h4.elem"/>
</define>
<define name="h5.elem">
<a:documentation>Heading (Rank 5): &lt;h5&gt;</a:documentation>
<element name="h5">
<interleave>
<ref name="h5.inner"/>
<ref name="h5.attrs"/>
</interleave>
</element>
</define>
<define name="h5.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.structure"/>
</optional>
</interleave>
</define>
<define name="h5.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="h5.elem"/>
</define>
<define name="h6.elem">
<a:documentation>Heading (Rank 6): &lt;h6&gt;</a:documentation>
<element name="h6">
<interleave>
<ref name="h6.inner"/>
<ref name="h6.attrs"/>
</interleave>
</element>
</define>
<define name="h6.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.structure"/>
</optional>
</interleave>
</define>
<define name="h6.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="h6.elem"/>
</define>
<define name="hgroup.elem">
<a:documentation>Heading Group: &lt;hgroup&gt;</a:documentation>
<element name="hgroup">
<interleave>
<ref name="hgroup.inner"/>
<ref name="hgroup.attrs"/>
</interleave>
</element>
</define>
<define name="hgroup.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.structure"/>
</optional>
</interleave>
</define>
<define name="hgroup.inner">
<oneOrMore>
<choice>
<ref name="h1.elem"/>
<ref name="h2.elem"/>
<ref name="h3.elem"/>
<ref name="h4.elem"/>
<ref name="h5.elem"/>
<ref name="h6.elem"/>
</choice>
</oneOrMore>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="hgroup.elem"/>
</define>
<!-- ##################################################################### -->
<define name="address.elem">
<a:documentation>Section Meta</a:documentation>
<a:documentation>Contact Info: &lt;address&gt;</a:documentation>
<element name="address">
<interleave>
<ref name="address.inner"/>
<ref name="address.attrs"/>
</interleave>
</element>
</define>
<define name="address.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.region"/>
</optional>
</interleave>
</define>
<define name="address.inner">
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="address.elem"/>
</define>
<!-- ##################################################################### -->
<define name="blockquote.elem">
<a:documentation>Quotations </a:documentation>
<a:documentation>Block Quotes: &lt;blockquote&gt;</a:documentation>
<element name="blockquote">
<interleave>
<ref name="blockquote.inner"/>
<ref name="blockquote.attrs"/>
</interleave>
</element>
</define>
<define name="blockquote.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="blockquote.attrs.cite"/>
</optional>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="blockquote.attrs.cite">
<attribute name="cite">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="blockquote.inner">
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="blockquote.elem"/>
</define>
</grammar>

View File

@ -1,105 +0,0 @@
# #####################################################################
## RELAX NG Schema for HTML 5: Block Markup Added in HTML5 #
# #####################################################################
## Section: <section>
section.elem =
element section { section.inner & section.attrs }
section.attrs =
( common.attrs
& ( common.attrs.aria
| common.attrs.aria.implicit.region
)?
)
section.inner =
( style.elem.scoped*
, common.inner.flow
)
common.elem.flow |= section.elem
## Navigational Links: <nav>
nav.elem =
element nav { nav.inner & nav.attrs }
nav.attrs =
( common.attrs
& ( common.attrs.aria.implicit.region
| common.attrs.aria.landmark.navigation
)?
)
nav.inner =
( common.inner.flow )
common.elem.flow |= nav.elem
## Article: <article>
article.elem =
element article { article.inner & article.attrs }
article.attrs =
( common.attrs
& ( common.attrs.aria.implicit.region
| common.attrs.aria.landmark.article
| common.attrs.aria.landmark.main
| common.attrs.aria.landmark.document
| common.attrs.aria.landmark.application
)?
)
article.inner =
( style.elem*
, common.inner.flow
)
common.elem.flow |= article.elem
## Tangential Aside: <aside>
aside.elem =
element aside { aside.inner & aside.attrs }
aside.attrs =
( common.attrs
& ( common.attrs.aria.implicit.region
| common.attrs.aria.landmark.complementary
| common.attrs.aria.landmark.search
| common.attrs.aria.landmark.note
)?
)
aside.inner =
( style.elem*
, common.inner.flow
)
common.elem.flow |= aside.elem
## Header: <header>
header.elem =
element header { header.inner & header.attrs }
header.attrs =
( common.attrs
& ( common.attrs.aria.implicit.region
| common.attrs.aria.landmark.banner
)?
)
header.inner =
( common.inner.flow )
common.elem.flow |= header.elem
## Footer: <footer>
footer.elem =
element footer { footer.inner & footer.attrs }
footer.attrs =
( common.attrs
& ( common.attrs.aria.implicit.region
| common.attrs.aria.landmark.contentinfo
)?
)
footer.inner =
( common.inner.flow )
common.elem.flow |= footer.elem

176
html5-syntax/structural.rng Normal file
View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<!-- ##################################################################### -->
<define name="section.elem">
<a:documentation> RELAX NG Schema for HTML 5: Block Markup Added in HTML5 #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Section: &lt;section&gt;</a:documentation>
<element name="section">
<interleave>
<ref name="section.inner"/>
<ref name="section.attrs"/>
</interleave>
</element>
</define>
<define name="section.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.region"/>
</choice>
</optional>
</interleave>
</define>
<define name="section.inner">
<zeroOrMore>
<ref name="style.elem.scoped"/>
</zeroOrMore>
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="section.elem"/>
</define>
<define name="nav.elem">
<a:documentation>Navigational Links: &lt;nav&gt;</a:documentation>
<element name="nav">
<interleave>
<ref name="nav.inner"/>
<ref name="nav.attrs"/>
</interleave>
</element>
</define>
<define name="nav.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<choice>
<ref name="common.attrs.aria.implicit.region"/>
<ref name="common.attrs.aria.landmark.navigation"/>
</choice>
</optional>
</interleave>
</define>
<define name="nav.inner">
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="nav.elem"/>
</define>
<define name="article.elem">
<a:documentation>Article: &lt;article&gt;</a:documentation>
<element name="article">
<interleave>
<ref name="article.inner"/>
<ref name="article.attrs"/>
</interleave>
</element>
</define>
<define name="article.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<choice>
<ref name="common.attrs.aria.implicit.region"/>
<ref name="common.attrs.aria.landmark.article"/>
<ref name="common.attrs.aria.landmark.main"/>
<ref name="common.attrs.aria.landmark.document"/>
<ref name="common.attrs.aria.landmark.application"/>
</choice>
</optional>
</interleave>
</define>
<define name="article.inner">
<zeroOrMore>
<ref name="style.elem"/>
</zeroOrMore>
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="article.elem"/>
</define>
<define name="aside.elem">
<a:documentation>Tangential Aside: &lt;aside&gt;</a:documentation>
<element name="aside">
<interleave>
<ref name="aside.inner"/>
<ref name="aside.attrs"/>
</interleave>
</element>
</define>
<define name="aside.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<choice>
<ref name="common.attrs.aria.implicit.region"/>
<ref name="common.attrs.aria.landmark.complementary"/>
<ref name="common.attrs.aria.landmark.search"/>
<ref name="common.attrs.aria.landmark.note"/>
</choice>
</optional>
</interleave>
</define>
<define name="aside.inner">
<zeroOrMore>
<ref name="style.elem"/>
</zeroOrMore>
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="aside.elem"/>
</define>
<define name="header.elem">
<a:documentation>Header: &lt;header&gt;</a:documentation>
<element name="header">
<interleave>
<ref name="header.inner"/>
<ref name="header.attrs"/>
</interleave>
</element>
</define>
<define name="header.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<choice>
<ref name="common.attrs.aria.implicit.region"/>
<ref name="common.attrs.aria.landmark.banner"/>
</choice>
</optional>
</interleave>
</define>
<define name="header.inner">
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="header.elem"/>
</define>
<define name="footer.elem">
<a:documentation>Footer: &lt;footer&gt;</a:documentation>
<element name="footer">
<interleave>
<ref name="footer.inner"/>
<ref name="footer.attrs"/>
</interleave>
</element>
</define>
<define name="footer.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<choice>
<ref name="common.attrs.aria.implicit.region"/>
<ref name="common.attrs.aria.landmark.contentinfo"/>
</choice>
</optional>
</interleave>
</define>
<define name="footer.inner">
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="footer.elem"/>
</define>
</grammar>

View File

@ -1,224 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Tables #
# #####################################################################
# #####################################################################
## Table Envelope
## Table Datatypes
# tables.data.multilen =
# ( common.data.integer.positive
# | common.data.percent
# | xsd:token { pattern = "[0-9]+\*" } #REVISIT should this one be string?
# )
## Table Alignment Attributes
tables.attrs.alignment =
( tables.attrs.align?
& tables.attrs.char?
& tables.attrs.valign?
)
tables.attrs.align =
attribute align {
( w:string "left"
| w:string "center"
| w:string "right"
| w:string "justify"
| w:string "char"
)
}
tables.attrs.char =
attribute char {
xsd:string { pattern = "." }
}
tables.attrs.valign =
attribute valign {
( w:string "top"
| w:string "middle"
| w:string "bottom"
| w:string "baseline"
)
}
## Data Table: <table>
table.elem =
element table { table.inner & table.attrs }
table.attrs =
( common.attrs
& table.attrs.summary? # obsolete
& common.attrs.aria?
)
table.attrs.summary =
attribute summary {
string
}
table.inner =
( caption.elem?
, colgroup.elem*
, thead.elem?
, ( ( tfoot.elem
, ( tbody.elem* | tr.elem+ )
)
| ( ( tbody.elem* | tr.elem+ )
, tfoot.elem?
)
)
)
common.elem.flow |= table.elem
## Table Caption: <caption>
caption.elem =
element caption { caption.inner & caption.attrs }
caption.attrs =
( common.attrs
& common.attrs.aria.implicit.region?
)
caption.inner =
( common.inner.flow )
# #####################################################################
## Table Super Structure
## Table Column Group: <colgroup>
colgroup.elem =
element colgroup { colgroup.inner & colgroup.attrs }
colgroup.attrs =
( common.attrs )
colgroup.attrs.span =
attribute span {
common.data.integer.positive
}
colgroup.inner =
( col.elem*
| colgroup.attrs.span?
)
## Table Column: <col>
col.elem =
element col { col.inner & col.attrs }
col.attrs =
( common.attrs
& col.attrs.span?
)
col.attrs.span =
attribute span {
common.data.integer.positive
}
col.inner =
( empty )
## Table Header Row Group
thead.elem =
element thead { thead.inner & thead.attrs }
thead.attrs =
( common.attrs )
thead.inner =
( tr.elem* )
## Table Footer Row Group
tfoot.elem =
element tfoot { tfoot.inner & tfoot.attrs }
tfoot.attrs =
( common.attrs )
tfoot.inner =
( tr.elem* )
## Table Row Group
tbody.elem =
element tbody { tbody.inner & tbody.attrs }
tbody.attrs =
( common.attrs )
tbody.inner =
( tr.elem* )
# #####################################################################
## Cell Structure
## Table Row
tr.elem =
element tr { tr.inner & tr.attrs }
tr.attrs =
( common.attrs
& common.attrs.aria?
)
tr.inner =
( ( td.elem | th.elem )* )
## Common Table Cell Attributes
tables.attrs.cell-structure =
( tables.attrs.colspan?
& tables.attrs.rowspan?
)
tables.attrs.colspan =
attribute colspan {
common.data.integer.positive
}
tables.attrs.rowspan =
attribute rowspan {
common.data.integer.non-negative
}
tables.attrs.access-headers =
( tables.attrs.headers? )
tables.attrs.headers =
attribute headers {
common.data.idrefs
}
tables.attrs.define-headers =
( tables.attrs.scope? )
tables.attrs.scope =
attribute scope {
( w:string "row"
| w:string "col"
| w:string "rowgroup"
| w:string "colgroup"
)
}
tables.attrs.abbr =
attribute abbr {
text
}
## Table Data Cell: <td>
td.elem =
element td { td.inner & td.attrs }
td.attrs =
( common.attrs
& tables.attrs.cell-structure
& tables.attrs.headers?
# & tables.attrs.alignment
& common.attrs.aria?
)
td.inner =
( common.inner.flow )
## Table Header Cells: <th>
th.elem =
element th { th.inner & th.attrs }
th.attrs =
( common.attrs
& tables.attrs.cell-structure
& tables.attrs.scope?
& tables.attrs.headers?
# & tables.attrs.alignment
& common.attrs.aria.implicit.th?
)
th.inner =
( common.inner.phrasing )

378
html5-syntax/tables.rng Normal file
View File

@ -0,0 +1,378 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<define name="tables.attrs.alignment">
<a:documentation> RELAX NG Schema for HTML 5: Tables #</a:documentation>
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<a:documentation>Table Envelope</a:documentation>
<a:documentation>Table Datatypes</a:documentation>
<!--
tables.data.multilen =
( common.data.integer.positive
| common.data.percent
| xsd:token { pattern = "[0-9]+\*" } #REVISIT should this one be string?
)
-->
<a:documentation>Table Alignment Attributes</a:documentation>
<interleave>
<optional>
<ref name="tables.attrs.align"/>
</optional>
<optional>
<ref name="tables.attrs.char"/>
</optional>
<optional>
<ref name="tables.attrs.valign"/>
</optional>
</interleave>
</define>
<define name="tables.attrs.align">
<attribute name="align">
<choice>
<value type="string">left</value>
<value type="string">center</value>
<value type="string">right</value>
<value type="string">justify</value>
<value type="string">char</value>
</choice>
</attribute>
</define>
<define name="tables.attrs.char">
<attribute name="char">
<data type="string" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<param name="pattern">.</param>
</data>
</attribute>
</define>
<define name="tables.attrs.valign">
<attribute name="valign">
<choice>
<value type="string">top</value>
<value type="string">middle</value>
<value type="string">bottom</value>
<value type="string">baseline</value>
</choice>
</attribute>
</define>
<define name="table.elem">
<a:documentation>Data Table: &lt;table&gt;</a:documentation>
<element name="table">
<interleave>
<ref name="table.inner"/>
<ref name="table.attrs"/>
</interleave>
</element>
</define>
<define name="table.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="table.attrs.summary"/>
</optional>
<optional>
<!-- obsolete -->
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="table.attrs.summary">
<attribute name="summary">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="table.inner">
<optional>
<ref name="caption.elem"/>
</optional>
<zeroOrMore>
<ref name="colgroup.elem"/>
</zeroOrMore>
<optional>
<ref name="thead.elem"/>
</optional>
<choice>
<group>
<ref name="tfoot.elem"/>
<choice>
<zeroOrMore>
<ref name="tbody.elem"/>
</zeroOrMore>
<oneOrMore>
<ref name="tr.elem"/>
</oneOrMore>
</choice>
</group>
<group>
<choice>
<zeroOrMore>
<ref name="tbody.elem"/>
</zeroOrMore>
<oneOrMore>
<ref name="tr.elem"/>
</oneOrMore>
</choice>
<optional>
<ref name="tfoot.elem"/>
</optional>
</group>
</choice>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="table.elem"/>
</define>
<define name="caption.elem">
<a:documentation>Table Caption: &lt;caption&gt;</a:documentation>
<element name="caption">
<interleave>
<ref name="caption.inner"/>
<ref name="caption.attrs"/>
</interleave>
</element>
</define>
<define name="caption.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.region"/>
</optional>
</interleave>
</define>
<define name="caption.inner">
<ref name="common.inner.flow"/>
</define>
<!-- ##################################################################### -->
<define name="colgroup.elem">
<a:documentation>Table Super Structure</a:documentation>
<a:documentation>Table Column Group: &lt;colgroup&gt;</a:documentation>
<element name="colgroup">
<interleave>
<ref name="colgroup.inner"/>
<ref name="colgroup.attrs"/>
</interleave>
</element>
</define>
<define name="colgroup.attrs">
<ref name="common.attrs"/>
</define>
<define name="colgroup.attrs.span">
<attribute name="span">
<ref name="common.data.integer.positive"/>
</attribute>
</define>
<define name="colgroup.inner">
<choice>
<zeroOrMore>
<ref name="col.elem"/>
</zeroOrMore>
<optional>
<ref name="colgroup.attrs.span"/>
</optional>
</choice>
</define>
<define name="col.elem">
<a:documentation>Table Column: &lt;col&gt;</a:documentation>
<element name="col">
<interleave>
<ref name="col.inner"/>
<ref name="col.attrs"/>
</interleave>
</element>
</define>
<define name="col.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="col.attrs.span"/>
</optional>
</interleave>
</define>
<define name="col.attrs.span">
<attribute name="span">
<ref name="common.data.integer.positive"/>
</attribute>
</define>
<define name="col.inner">
<empty/>
</define>
<define name="thead.elem">
<a:documentation>Table Header Row Group</a:documentation>
<element name="thead">
<interleave>
<ref name="thead.inner"/>
<ref name="thead.attrs"/>
</interleave>
</element>
</define>
<define name="thead.attrs">
<ref name="common.attrs"/>
</define>
<define name="thead.inner">
<zeroOrMore>
<ref name="tr.elem"/>
</zeroOrMore>
</define>
<define name="tfoot.elem">
<a:documentation>Table Footer Row Group</a:documentation>
<element name="tfoot">
<interleave>
<ref name="tfoot.inner"/>
<ref name="tfoot.attrs"/>
</interleave>
</element>
</define>
<define name="tfoot.attrs">
<ref name="common.attrs"/>
</define>
<define name="tfoot.inner">
<zeroOrMore>
<ref name="tr.elem"/>
</zeroOrMore>
</define>
<define name="tbody.elem">
<a:documentation>Table Row Group</a:documentation>
<element name="tbody">
<interleave>
<ref name="tbody.inner"/>
<ref name="tbody.attrs"/>
</interleave>
</element>
</define>
<define name="tbody.attrs">
<ref name="common.attrs"/>
</define>
<define name="tbody.inner">
<zeroOrMore>
<ref name="tr.elem"/>
</zeroOrMore>
</define>
<!-- ##################################################################### -->
<define name="tr.elem">
<a:documentation>Cell Structure</a:documentation>
<a:documentation>Table Row</a:documentation>
<element name="tr">
<interleave>
<ref name="tr.inner"/>
<ref name="tr.attrs"/>
</interleave>
</element>
</define>
<define name="tr.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="tr.inner">
<zeroOrMore>
<choice>
<ref name="td.elem"/>
<ref name="th.elem"/>
</choice>
</zeroOrMore>
</define>
<define name="tables.attrs.cell-structure">
<a:documentation>Common Table Cell Attributes</a:documentation>
<interleave>
<optional>
<ref name="tables.attrs.colspan"/>
</optional>
<optional>
<ref name="tables.attrs.rowspan"/>
</optional>
</interleave>
</define>
<define name="tables.attrs.colspan">
<attribute name="colspan">
<ref name="common.data.integer.positive"/>
</attribute>
</define>
<define name="tables.attrs.rowspan">
<attribute name="rowspan">
<ref name="common.data.integer.non-negative"/>
</attribute>
</define>
<define name="tables.attrs.access-headers">
<optional>
<ref name="tables.attrs.headers"/>
</optional>
</define>
<define name="tables.attrs.headers">
<attribute name="headers">
<ref name="common.data.idrefs"/>
</attribute>
</define>
<define name="tables.attrs.define-headers">
<optional>
<ref name="tables.attrs.scope"/>
</optional>
</define>
<define name="tables.attrs.scope">
<attribute name="scope">
<choice>
<value type="string">row</value>
<value type="string">col</value>
<value type="string">rowgroup</value>
<value type="string">colgroup</value>
</choice>
</attribute>
</define>
<define name="tables.attrs.abbr">
<attribute name="abbr"/>
</define>
<define name="td.elem">
<a:documentation>Table Data Cell: &lt;td&gt;</a:documentation>
<element name="td">
<interleave>
<ref name="td.inner"/>
<ref name="td.attrs"/>
</interleave>
</element>
</define>
<define name="td.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="tables.attrs.cell-structure"/>
<optional>
<ref name="tables.attrs.headers"/>
</optional>
<optional>
<!-- & tables.attrs.alignment -->
<ref name="common.attrs.aria"/>
</optional>
</interleave>
</define>
<define name="td.inner">
<ref name="common.inner.flow"/>
</define>
<define name="th.elem">
<a:documentation>Table Header Cells: &lt;th&gt;</a:documentation>
<element name="th">
<interleave>
<ref name="th.inner"/>
<ref name="th.attrs"/>
</interleave>
</element>
</define>
<define name="th.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="tables.attrs.cell-structure"/>
<optional>
<ref name="tables.attrs.scope"/>
</optional>
<optional>
<ref name="tables.attrs.headers"/>
</optional>
<optional>
<!-- & tables.attrs.alignment -->
<ref name="common.attrs.aria.implicit.th"/>
</optional>
</interleave>
</define>
<define name="th.inner">
<ref name="common.inner.phrasing"/>
</define>
</grammar>

View File

@ -1,27 +0,0 @@
# #####################################################################
## RELAX NG Schema for HTML 5: Web Forms 1.0 Scripting #
# #####################################################################
scripting.attr.form.select =
attribute onselect { string }
scripting.attr.form.change =
attribute onchange { string }
# input.text.attrs &=
# ( scripting.attr.form.select?
# )
# shared-form.attrs &=
# ( scripting.attr.form.change?
# )
# form.attrs &=
# ( scripting.attr.form.reset?
# & scripting.attr.form.submit?
# )
scripting.attr.form.submit =
attribute onsubmit { string }
scripting.attr.form.reset =
attribute onreset { string }

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<define name="scripting.attr.form.select">
<a:documentation> RELAX NG Schema for HTML 5: Web Forms 1.0 Scripting #</a:documentation>
<attribute name="onselect">
<data type="string"/>
</attribute>
</define>
<define name="scripting.attr.form.change">
<attribute name="onchange">
<data type="string"/>
</attribute>
</define>
<!--
input.text.attrs &=
( scripting.attr.form.select?
)
-->
<!--
shared-form.attrs &=
( scripting.attr.form.change?
)
-->
<!--
form.attrs &=
( scripting.attr.form.reset?
& scripting.attr.form.submit?
)
-->
<define name="scripting.attr.form.submit">
<attribute name="onsubmit">
<data type="string"/>
</attribute>
</define>
<define name="scripting.attr.form.reset">
<attribute name="onreset">
<data type="string"/>
</attribute>
</define>
</grammar>

View File

@ -1,536 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Web Forms 1.0 markup #
# #####################################################################
## Shared attributes for form controls
common-form.attrs =
( common-form.attrs.name?
& common-form.attrs.disabled?
)
common-form.attrs.name =
attribute name {
string #REVISIT should this be restricted somehow? No & and = perhaps?
}
common-form.attrs.disabled =
attribute disabled {
w:string "disabled" | w:string ""
}
shared-form.attrs.readonly =
attribute readonly {
w:string "readonly" | w:string ""
}
shared-form.attrs.maxlength =
attribute maxlength {
common.data.integer.positive #REVISIT should this be non-negative?
}
shared-form.attrs.size =
attribute size {
common.data.integer.positive
}
# REVISIT tabindex goes in common.attrs
## Shared attributes for <input>
input.attrs.checked =
attribute checked {
w:string "checked" | w:string ""
}
## Text Field: <input type='text'>
input.text.elem =
element input { input.text.attrs }
input.text.attrs =
( common.attrs
& common-form.attrs
& input.text.attrs.type?
& shared-form.attrs.maxlength?
& shared-form.attrs.readonly?
& shared-form.attrs.size?
& input.text.attrs.value?
& ( common.attrs.aria
| common.attrs.aria.implicit.input
)?
)
input.text.attrs.type =
attribute type {
w:string "text"
}
input.text.attrs.value =
attribute value {
string #REVISIT "nominally" free of line breaks?
}
input.elem = input.text.elem
## Password Field: <input type='password'>
input.password.elem =
element input { input.password.attrs }
input.password.attrs =
( common.attrs
& common-form.attrs
& input.password.attrs.type
& shared-form.attrs.maxlength?
& shared-form.attrs.readonly?
& shared-form.attrs.size?
& input.password.attrs.value?
& common.attrs.aria.implicit.input?
)
input.password.attrs.type =
attribute type {
w:string "password"
}
input.password.attrs.value =
attribute value {
string #REVISIT "nominally" free of line breaks?
}
input.elem |= input.password.elem
## Checkbox: <input type='checkbox'>
input.checkbox.elem =
element input { input.checkbox.attrs }
input.checkbox.attrs =
( common.attrs
& common-form.attrs
& input.checkbox.attrs.type
& input.attrs.checked?
& input.checkbox.attrs.value?
& common.attrs.aria.implicit.input?
)
input.checkbox.attrs.type =
attribute type {
w:string "checkbox"
}
input.checkbox.attrs.value =
attribute value {
string #REVISIT require non-empty value?
}
input.elem |= input.checkbox.elem
## Radiobutton: <input type='radio'>
input.radio.elem =
element input { input.radio.attrs }
input.radio.attrs =
( common.attrs
& common-form.attrs
& input.radio.attrs.type
& input.attrs.checked?
& input.radio.attrs.value?
& common.attrs.aria.implicit.input?
)
input.radio.attrs.type =
attribute type {
w:string "radio"
}
input.radio.attrs.value =
attribute value {
string #REVISIT require non-empty value?
}
input.elem |= input.radio.elem
## Scripting Hook Button: <input type='button'>
input.button.elem =
element input { input.button.attrs }
input.button.attrs =
( common.attrs
& common-form.attrs
& input.button.attrs.type
& input.button.attrs.value?
& ( common.attrs.aria
| common.attrs.aria.implicit.button
)?
)
input.button.attrs.type =
attribute type {
w:string "button"
}
input.button.attrs.value =
attribute value {
string #REVISIT require non-empty value?
}
input.elem |= input.button.elem
#REVISIT should this be enabled by a scripting module only?
## Submit Button: <input type='submit'>
input.submit.elem =
element input { input.submit.attrs }
input.submit.attrs =
( common.attrs
& common-form.attrs
& input.submit.attrs.type
& input.submit.attrs.value?
& common.attrs.aria.implicit.button?
)
input.submit.attrs.type =
attribute type {
w:string "submit"
}
input.submit.attrs.value =
attribute value {
string #REVISIT require non-empty value?
}
input.elem |= input.submit.elem
## Reset Button: <input type='reset'>
input.reset.elem =
element input { input.reset.attrs }
input.reset.attrs =
( common.attrs
& common-form.attrs
& input.reset.attrs.type
& input.reset.attrs.value?
& common.attrs.aria.implicit.button?
)
input.reset.attrs.type =
attribute type {
w:string "reset"
}
input.reset.attrs.value =
attribute value {
string #REVISIT require non-empty value?
}
input.elem |= input.reset.elem
# REVISIT does reset make sense outside a form?
## File Upload: <input type='file'>
input.file.elem =
element input { input.file.attrs }
input.file.attrs =
( common.attrs
& common-form.attrs
& input.file.attrs.type
& input.file.attrs.accept?
& common.attrs.aria.implicit.input?
)
input.file.attrs.type =
attribute type {
w:string "file"
}
input.file.attrs.accept =
attribute accept {
form.data.mimetypelist
}
input.elem |= input.file.elem
## Hidden String: <input type='hidden'>
input.hidden.elem =
element input { input.hidden.attrs }
input.hidden.attrs =
( common.attrs
& common-form.attrs
& input.hidden.attrs.type
& input.hidden.attrs.value?
)
input.hidden.attrs.type =
attribute type {
w:string "hidden"
}
input.hidden.attrs.value =
attribute value {
string
}
input.elem |= input.hidden.elem
## Image Submit Button: <input type='image'>
input.image.elem =
element input { input.image.attrs }
input.image.attrs =
( common.attrs
& common-form.attrs
& input.image.attrs.type
& input.image.attrs.alt
& input.image.attrs.src?
& ( common.attrs.aria
| common.attrs.aria.implicit.button
)?
)
input.image.attrs.type =
attribute type {
w:string "image"
}
input.image.attrs.alt =
attribute alt {
string # XXX non-empty
}
input.image.attrs.src =
attribute src {
common.data.uri
}
input.elem |= input.image.elem
common.elem.phrasing |= input.elem
## Text Area: <textarea>
textarea.elem =
element textarea { textarea.inner & textarea.attrs }
textarea.attrs =
( common.attrs
& common-form.attrs
& shared-form.attrs.readonly?
& textarea.attrs.rows-and-cols-wf1
& common.attrs.aria.implicit.input?
#FIXME onfocus, onblur, onselect,onchange
)
# This is ugly.
textarea.attrs.rows-and-cols-wf1 =
textarea.attrs.rows-and-cols-wf1.inner
textarea.attrs.rows-and-cols-wf1.inner =
( textarea.attrs.cols
& textarea.attrs.rows
)
textarea.attrs.cols =
attribute cols {
common.data.integer.positive
}
textarea.attrs.rows =
attribute rows {
common.data.integer.positive
}
textarea.inner =
( text )
common.elem.phrasing |= textarea.elem
# Due to limitations with interleave, handling single/multiple selection
# enforcement in RELAX NG seems to be possible but really awkward.
# Tried it. Leaving it to Schematron.
## Select menu option: <option selected>
option.elem =
element option { option.inner & option.attrs }
option.attrs =
( common.attrs
& common-form.attrs.disabled?
& option.attrs.selected?
& option.attrs.label?
& option.attrs.value?
& common.attrs.aria.implicit.input?
)
option.attrs.selected =
attribute selected {
w:string "selected" | w:string ""
}
option.attrs.label =
attribute label {
string
}
option.attrs.value =
attribute value {
string
}
option.inner =
( text )
## Option Group: <optgroup>
optgroup.elem =
element optgroup { optgroup.inner & optgroup.attrs }
optgroup.attrs =
( common.attrs
& optgroup.attrs.label
& common-form.attrs.disabled?
)
optgroup.attrs.label =
attribute label {
string
}
optgroup.inner =
( option.elem* )
## Selection Menu: <select>
select.elem =
element select { select.inner & select.attrs }
select.attrs =
( common.attrs
& common-form.attrs
& select.attrs.size?
& select.attrs.multiple?
# FIXME onfocus, onblur, onchange
)
select.attrs.size =
attribute size {
common.data.integer.positive
}
select.attrs.multiple =
attribute multiple {
w:string "multiple" | w:string ""
}
select.inner =
( optgroup.elem*
& option.elem*
)
common.elem.phrasing |= select.elem
## Shared Definitions for Complex Button
button.attrs.value =
attribute value {
string
}
button.inner =
( common.inner.phrasing )
## Complex Submit Button: <button type='submit'>
button.submit.elem =
element button { button.inner & button.submit.attrs }
button.submit.attrs =
( common.attrs
& common-form.attrs
& button.submit.attrs.type?
& button.attrs.value?
& common.attrs.aria.implicit.button?
)
button.submit.attrs.type =
attribute type {
w:string "submit"
}
button.elem = button.submit.elem
## Complex Reset Button: <button type='reset'>
button.reset.elem =
element button { button.inner & button.reset.attrs }
button.reset.attrs =
( common.attrs
& common-form.attrs
& button.reset.attrs.type
& button.attrs.value? #REVISIT I guess this still affects the DOM
& common.attrs.aria.implicit.button?
)
button.reset.attrs.type =
attribute type {
w:string "reset"
}
button.elem |= button.reset.elem
## Complex Push Button: <button type='button'>
button.button.elem =
element button { button.inner & button.button.attrs }
button.button.attrs =
( common.attrs
& common-form.attrs
& button.button.attrs.type
& button.attrs.value? #REVISIT I guess this still affects the DOM
& ( common.attrs.aria
| common.attrs.aria.implicit.button
)?
)
button.button.attrs.type =
attribute type {
w:string "button"
}
button.elem |= button.button.elem
common.elem.phrasing |= button.elem
## Form: <form>
form.elem =
element form { form.inner & form.attrs }
form.attrs =
( common.attrs
& form.attrs.action? #REVISIT Should this be required anyway?
& form.attrs.method?
& form.attrs.enctype?
& common-form.attrs.name?
& form.attrs.accept-charset?
& ( common.attrs.aria
| common.attrs.aria.implicit.region
)?
)
form.attrs.action =
attribute action {
common.data.uri
}
form.attrs.method =
attribute method {
form.attrs.method.data
}
form.attrs.method.data =
( w:string "get" | w:string "post" )
form.attrs.enctype =
attribute enctype {
form.attrs.enctype.data
}
form.attrs.enctype.data =
( w:string "application/x-www-form-urlencoded"
| w:string "multipart/form-data"
)
form.attrs.accept-charset =
attribute accept-charset {
form.data.charsetlist
}
form.inner =
( common.inner.flow )
common.elem.flow |= form.elem
## Fieldset: <fieldset>
fieldset.elem =
element fieldset { fieldset.inner & fieldset.attrs }
fieldset.attrs =
( common.attrs
& common.attrs.aria.implicit.group?
)
fieldset.inner =
( legend.elem? #REVISIT should this be required?
, common.inner.flow
)
common.elem.flow |= fieldset.elem
## Label: <label>
label.elem =
element label { label.inner & label.attrs }
label.attrs =
( common.attrs
& label.attrs.for?
& common.attrs.aria.implicit.region?
)
label.attrs.for =
attribute for {
common.data.idref
}
label.inner =
( common.inner.phrasing ) #REVISIT making obvious guess
common.elem.phrasing |= label.elem

853
html5-syntax/web-forms.rng Normal file
View File

@ -0,0 +1,853 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://whattf.org/datatype-draft">
<!-- ##################################################################### -->
<define name="common-form.attrs">
<a:documentation> RELAX NG Schema for HTML 5: Web Forms 1.0 markup #</a:documentation>
<!-- ##################################################################### -->
<a:documentation>Shared attributes for form controls</a:documentation>
<interleave>
<optional>
<ref name="common-form.attrs.name"/>
</optional>
<optional>
<ref name="common-form.attrs.disabled"/>
</optional>
</interleave>
</define>
<define name="common-form.attrs.name">
<attribute name="name">
<data type="string" datatypeLibrary=""/>
<!-- REVISIT should this be restricted somehow? No & and = perhaps? -->
</attribute>
</define>
<define name="common-form.attrs.disabled">
<attribute name="disabled">
<choice>
<value type="string">disabled</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="shared-form.attrs.readonly">
<attribute name="readonly">
<choice>
<value type="string">readonly</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="shared-form.attrs.maxlength">
<attribute name="maxlength">
<ref name="common.data.integer.positive"/>
<!-- REVISIT should this be non-negative? -->
</attribute>
</define>
<define name="shared-form.attrs.size">
<attribute name="size">
<ref name="common.data.integer.positive"/>
</attribute>
</define>
<!-- REVISIT tabindex goes in common.attrs -->
<define name="input.attrs.checked">
<a:documentation>Shared attributes for &lt;input&gt;</a:documentation>
<attribute name="checked">
<choice>
<value type="string">checked</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="input.text.elem">
<a:documentation>Text Field: &lt;input type='text'&gt;</a:documentation>
<element name="input">
<ref name="input.text.attrs"/>
</element>
</define>
<define name="input.text.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<optional>
<ref name="input.text.attrs.type"/>
</optional>
<optional>
<ref name="shared-form.attrs.maxlength"/>
</optional>
<optional>
<ref name="shared-form.attrs.readonly"/>
</optional>
<optional>
<ref name="shared-form.attrs.size"/>
</optional>
<optional>
<ref name="input.text.attrs.value"/>
</optional>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.input"/>
</choice>
</optional>
</interleave>
</define>
<define name="input.text.attrs.type">
<attribute name="type">
<value type="string">text</value>
</attribute>
</define>
<define name="input.text.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
<!-- REVISIT "nominally" free of line breaks? -->
</attribute>
</define>
<define name="input.elem">
<ref name="input.text.elem"/>
</define>
<define name="input.password.elem">
<a:documentation>Password Field: &lt;input type='password'&gt;</a:documentation>
<element name="input">
<ref name="input.password.attrs"/>
</element>
</define>
<define name="input.password.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="input.password.attrs.type"/>
<optional>
<ref name="shared-form.attrs.maxlength"/>
</optional>
<optional>
<ref name="shared-form.attrs.readonly"/>
</optional>
<optional>
<ref name="shared-form.attrs.size"/>
</optional>
<optional>
<ref name="input.password.attrs.value"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.input"/>
</optional>
</interleave>
</define>
<define name="input.password.attrs.type">
<attribute name="type">
<value type="string">password</value>
</attribute>
</define>
<define name="input.password.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
<!-- REVISIT "nominally" free of line breaks? -->
</attribute>
</define>
<define name="input.elem" combine="choice">
<ref name="input.password.elem"/>
</define>
<define name="input.checkbox.elem">
<a:documentation>Checkbox: &lt;input type='checkbox'&gt;</a:documentation>
<element name="input">
<ref name="input.checkbox.attrs"/>
</element>
</define>
<define name="input.checkbox.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="input.checkbox.attrs.type"/>
<optional>
<ref name="input.attrs.checked"/>
</optional>
<optional>
<ref name="input.checkbox.attrs.value"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.input"/>
</optional>
</interleave>
</define>
<define name="input.checkbox.attrs.type">
<attribute name="type">
<value type="string">checkbox</value>
</attribute>
</define>
<define name="input.checkbox.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
<!-- REVISIT require non-empty value? -->
</attribute>
</define>
<define name="input.elem" combine="choice">
<ref name="input.checkbox.elem"/>
</define>
<define name="input.radio.elem">
<a:documentation>Radiobutton: &lt;input type='radio'&gt;</a:documentation>
<element name="input">
<ref name="input.radio.attrs"/>
</element>
</define>
<define name="input.radio.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="input.radio.attrs.type"/>
<optional>
<ref name="input.attrs.checked"/>
</optional>
<optional>
<ref name="input.radio.attrs.value"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.input"/>
</optional>
</interleave>
</define>
<define name="input.radio.attrs.type">
<attribute name="type">
<value type="string">radio</value>
</attribute>
</define>
<define name="input.radio.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
<!-- REVISIT require non-empty value? -->
</attribute>
</define>
<define name="input.elem" combine="choice">
<ref name="input.radio.elem"/>
</define>
<define name="input.button.elem">
<a:documentation>Scripting Hook Button: &lt;input type='button'&gt;</a:documentation>
<element name="input">
<ref name="input.button.attrs"/>
</element>
</define>
<define name="input.button.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="input.button.attrs.type"/>
<optional>
<ref name="input.button.attrs.value"/>
</optional>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.button"/>
</choice>
</optional>
</interleave>
</define>
<define name="input.button.attrs.type">
<attribute name="type">
<value type="string">button</value>
</attribute>
</define>
<define name="input.button.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
<!-- REVISIT require non-empty value? -->
</attribute>
</define>
<define name="input.elem" combine="choice">
<ref name="input.button.elem"/>
</define>
<!-- REVISIT should this be enabled by a scripting module only? -->
<define name="input.submit.elem">
<a:documentation>Submit Button: &lt;input type='submit'&gt;</a:documentation>
<element name="input">
<ref name="input.submit.attrs"/>
</element>
</define>
<define name="input.submit.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="input.submit.attrs.type"/>
<optional>
<ref name="input.submit.attrs.value"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.button"/>
</optional>
</interleave>
</define>
<define name="input.submit.attrs.type">
<attribute name="type">
<value type="string">submit</value>
</attribute>
</define>
<define name="input.submit.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
<!-- REVISIT require non-empty value? -->
</attribute>
</define>
<define name="input.elem" combine="choice">
<ref name="input.submit.elem"/>
</define>
<define name="input.reset.elem">
<a:documentation>Reset Button: &lt;input type='reset'&gt;</a:documentation>
<element name="input">
<ref name="input.reset.attrs"/>
</element>
</define>
<define name="input.reset.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="input.reset.attrs.type"/>
<optional>
<ref name="input.reset.attrs.value"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.button"/>
</optional>
</interleave>
</define>
<define name="input.reset.attrs.type">
<attribute name="type">
<value type="string">reset</value>
</attribute>
</define>
<define name="input.reset.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
<!-- REVISIT require non-empty value? -->
</attribute>
</define>
<define name="input.elem" combine="choice">
<ref name="input.reset.elem"/>
</define>
<!-- REVISIT does reset make sense outside a form? -->
<define name="input.file.elem">
<a:documentation>File Upload: &lt;input type='file'&gt;</a:documentation>
<element name="input">
<ref name="input.file.attrs"/>
</element>
</define>
<define name="input.file.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="input.file.attrs.type"/>
<optional>
<ref name="input.file.attrs.accept"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.input"/>
</optional>
</interleave>
</define>
<define name="input.file.attrs.type">
<attribute name="type">
<value type="string">file</value>
</attribute>
</define>
<define name="input.file.attrs.accept">
<attribute name="accept">
<ref name="form.data.mimetypelist"/>
</attribute>
</define>
<define name="input.elem" combine="choice">
<ref name="input.file.elem"/>
</define>
<define name="input.hidden.elem">
<a:documentation>Hidden String: &lt;input type='hidden'&gt;</a:documentation>
<element name="input">
<ref name="input.hidden.attrs"/>
</element>
</define>
<define name="input.hidden.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="input.hidden.attrs.type"/>
<optional>
<ref name="input.hidden.attrs.value"/>
</optional>
</interleave>
</define>
<define name="input.hidden.attrs.type">
<attribute name="type">
<value type="string">hidden</value>
</attribute>
</define>
<define name="input.hidden.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="input.elem" combine="choice">
<ref name="input.hidden.elem"/>
</define>
<define name="input.image.elem">
<a:documentation>Image Submit Button: &lt;input type='image'&gt;</a:documentation>
<element name="input">
<ref name="input.image.attrs"/>
</element>
</define>
<define name="input.image.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="input.image.attrs.type"/>
<ref name="input.image.attrs.alt"/>
<optional>
<ref name="input.image.attrs.src"/>
</optional>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.button"/>
</choice>
</optional>
</interleave>
</define>
<define name="input.image.attrs.type">
<attribute name="type">
<value type="string">image</value>
</attribute>
</define>
<define name="input.image.attrs.alt">
<attribute name="alt">
<data type="string" datatypeLibrary=""/>
<!-- XXX non-empty -->
</attribute>
</define>
<define name="input.image.attrs.src">
<attribute name="src">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="input.elem" combine="choice">
<ref name="input.image.elem"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="input.elem"/>
</define>
<define name="textarea.elem">
<a:documentation>Text Area: &lt;textarea&gt;</a:documentation>
<element name="textarea">
<interleave>
<ref name="textarea.inner"/>
<ref name="textarea.attrs"/>
</interleave>
</element>
</define>
<define name="textarea.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<optional>
<ref name="shared-form.attrs.readonly"/>
</optional>
<ref name="textarea.attrs.rows-and-cols-wf1"/>
<optional>
<ref name="common.attrs.aria.implicit.input"/>
</optional>
</interleave>
<!-- FIXME onfocus, onblur, onselect,onchange -->
</define>
<!-- This is ugly. -->
<define name="textarea.attrs.rows-and-cols-wf1">
<ref name="textarea.attrs.rows-and-cols-wf1.inner"/>
</define>
<define name="textarea.attrs.rows-and-cols-wf1.inner">
<interleave>
<ref name="textarea.attrs.cols"/>
<ref name="textarea.attrs.rows"/>
</interleave>
</define>
<define name="textarea.attrs.cols">
<attribute name="cols">
<ref name="common.data.integer.positive"/>
</attribute>
</define>
<define name="textarea.attrs.rows">
<attribute name="rows">
<ref name="common.data.integer.positive"/>
</attribute>
</define>
<define name="textarea.inner">
<text/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="textarea.elem"/>
</define>
<!--
Due to limitations with interleave, handling single/multiple selection
enforcement in RELAX NG seems to be possible but really awkward.
Tried it. Leaving it to Schematron.
-->
<define name="option.elem">
<a:documentation>Select menu option: &lt;option selected&gt;</a:documentation>
<element name="option">
<interleave>
<ref name="option.inner"/>
<ref name="option.attrs"/>
</interleave>
</element>
</define>
<define name="option.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common-form.attrs.disabled"/>
</optional>
<optional>
<ref name="option.attrs.selected"/>
</optional>
<optional>
<ref name="option.attrs.label"/>
</optional>
<optional>
<ref name="option.attrs.value"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.input"/>
</optional>
</interleave>
</define>
<define name="option.attrs.selected">
<attribute name="selected">
<choice>
<value type="string">selected</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="option.attrs.label">
<attribute name="label">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="option.attrs.value">
<attribute name="value">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="option.inner">
<text/>
</define>
<define name="optgroup.elem">
<a:documentation>Option Group: &lt;optgroup&gt;</a:documentation>
<element name="optgroup">
<interleave>
<ref name="optgroup.inner"/>
<ref name="optgroup.attrs"/>
</interleave>
</element>
</define>
<define name="optgroup.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="optgroup.attrs.label"/>
<optional>
<ref name="common-form.attrs.disabled"/>
</optional>
</interleave>
</define>
<define name="optgroup.attrs.label">
<attribute name="label">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="optgroup.inner">
<zeroOrMore>
<ref name="option.elem"/>
</zeroOrMore>
</define>
<define name="select.elem">
<a:documentation>Selection Menu: &lt;select&gt;</a:documentation>
<element name="select">
<interleave>
<ref name="select.inner"/>
<ref name="select.attrs"/>
</interleave>
</element>
</define>
<define name="select.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<optional>
<ref name="select.attrs.size"/>
</optional>
<optional>
<ref name="select.attrs.multiple"/>
</optional>
</interleave>
<!-- FIXME onfocus, onblur, onchange -->
</define>
<define name="select.attrs.size">
<attribute name="size">
<ref name="common.data.integer.positive"/>
</attribute>
</define>
<define name="select.attrs.multiple">
<attribute name="multiple">
<choice>
<value type="string">multiple</value>
<value type="string"/>
</choice>
</attribute>
</define>
<define name="select.inner">
<interleave>
<zeroOrMore>
<ref name="optgroup.elem"/>
</zeroOrMore>
<zeroOrMore>
<ref name="option.elem"/>
</zeroOrMore>
</interleave>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="select.elem"/>
</define>
<define name="button.attrs.value">
<a:documentation>Shared Definitions for Complex Button</a:documentation>
<attribute name="value">
<data type="string" datatypeLibrary=""/>
</attribute>
</define>
<define name="button.inner">
<ref name="common.inner.phrasing"/>
</define>
<define name="button.submit.elem">
<a:documentation>Complex Submit Button: &lt;button type='submit'&gt;</a:documentation>
<element name="button">
<interleave>
<ref name="button.inner"/>
<ref name="button.submit.attrs"/>
</interleave>
</element>
</define>
<define name="button.submit.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<optional>
<ref name="button.submit.attrs.type"/>
</optional>
<optional>
<ref name="button.attrs.value"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.button"/>
</optional>
</interleave>
</define>
<define name="button.submit.attrs.type">
<attribute name="type">
<value type="string">submit</value>
</attribute>
</define>
<define name="button.elem">
<ref name="button.submit.elem"/>
</define>
<define name="button.reset.elem">
<a:documentation>Complex Reset Button: &lt;button type='reset'&gt;</a:documentation>
<element name="button">
<interleave>
<ref name="button.inner"/>
<ref name="button.reset.attrs"/>
</interleave>
</element>
</define>
<define name="button.reset.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="button.reset.attrs.type"/>
<optional>
<ref name="button.attrs.value"/>
</optional>
<optional>
<!-- REVISIT I guess this still affects the DOM -->
<ref name="common.attrs.aria.implicit.button"/>
</optional>
</interleave>
</define>
<define name="button.reset.attrs.type">
<attribute name="type">
<value type="string">reset</value>
</attribute>
</define>
<define name="button.elem" combine="choice">
<ref name="button.reset.elem"/>
</define>
<define name="button.button.elem">
<a:documentation>Complex Push Button: &lt;button type='button'&gt;</a:documentation>
<element name="button">
<interleave>
<ref name="button.inner"/>
<ref name="button.button.attrs"/>
</interleave>
</element>
</define>
<define name="button.button.attrs">
<interleave>
<ref name="common.attrs"/>
<ref name="common-form.attrs"/>
<ref name="button.button.attrs.type"/>
<optional>
<ref name="button.attrs.value"/>
</optional>
<optional>
<!-- REVISIT I guess this still affects the DOM -->
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.button"/>
</choice>
</optional>
</interleave>
</define>
<define name="button.button.attrs.type">
<attribute name="type">
<value type="string">button</value>
</attribute>
</define>
<define name="button.elem" combine="choice">
<ref name="button.button.elem"/>
</define>
<define name="common.elem.phrasing" combine="choice">
<ref name="button.elem"/>
</define>
<define name="form.elem">
<a:documentation>Form: &lt;form&gt;</a:documentation>
<element name="form">
<interleave>
<ref name="form.inner"/>
<ref name="form.attrs"/>
</interleave>
</element>
</define>
<define name="form.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="form.attrs.action"/>
</optional>
<optional>
<!-- REVISIT Should this be required anyway? -->
<ref name="form.attrs.method"/>
</optional>
<optional>
<ref name="form.attrs.enctype"/>
</optional>
<optional>
<ref name="common-form.attrs.name"/>
</optional>
<optional>
<ref name="form.attrs.accept-charset"/>
</optional>
<optional>
<choice>
<ref name="common.attrs.aria"/>
<ref name="common.attrs.aria.implicit.region"/>
</choice>
</optional>
</interleave>
</define>
<define name="form.attrs.action">
<attribute name="action">
<ref name="common.data.uri"/>
</attribute>
</define>
<define name="form.attrs.method">
<attribute name="method">
<ref name="form.attrs.method.data"/>
</attribute>
</define>
<define name="form.attrs.method.data">
<choice>
<value type="string">get</value>
<value type="string">post</value>
</choice>
</define>
<define name="form.attrs.enctype">
<attribute name="enctype">
<ref name="form.attrs.enctype.data"/>
</attribute>
</define>
<define name="form.attrs.enctype.data">
<choice>
<value type="string">application/x-www-form-urlencoded</value>
<value type="string">multipart/form-data</value>
</choice>
</define>
<define name="form.attrs.accept-charset">
<attribute name="accept-charset">
<ref name="form.data.charsetlist"/>
</attribute>
</define>
<define name="form.inner">
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="form.elem"/>
</define>
<define name="fieldset.elem">
<a:documentation>Fieldset: &lt;fieldset&gt;</a:documentation>
<element name="fieldset">
<interleave>
<ref name="fieldset.inner"/>
<ref name="fieldset.attrs"/>
</interleave>
</element>
</define>
<define name="fieldset.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="common.attrs.aria.implicit.group"/>
</optional>
</interleave>
</define>
<define name="fieldset.inner">
<optional>
<ref name="legend.elem"/>
</optional>
<!-- REVISIT should this be required? -->
<ref name="common.inner.flow"/>
</define>
<define name="common.elem.flow" combine="choice">
<ref name="fieldset.elem"/>
</define>
<define name="label.elem">
<a:documentation>Label: &lt;label&gt;</a:documentation>
<element name="label">
<interleave>
<ref name="label.inner"/>
<ref name="label.attrs"/>
</interleave>
</element>
</define>
<define name="label.attrs">
<interleave>
<ref name="common.attrs"/>
<optional>
<ref name="label.attrs.for"/>
</optional>
<optional>
<ref name="common.attrs.aria.implicit.region"/>
</optional>
</interleave>
</define>
<define name="label.attrs.for">
<attribute name="for">
<ref name="common.data.idref"/>
</attribute>
</define>
<define name="label.inner">
<ref name="common.inner.phrasing"/>
</define>
<!-- REVISIT making obvious guess -->
<define name="common.elem.phrasing" combine="choice">
<ref name="label.elem"/>
</define>
</grammar>

View File

@ -1,15 +0,0 @@
# #####################################################################
## RELAX NG Schema for HTML 5: Web Forms 2.0 Scripting #
# #####################################################################
scripting.attr.form.formchange =
attribute onformchange { string }
scripting.attr.form.forminput =
attribute onforminput { string }
# output.attrs &=
# ( scripting.attr.form.formchange?
# & scripting.attr.form.forminput?
# & scripting.attr.form.change?
# )

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
<!-- ##################################################################### -->
<!-- ##################################################################### -->
<define name="scripting.attr.form.formchange">
<a:documentation> RELAX NG Schema for HTML 5: Web Forms 2.0 Scripting #</a:documentation>
<attribute name="onformchange">
<data type="string"/>
</attribute>
</define>
<define name="scripting.attr.form.forminput">
<attribute name="onforminput">
<data type="string"/>
</attribute>
</define>
</grammar>
<!--
output.attrs &=
( scripting.attr.form.formchange?
& scripting.attr.form.forminput?
& scripting.attr.form.change?
)
-->

View File

@ -1,790 +0,0 @@
datatypes w = "http://whattf.org/datatype-draft"
# #####################################################################
## RELAX NG Schema for HTML 5: Web Forms 2.0 markup #
# #####################################################################
## Shared attributes for form controls
common-form.attrs &=
( common-form.attrs.form? )
common-form.attrs.form |=
attribute form {
common.data.idref
}
shared-form.attrs.formaction =
attribute formaction {
common.data.uri
}
shared-form.attrs.formenctype =
attribute formenctype {
shared-form.attrs.formenctype.data
}
shared-form.attrs.formenctype.data =
( w:string "application/x-www-form-urlencoded"
| w:string "multipart/form-data"
| w:string "text/plain"
)
shared-form.attrs.formmethod =
attribute formmethod {
shared-form.attrs.formmethod.data
}
shared-form.attrs.formmethod.data =
( w:string "get"
| w:string "post"
| w:string "put"
| w:string "delete"
)
shared-form.attrs.formtarget =
attribute formtarget {
common.data.browsing-context-or-keyword
}
shared-form.attrs.formnovalidate =
attribute formnovalidate {
w:string "formnovalidate" | w:string ""
}
shared-form.attrs.autofocus =
attribute autofocus {
w:string "autofocus" | w:string ""
}
shared-form.attrs.pattern =
attribute pattern {
form.data.pattern
}
shared-form.attrs.template =
attribute template {
common.data.idref
}
shared-form.attrs.required =
attribute required {
w:string "required" | w:string ""
}
shared-form.attrs.placeholder =
attribute placeholder {
string # FIXME line breaks
}
## Shared attributes for <input>
input.attrs.autocomplete =
attribute autocomplete {
w:string "on" | w:string "off"
}
input.attrs.list =
attribute list {
common.data.idref
}
input.attrs.step.float =
attribute step {
w:string "any" | common.data.float.positive
}
input.attrs.step.integer =
attribute step {
w:string "any" | common.data.integer.positive
}
input.attrs.multiple =
attribute multiple {
w:string "multiple" | w:string ""
}
## Text Field: <input type='text'>, Extensions
input.text.attrs &=
( input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& shared-form.attrs.pattern?
& shared-form.attrs.required?
& shared-form.attrs.placeholder?
)
## Password Field: <input type='password'>, Extensions
input.password.attrs &=
( input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& shared-form.attrs.pattern?
& shared-form.attrs.required?
& shared-form.attrs.placeholder?
)
## Checkbox <input type='checkbox'>, Extensions
input.checkbox.attrs &=
( shared-form.attrs.autofocus?
& shared-form.attrs.required?
)
## Radiobutton: <input type='radio'>, Extensions
input.radio.attrs &=
( shared-form.attrs.autofocus?
& shared-form.attrs.required?
)
## Scripting Hook Button: <input type='button'>, Extensions
input.button.attrs &=
( shared-form.attrs.autofocus? )
## Submit Button: <input type='submit'>, Extensions
input.submit.attrs &=
( shared-form.attrs.formaction?
& shared-form.attrs.autofocus?
& shared-form.attrs.formenctype?
& shared-form.attrs.formmethod?
& shared-form.attrs.formtarget?
& shared-form.attrs.formnovalidate?
)
## Reset Button: <input type='reset'>, Extensions
input.reset.attrs &=
( shared-form.attrs.autofocus? )
## File Upload: <input type='file'>, Extensions
input.file.attrs &=
( shared-form.attrs.autofocus?
& shared-form.attrs.required?
& input.attrs.multiple?
)
## Image Submit Button: <input type='image'>, Extensions
input.image.attrs &=
( shared-form.attrs.formaction?
& shared-form.attrs.autofocus?
& shared-form.attrs.formenctype?
& shared-form.attrs.formmethod?
& shared-form.attrs.formtarget?
& shared-form.attrs.formnovalidate?
& input.image.attrs.height?
& input.image.attrs.width?
)
input.image.attrs.height =
attribute height {
common.data.integer.non-negative
}
input.image.attrs.width =
attribute width {
common.data.integer.non-negative
}
## Global Date and Time: <input type='datetime'>
input.datetime.elem =
element input { input.datetime.attrs }
input.datetime.attrs =
( common.attrs
& common-form.attrs
& input.datetime.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& input.datetime.attrs.min?
& input.datetime.attrs.max?
& input.attrs.step.float?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& input.datetime.attrs.value?
& common.attrs.aria.implicit.input?
)
input.datetime.attrs.type =
attribute type {
w:string "datetime"
}
input.datetime.attrs.min =
attribute min {
common.data.datetime
}
input.datetime.attrs.max =
attribute max {
common.data.datetime
}
input.datetime.attrs.value =
attribute value {
common.data.datetime
}
input.elem |= input.datetime.elem
## Date and Time with No Time Zone Information: <input type='datetime-local'>
input.datetime-local.elem =
element input { input.datetime-local.attrs }
input.datetime-local.attrs =
( common.attrs
& common-form.attrs
& input.datetime-local.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& input.datetime-local.attrs.min?
& input.datetime-local.attrs.max?
& input.attrs.step.float?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& input.datetime-local.attrs.value?
& common.attrs.aria.implicit.input?
)
input.datetime-local.attrs.type =
attribute type {
w:string "datetime-local"
}
input.datetime-local.attrs.min =
attribute min {
form.data.datetime-local
}
input.datetime-local.attrs.max =
attribute max {
form.data.datetime-local
}
input.datetime-local.attrs.value =
attribute value {
form.data.datetime-local
}
input.elem |= input.datetime-local.elem
## Date: <input type='date'>
input.date.elem =
element input { input.date.attrs }
input.date.attrs =
( common.attrs
& common-form.attrs
& input.date.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& input.date.attrs.min?
& input.date.attrs.max?
& input.attrs.step.integer?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& input.date.attrs.value?
& common.attrs.aria.implicit.input?
)
input.date.attrs.type =
attribute type {
w:string "date"
}
input.date.attrs.min =
attribute min {
form.data.date
}
input.date.attrs.max =
attribute max {
form.data.date
}
input.date.attrs.value =
attribute value {
form.data.date
}
input.elem |= input.date.elem
## Year and Month: <input type='month'>
input.month.elem =
element input { input.month.attrs }
input.month.attrs =
( common.attrs
& common-form.attrs
& input.month.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& input.month.attrs.min?
& input.month.attrs.max?
& input.attrs.step.integer?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& input.month.attrs.value?
& common.attrs.aria.implicit.input?
)
input.month.attrs.type =
attribute type {
w:string "month"
}
input.month.attrs.min =
attribute min {
form.data.month
}
input.month.attrs.max =
attribute max {
form.data.month
}
input.month.attrs.value =
attribute value {
form.data.month
}
input.elem |= input.month.elem
## Time without Time Zone Information: <input type='time'>
input.time.elem =
element input { input.time.attrs }
input.time.attrs =
( common.attrs
& common-form.attrs
& input.time.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& input.time.attrs.min?
& input.time.attrs.max?
& input.attrs.step.float?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& input.time.attrs.value?
& common.attrs.aria.implicit.input?
)
input.time.attrs.type =
attribute type {
w:string "time"
}
input.time.attrs.min =
attribute min {
form.data.time
}
input.time.attrs.max =
attribute max {
form.data.time
}
input.time.attrs.value =
attribute value {
form.data.time
}
input.elem |= input.time.elem
## Year and Week: <input type='week'>
input.week.elem =
element input { input.week.attrs }
input.week.attrs =
( common.attrs
& common-form.attrs
& input.week.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& input.week.attrs.min?
& input.week.attrs.max?
& input.attrs.step.integer?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& input.week.attrs.value?
& common.attrs.aria.implicit.input?
)
input.week.attrs.type =
attribute type {
w:string "week"
}
input.week.attrs.min =
attribute min {
form.data.week
}
input.week.attrs.max =
attribute max {
form.data.week
}
input.week.attrs.value =
attribute value {
form.data.week
}
input.elem |= input.week.elem
## Number: <input type='number'>
input.number.elem =
element input { input.number.attrs }
input.number.attrs =
( common.attrs
& common-form.attrs
& input.number.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& input.number.attrs.min?
& input.number.attrs.max?
& input.attrs.step.float?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& input.number.attrs.value?
& common.attrs.aria.implicit.input?
)
input.number.attrs.type =
attribute type {
w:string "number"
}
input.number.attrs.min =
attribute min {
common.data.float
}
input.number.attrs.max =
attribute max {
common.data.float
}
input.number.attrs.value =
attribute value {
common.data.float
}
input.elem |= input.number.elem
## Imprecise Number: <input type='range'>
input.range.elem =
element input { input.range.attrs }
input.range.attrs =
( common.attrs
& common-form.attrs
& input.range.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& input.range.attrs.min?
& input.range.attrs.max?
& input.attrs.step.float?
& input.range.attrs.value?
& common.attrs.aria.implicit.input?
)
input.range.attrs.type =
attribute type {
w:string "range"
}
input.range.attrs.min =
attribute min {
common.data.float
}
input.range.attrs.max =
attribute max {
common.data.float
}
input.range.attrs.value =
attribute value {
common.data.float
}
input.elem |= input.range.elem
## Email Address: <input type='email'>
input.email.elem =
element input { input.email.attrs }
input.email.attrs =
( common.attrs
& common-form.attrs
& input.email.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& shared-form.attrs.maxlength?
& shared-form.attrs.pattern?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& shared-form.attrs.size?
& shared-form.attrs.placeholder?
& ( ( input.attrs.multiple
& input.email.attrs.value.multiple?
)
| input.email.attrs.value.single?
)?
& common.attrs.aria.implicit.input?
)
input.email.attrs.type =
attribute type {
w:string "email"
}
input.email.attrs.value.single =
attribute value {
form.data.emailaddress
}
input.email.attrs.value.multiple =
attribute value {
form.data.emailaddresslist
}
input.elem |= input.email.elem
## IRI: <input type='url'>
input.url.elem =
element input { input.url.attrs }
input.url.attrs =
( common.attrs
& common-form.attrs
& input.url.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& shared-form.attrs.maxlength?
& shared-form.attrs.pattern?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& shared-form.attrs.size?
& shared-form.attrs.placeholder?
& input.url.attrs.value?
& common.attrs.aria.implicit.input?
)
input.url.attrs.type =
attribute type {
w:string "url"
}
input.url.attrs.value =
attribute value {
w:string "" | common.data.uri.absolute
}
input.elem |= input.url.elem
## Search: <input type='search'>
input.search.elem =
element input { input.search.attrs }
input.search.attrs =
( common.attrs
& common-form.attrs
& input.search.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& shared-form.attrs.maxlength?
& shared-form.attrs.pattern?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& shared-form.attrs.size?
& shared-form.attrs.placeholder?
& input.search.attrs.value?
& common.attrs.aria.implicit.input?
)
input.search.attrs.type =
attribute type {
w:string "search"
}
input.search.attrs.value =
attribute value {
string # FIXME line breaks
}
input.elem |= input.search.elem
## Telephone Number: <input type='tel'>
input.tel.elem =
element input { input.tel.attrs }
input.tel.attrs =
( common.attrs
& common-form.attrs
& input.tel.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& shared-form.attrs.maxlength?
& shared-form.attrs.pattern?
& shared-form.attrs.readonly?
& shared-form.attrs.required?
& shared-form.attrs.size?
& shared-form.attrs.placeholder?
& input.tel.attrs.value?
& common.attrs.aria.implicit.input?
)
input.tel.attrs.type =
attribute type {
w:string "tel"
}
input.tel.attrs.value =
attribute value {
string # FIXME line breaks
}
input.elem |= input.tel.elem
## Color: <input type='color'>
input.color.elem =
element input { input.color.attrs }
input.color.attrs =
( common.attrs
& common-form.attrs
& input.color.attrs.type
& input.attrs.autocomplete?
& shared-form.attrs.autofocus?
& input.attrs.list?
& input.color.attrs.value?
& common.attrs.aria.implicit.input?
)
input.color.attrs.type =
attribute type {
w:string "color"
}
input.color.attrs.value =
attribute value {
form.data.color
}
input.elem |= input.color.elem
## Form Output: <output>
output.elem =
element output { output.inner & output.attrs }
output.attrs =
( common.attrs
& common-form.attrs.name?
& common-form.attrs.form?
& output.attrs.for?
& common.attrs.aria.implicit.region?
)
output.attrs.for =
attribute for {
common.data.idrefs #REVISIT spec says space--not whitespace
}
output.inner =
( common.inner.phrasing )
common.elem.phrasing |= output.elem
## Text Area: <textarea>, extensions
textarea.attrs.rows-and-cols-wf1.inner &=
notAllowed
textarea.attrs.rows-and-cols-wf1 |=
empty
textarea.attrs &=
( shared-form.attrs.maxlength?
& shared-form.attrs.autofocus?
& shared-form.attrs.required?
& shared-form.attrs.placeholder?
& textarea.attrs.rows?
& ( ( textarea.attrs.wrap.hard
& textarea.attrs.cols
)
| ( textarea.attrs.wrap.soft?
& textarea.attrs.cols?
)
)
)
textarea.attrs.wrap.hard =
attribute wrap {
w:string "hard"
}
textarea.attrs.wrap.soft =
attribute wrap {
w:string "soft"
}
## List of Prefill Data: <datalist>
#REVISIT should the options in datalist be non-selectable?
datalist.elem =
element datalist { datalist.inner & datalist.attrs }
datalist.inner =
( option.elem* & common.inner.phrasing )
datalist.attrs =
( common.attrs )
common.elem.phrasing |= datalist.elem
## Complex Submit Button: <button type='submit'>, extensions
button.submit.attrs &=
( shared-form.attrs.formaction?
& shared-form.attrs.autofocus?
& shared-form.attrs.formenctype?
& shared-form.attrs.formmethod?
& shared-form.attrs.formtarget?
& shared-form.attrs.formnovalidate?
)
## Complex Reset Button: <button type='reset'>, extensions
button.reset.attrs &=
( shared-form.attrs.autofocus? )
## Complex Push Button: <button type='button'>, extensions
button.button.attrs &=
( shared-form.attrs.autofocus? )
## Form: <form>, extensions
form.attrs &=
( form.attrs.novalidate?
& form.attrs.target?
& form.attrs.autocomplete?
)
form.attrs.novalidate =
attribute novalidate {
w:string "novalidate" | w:string ""
}
form.attrs.target =
attribute target {
common.data.browsing-context-or-keyword
}
form.attrs.autocomplete =
attribute autocomplete {
w:string "on" | w:string "off"
}
# REVISIT should this be case-insensitive in conforming XHTML documents?
form.attrs.enctype.data |=
( w:string "text/plain" )
form.attrs.method.data |=
( w:string "put" | w:string "delete" )
## Fieldset: <fieldset>, extensions
fieldset.attrs &=
( common-form.attrs )
## Label: <label>, extensions
label.attrs &=
( common-form.attrs.form? )
## Key-pair generator/input control: <keygen>
keygen.elem =
element keygen { keygen.inner & keygen.attrs }
keygen.attrs =
( common.attrs
& keygen.attrs.challenge?
& keygen.attrs.keytype?
& shared-form.attrs.autofocus?
& common-form.attrs?
#REVISIT which ARIA attributes needed here
)
keygen.attrs.challenge =
attribute challenge {
string
}
keygen.attrs.keytype =
attribute keytype {
w:string "rsa"
}
keygen.inner =
( empty )
common.elem.phrasing |= keygen.elem

1347
html5-syntax/web-forms2.rng Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
default namespace = "http://www.w3.org/1999/xhtml"
# #####################################################################
## RELAX NG Schema for XHTML 5 #
# #####################################################################
# To validate an XHTML 5 document, you must first validate against #
# this schema and then ALSO validate against assertions.sch #
# #####################################################################
## Schema Framework & Parameters
include "common.rnc" {
# XHTML flavor #
XMLonly = empty
HTMLonly = notAllowed
# HTML 4 compat #
v5only = empty
}
# #####################################################################
## Language Definitions
start = html.elem
include "meta.rnc"
include "phrase.rnc"
include "block.rnc"
include "sectional.rnc"
include "structural.rnc"
include "revision.rnc"
include "embed.rnc"
include "ruby.rnc"
include "media.rnc"
include "core-scripting.rnc"
include "tables.rnc"
include "form-datatypes.rnc"
include "web-forms.rnc"
include "web-forms2.rnc"
include "applications.rnc"
include "data.rnc"

46
html5-syntax/xhtml5.rng Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="http://www.w3.org/1999/xhtml" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<!-- ##################################################################### -->
<include href="common.rng">
<a:documentation> RELAX NG Schema for XHTML 5 #</a:documentation>
<!-- ##################################################################### -->
<!--
To validate an XHTML 5 document, you must first validate against #
this schema and then ALSO validate against assertions.sch #
-->
<!-- ##################################################################### -->
<a:documentation>Schema Framework &amp; Parameters</a:documentation>
<!-- XHTML flavor # -->
<define name="XMLonly">
<empty/>
</define>
<define name="HTMLonly">
<notAllowed/>
</define>
<!-- HTML 4 compat # -->
<define name="v5only">
<empty/>
</define>
</include>
<!-- ##################################################################### -->
<start>
<a:documentation>Language Definitions</a:documentation>
<ref name="html.elem"/>
</start>
<include href="meta.rng"/>
<include href="phrase.rng"/>
<include href="block.rng"/>
<include href="sectional.rng"/>
<include href="structural.rng"/>
<include href="revision.rng"/>
<include href="embed.rng"/>
<include href="ruby.rng"/>
<include href="media.rng"/>
<include href="core-scripting.rng"/>
<include href="tables.rng"/>
<include href="form-datatypes.rng"/>
<include href="web-forms.rng"/>
<include href="web-forms2.rng"/>
<include href="applications.rng"/>
<include href="data.rng"/>
</grammar>