# RELAX NG Compact Syntax + Schematron Grammar for XBL 2.0 # # OPEN ISSUES # * Several elements' content model depends on the script-type or style-type # attribute value. # * A bunch of things that are "text" actually take some kind of microsyntax # such as an IRI, space-separated list of values, etc. namespace xbl = "http://www.w3.org/ns/xbl" namespace s = "http://purl.oclc.org/dsdl/schematron" # Common attributes xblCommonAttributes = attribute id { xsd:ID }?, xblPseudoAttribute?, xblAttrAttribute? # Common constructs anything = element * - xbl:* { (attribute * - xbl:* { text } | xblPseudoAttribute | xblAttrAttribute | anything)* } | text anythingSpecial = element * - xbl:* { (attribute * - xbl:* { text } | xblPseudoAttribute | xblAttrAttribute | anythingSpecial)* } | xblContent | xblInherited | text # Start start = xblXbl xblXbl = element xbl:xbl { xblCommonAttributes, attribute script-type { text }?, attribute style-type { text }?, (xblBinding | xblScript | anything)* } xblBinding = element xbl:binding { xblCommonAttributes, attribute extends { text }?, attribute element { text}?, (xblImplementation? & xblTemplate? & xblHandlers? & xblResources? & anything*) } xblImplementation = element xbl:implementation { xblCommonAttributes, text } | element xbl:implementation { xblCommonAttributes, attribute src { text }, empty } xblTemplate = element xbl:template { xblCommonAttributes, attribute apply-author-sheets { string "true" | string "false" }?, attribute allow-selectors-through { string "true" | string "false" }?, (anythingSpecial | xblDiv)* } xblContent = [ s:rule [ context = "xbl:content" s:assert [ test = "ancestor::xbl:template and not ancestor::xbl:content" "An xbl:content must be a descendent of an xbl:template " ~ "element and must not be a descendent of an xbl:content " ~ "element." ] ] ] element xbl:content { xblCommonAttributes, attribute includes { text }?, attribute apply-binding-sheets { string "true" | string "false" }?, attribute locked { string "true" | string "false" }?, (anythingSpecial | xblDiv)* } xblInherited = [ s:rule [ context = "xbl:inherited" s:assert [ test = "ancestor::xbl:template" "An xbl:inherited must be a descendent of an xbl:template " ~ "element." ] ] ] element xbl:inherited { xblCommonAttributes, (anythingSpecial | xblDiv)* } xblAttrAttribute = [ s:rule [ context = "*@xbl:attr" s:assert [ test = "ancestor::xbl:template" "An xbl:attr must be a descendent of an xbl:template " ~ "element." ] ] ] attribute xbl:attr { text } xblPseudoAttribute = [ s:rule [ context = "*@xbl:pseudo" s:assert [ test = "ancestor::xbl:template" "An xbl:pseudo must be a descendent of an xbl:template " ~ "element." ] ] ] attribute xbl:pseudo { string "value" | string "choices" | string "label" | string "repeat-item" | string "icon" } xblDiv = element xbl:div { xblCommonAttributes, attribute class { text }?, attribute state { text }?, attribute title { text }?, (anythingSpecial | xblDiv)* } xblHandlers = element xbl:handlers { xblCommonAttributes, xblHandler* } xblHandler = element xbl:handler { xblCommonAttributes, attribute event { string }, attribute phase { string "capture" | string "target" | string "bubble" | string "default-action" }?, attribute trusted { string "true" | string "false" }?, attribute propagate { string "stop" | string "continue" }?, attribute default-action { string "cancel" | string "perform" }?, attribute button { text }?, attribute click-count { text }?, attribute modifiers { text }?, attribute key { text }?, attribute key-location { string "standard" | string "left" | string "right" | string "numpad" }?, attribute text { text }?, attribute prev-value { text }?, attribute new-value { text }?, attribute attr-name { text }?, attribute attr-change { text }?, text } xblResources = element xbl:resources { xblCommonAttributes, (xblStyle | xblPrefetch)* } xblStyle = element xbl:style { xblCommonAttributes, attribute media { text }?, text } | element xbl:style { xblCommonAttributes, attribute media { text }?, attribute src { text }, empty } xblPrefetch = element xbl:prefetch { xblCommonAttributes, attribute src { text }, empty } xblScript = element xbl:script { xblCommonAttributes, text } | element xbl:script { xblCommonAttributes, attribute src { text }, empty }