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 ) nonRoundtrippable = empty ## XML features that can't be serialized as HTML nonHTMLizable = empty ## features that are not part of the W3C HTML spec nonW3C = empty # ##################################################################### ## Wildcards # # ##################################################################### ## Any attribute from any namespace common.attr.anything = attribute * { text }* ## Any element from any namespace common.elem.anything = element * { common.inner.anything & common.attr.anything } ## Any content from any namespace common.inner.anything = ( text & common.elem.anything* ) # ##################################################################### ## Common Element Classes # # ##################################################################### ## Metadata Elements common.elem.metadata = ( notAllowed ) ## Phrase Elements common.elem.phrasing = ( notAllowed ) ## Prose Elements common.elem.flow = ( common.elem.phrasing ) # ##################################################################### ## Common Content Models # # ##################################################################### ## Metadata Content common.inner.metadata = ( common.elem.metadata* ) ## Phrase Content common.inner.phrasing = ( text & common.elem.phrasing* ) ## Prose Content common.inner.transparent.flow = ( text & common.elem.flow* ) common.inner.flow = ( style.elem.scoped*, ( text & common.elem.flow* ) ) # ##################################################################### ## Common Attributes # # ##################################################################### # When updating, check definition too common.attrs = ( common.attrs.basic & common.attrs.i18n & common.attrs.present & common.attrs.other ) common.attrs.basic = ( common.attrs.id? & common.attrs.class? & common.attrs.title? & common.attrs.base? & common.attrs.space? ) common.attrs.id = attribute id { common.data.id } common.attrs.class = attribute class { common.data.tokens } common.attrs.title = attribute title { text } common.attrs.base = common.attrs.xmlbase & nonRoundtrippable common.attrs.xmlbase = attribute xml:base { common.data.uri } & XMLonly common.attrs.space = common.attrs.xmlspace common.attrs.xmlspace = attribute xml:space { string "preserve" | string "default" } & XMLonly common.attrs.i18n = ( common.attrs.dir? & common.attrs.language? & common.attrs.translate? ) common.attrs.dir = attribute dir { w:string "ltr" | w:string "rtl" | w:string "auto" } # This lang definition is a hack for enviroments where # the HTML5 parser maps lang to xml:lang. # Sameness check left to Schematron common.attrs.language = ( common.attrs.xmllang? & common.attrs.lang? ) common.attrs.lang = attribute lang { common.data.langcode } & XMLonly common.attrs.xmllang = attribute xml:lang { common.data.langcode } # common.attrs.language = # ( common.attrs.lang # | common.attrs.xmllang # ) # common.attrs.lang = # attribute lang { # common.data.langcode # } & HTMLonly # common.attrs.xmllang = # attribute xml:lang { # common.data.langcode # } & XMLonly common.attrs.translate = attribute translate { w:string "" | w:string "yes" | w:string "no" } common.attrs.present = ( common.attrs.style? & common.attrs.tabindex? & common.attrs.accesskey? ) common.attrs.style = attribute style { string } common.attrs.tabindex = attribute tabindex { common.data.integer } # REVISIT move style to a module and bundle tabindex with ARIA common.attrs.accesskey = attribute accesskey { common.data.keylabellist } common.attrs.other = empty # ##################################################################### ## Common Datatypes # # ##################################################################### ## Names and Tokens common.data.tokens = list { token* } common.data.browsing-context = w:browsing-context common.data.browsing-context-or-keyword = w:browsing-context-or-keyword # xsd:string { # pattern = "()|([^_].*)|(_[bB][lL][aA][nN][kK])|(_[sS][eE][lL][fF])|(_[pP][aA][rR][eE][nN][tT])|(_[tT][oO][pP])" # } ## IDs and IDREFs common.data.id = w:ID # xsd:string { # pattern = "\S+" # } common.data.idref = w:IDREF common.data.idrefs = w:IDREFS common.data.name = w:ID #FIXME common.data.hash-name = w:hash-name # xsd:string { # pattern = "#.+" # } ## Numerical common.data.integer = w:integer # xsd:string { # pattern = "-?[0-9]+" # } common.data.integer.positive = w:integer-positive # xsd:string { # pattern = "0*[1-9][0-9]*" # } common.data.integer.non-negative = w:integer-non-negative # xsd:string { # pattern = "[0-9]+" # } # common.data.percent = # xsd:string { # pattern = "(100)|([1-9]?[0-9](\.[0-9]+)?)%" # } common.data.float = w:float # xsd:string { # pattern = "-?[0-9]+(\.[0-9]+)?([eE]-?[0-9]+)?" # } common.data.float.positive = w:float-positive # xsd:string { # pattern = "(0*[1-9][0-9]*(\.[0-9]+)?)|([0-9]+(\.0*[1-9][0-9]*)?)([eE]-?[0-9]+)?" # } common.data.float.non-negative = w:float-non-negative # xsd:string { # pattern = "[0-9]+(\.[0-9]+)?([eE]-?[0-9]+)?" # } ## Temporal common.data.datetime = w:datetime-tz common.data.date-or-time = w:date-or-time common.data.date = w:date common.data.time-datetime = w:time-datetime ## IRIs common.data.uri = # allow either a non-empty IRI ref or zero or more HTML # space characters (which are: space, tab, LF, FF, CR) ( w:iri-ref | xsd:string { pattern = "[ \x{0A}-\x{0D}]*" # NOTE The range above incorrectly allows U+000B # in addition to the HTML space characters; but # that's not a problem in practice because HTML # and XML parsers will both catch any U+000B # and report an error for it before that pattern # ever gets evaluated. } ) common.data.uri.non-empty = w:iri-ref common.data.uris = list { w:iri-ref* } common.data.uri.absolute = w:iri ## 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 ## X-UA-Compatible common.data.x-ua-compatible = string ## Media Queries common.data.mediaquery = w:media-query ## Language Codes common.data.langcode = w:string "" | w:language ## List of Key Labels common.data.keylabellist = w:keylabellist ## List of Source Sizes common.data.source.size.list = w:source-size-list ## Microdata Properties common.data.microdata-properties = list { w:microdata-property+ } ## Zero common.data.zero = w:zero ## ECMAScript FunctionBody common.data.functionbody = w:functionbody # ##################################################################### ## WF2 Module Hook # # ##################################################################### common-form.attrs.form = ( notAllowed ) # ##################################################################### ## Script-supporting elements # ##################################################################### common.elem.script-supporting = ( notAllowed ) # ##################################################################### ## ARIA Module Hooks # # ##################################################################### common.attrs.aria = ( notAllowed ) common.attrs.aria.role.alert = ( notAllowed ) common.attrs.aria.role.alertdialog = ( notAllowed ) common.attrs.aria.role.application = ( notAllowed ) common.attrs.aria.role.article = ( notAllowed ) common.attrs.aria.role.banner = ( notAllowed ) common.attrs.aria.role.button = ( notAllowed ) common.attrs.aria.role.checkbox = ( notAllowed ) common.attrs.aria.role.combobox = ( notAllowed ) common.attrs.aria.role.complementary = ( notAllowed ) common.attrs.aria.role.contentinfo = ( notAllowed ) common.attrs.aria.role.dialog = ( notAllowed ) common.attrs.aria.role.directory = ( notAllowed ) common.attrs.aria.role.document = ( notAllowed ) common.attrs.aria.role.group = ( notAllowed ) common.attrs.aria.role.heading = ( notAllowed ) common.attrs.aria.role.img = ( notAllowed ) common.attrs.aria.role.link = ( notAllowed ) common.attrs.aria.role.list = ( notAllowed ) common.attrs.aria.role.listitem = ( notAllowed ) common.attrs.aria.role.log = ( notAllowed ) common.attrs.aria.role.listbox = ( notAllowed ) common.attrs.aria.role.main = ( notAllowed ) common.attrs.aria.role.marquee = ( notAllowed ) common.attrs.aria.role.menu = ( notAllowed ) common.attrs.aria.role.menubar = ( notAllowed ) common.attrs.aria.role.menuitem = ( notAllowed ) common.attrs.aria.role.menuitemcheckbox = ( notAllowed ) common.attrs.aria.role.menuitemradio = ( notAllowed ) common.attrs.aria.role.note = ( notAllowed ) common.attrs.aria.role.option = ( notAllowed ) common.attrs.aria.role.presentation = ( notAllowed ) common.attrs.aria.role.progressbar = ( notAllowed ) common.attrs.aria.role.radio = ( notAllowed ) common.attrs.aria.role.region = ( notAllowed ) common.attrs.aria.role.search = ( notAllowed ) common.attrs.aria.role.separator = ( notAllowed ) common.attrs.aria.role.slider = ( notAllowed ) common.attrs.aria.role.spinbutton = ( notAllowed ) common.attrs.aria.role.status = ( notAllowed ) common.attrs.aria.role.tab = ( notAllowed ) common.attrs.aria.role.tablist = ( notAllowed ) common.attrs.aria.role.tabpanel = ( notAllowed ) common.attrs.aria.role.textbox = ( notAllowed ) common.attrs.aria.role.toolbar = ( notAllowed ) common.attrs.aria.role.tree = ( notAllowed ) common.attrs.aria.role.treeitem = ( notAllowed ) common.attrs.aria.implicit.article = ( notAllowed ) common.attrs.aria.implicit.banner = ( notAllowed ) common.attrs.aria.implicit.button = ( notAllowed ) common.attrs.aria.implicit.checkbox = ( notAllowed ) common.attrs.aria.implicit.column-or-row-header = ( notAllowed ) common.attrs.aria.implicit.combobox = ( notAllowed ) common.attrs.aria.implicit.complementary = ( notAllowed ) common.attrs.aria.implicit.contentinfo = ( notAllowed ) common.attrs.aria.implicit.dialog = ( notAllowed ) common.attrs.aria.implicit.document = ( notAllowed ) common.attrs.aria.implicit.group = ( notAllowed ) common.attrs.aria.implicit.heading = ( notAllowed ) common.attrs.aria.implicit.img = ( notAllowed ) common.attrs.aria.implicit.landmark = ( notAllowed ) common.attrs.aria.implicit.link = ( notAllowed ) common.attrs.aria.implicit.list = ( notAllowed ) common.attrs.aria.implicit.listbox = ( notAllowed ) common.attrs.aria.implicit.listitem = ( notAllowed ) common.attrs.aria.implicit.main = ( notAllowed ) common.attrs.aria.implicit.navigation = ( notAllowed ) common.attrs.aria.implicit.option = ( notAllowed ) common.attrs.aria.implicit.progressbar = ( notAllowed ) common.attrs.aria.implicit.radio = ( notAllowed ) common.attrs.aria.implicit.region = ( notAllowed ) common.attrs.aria.implicit.section = ( notAllowed ) common.attrs.aria.implicit.select = ( notAllowed ) common.attrs.aria.implicit.slider = ( notAllowed ) common.attrs.aria.implicit.spinbutton = ( notAllowed ) common.attrs.aria.implicit.status = ( notAllowed ) common.attrs.aria.implicit.structure = ( notAllowed ) common.attrs.aria.implicit.textbox = ( notAllowed ) common.attrs.aria.implicit.toolbar = ( notAllowed ) common.attrs.aria.prop.readonly = ( notAllowed ) common.attrs.aria.landmark.application = ( notAllowed ) common.attrs.aria.landmark.banner = ( notAllowed ) common.attrs.aria.landmark.complementary = ( notAllowed ) common.attrs.aria.landmark.contentinfo = ( notAllowed ) common.attrs.aria.landmark.form = ( notAllowed ) common.attrs.aria.landmark.main = ( notAllowed ) common.attrs.aria.landmark.navigation = ( notAllowed ) common.attrs.aria.landmark.search = ( notAllowed ) # per ARIA spec: article, document, and note are not actually landmarks common.attrs.aria.landmark.article = ( notAllowed ) common.attrs.aria.landmark.document = ( notAllowed ) common.attrs.aria.landmark.note = ( notAllowed )