Issue update_schema  wiki (member only) 

DTD and W3C XML Schema  
DTD and W3C XML Schema need updating to MathML3 

Resolution  None recorded 
A MathML document must be a wellformed XML document using elements in the MathML namespace as defined by this specification, however it is not required that the document refer to any specific Document Type Definition (DTD) or schema that specifies MathML. It is sometimes advantagous not to specify such a language definition as these files are large, often much larger than the MathML expression and unless they have been previously cached by the MathML application, the time taken to fetch the DTD or schema may have an appreciable effect on the processing of the MathML document.
Note also that if no DTD is specified with a DOCTYPE declaration, that entity references (for example to refer to MathML characters by name) may not be used. The document should be encoded in an encoding (for example UTF8) in which all needed characters may be encoded as character data, or characters may be referenced using numeric character references, for example ∫ rather than ∫
If a MathML fragment is parsed without a DTD, in other words as a wellformed XML fragment, it is the responsibility of the processing application to treat the white space characters occurring outside of token elements as not significant.
However, in many circumstances, especially while producing or editing MathML, it is useful to use a language definition, to constrain the editing process or to check the correctness of generated files. The following section, Section A.2 Using the RelaxNG Schema for MathML3, discusses the RelaxNG Schema for MathML3 [RelaxNG], which forms a normative part of the specification. Following that, Section A.4 Using the MathML XML Schema, and Section A.3 Using the MathML DTD discuss alternative languages definition using the document type definitions (DTD) and the W3C XML schema language, [XMLSchemas], both of which are derived from the normative RelaxNG schema automatically. One should note that the schema definitions of the language is currently stricter than the DTD version. That is, a schema validating processor will declare invalid documents that are declared valid by a (DTD) validating XML parser. This is partly due to the fact that the XML schema language may express additional constraints not expressable in the DTD, and partly due to the fact that for reasons of compatibility with earlier releases, the DTD is intentionally forgiving in some places and does not enforce constraints that are specified in the text of this specification.
MathML documents should be validated using the RelaxNG Schema for MathML, either in the XML encoding (http://www.w3.org/Math/RelaxNG/mathml3/mathml3.rng) or in compact notation (http://www.w3.org/Math/RelaxNG/mathml3/mathml3.rnc) which is also shown below.
In contrast to DTDs there is no indocument method to associate a RelaxNG schema with a document.
We provide five RelaxNG schemata for sublanguages of MathML3:
The grammar for full MathML
The grammar for Presentation MathML without content elements mixed in
The grammar for strict Content MathML3
The grammar for pragmatic Content MathML3 without presentation MathML in token elements
The grammar for the deprecated parts of MathML
Editorial note: MiKo  
I think that this is no longer correct 
we will present them in detail in the next sections below. As the compact notation for RelaxNG grammars is more readable, we will use this format here.
Note that the RelaxNG grammars here are considerably more strict than the MathML2 DTDs (even in strict mode).
The RelaxNG schema for full MathML builds on the schema describing the various arts of teh language which are given in the following sections. It can be found at http://www.w3.org/Math/RelaxNG/mathml3/mathml3.rnc.
# This is the Mathematical Markup Language (MathML) 3.0, an XML # application for describing mathematical notation and capturing # both its structure and content. # # Copyright 19982008 W3C (MIT, ERCIM, Keio) # # Use and distribution of this code are permitted under the terms # W3C Software Notice and License # http://www.w3.org/Consortium/Legal/2002/copyrightsoftware20021231 # # # Revision: mathml3.rnc,v 1.7 2008/11/09 00:24:40 dcarlis Exp $ # # Update to MathML3 and Relax NG: David Carlisle and Michael Kohlhase default namespace m = "http://www.w3.org/1998/Math/MathML" ## the core, strict Content MathML include "mathml3strict.rnc" ## Content Expressions now allow pMathML in ci and csymbol include "mathml3pragmatic.rnc" { } ## Presentation Expressions allow Content Expressions mixed in everywhere include "mathml3presentation.rnc" ## include the relevant content dictionaries include "mathml3cdspragmatic.rnc" ## deprecated constucts include "mathml3deprecated.rnc" { } ContInPres = ContExp
# This is the Mathematical Markup Language (MathML) 3.0, an XML # application for describing mathematical notation and capturing # both its structure and content. # # Copyright 19982008 W3C (MIT, ERCIM, Keio) # # Use and distribution of this code are permitted under the terms # W3C Software Notice and License # http://www.w3.org/Consortium/Legal/2002/copyrightsoftware20021231 # # # Revision: mathml3presentation.rnc,v 1.8 2008/11/09 11:15:50 mkohlhas2 Exp $ # # Update to MathML3 and Relax NG: David Carlisle and Michael Kohlhase default namespace m = "http://www.w3.org/1998/Math/MathML" math.content = ContInPres* MathML.Common.attrib = attribute class {xsd:NMTOKENS}?,attribute style {xsd:string}? Browserinterface.attrib = attribute baseline {xsd:string}?, attribute overflow {"scroll"  "elide"  "truncate"  "scale"  "linebreak"}?, attribute altimg {xsd:anyURI}?, attribute alttext {xsd:string}?, attribute type {xsd:string}?, attribute name {xsd:string}?, attribute height {xsd:string}?, attribute width {xsd:string}? math.attlist = Browserinterface.attrib,attribute display {"block"  "inline"}?, attribute dir {"ltr"  "rtl"}?, linebreak.attrib simplesize = "small"  "normal"  "big" centering.values = "left"  "center"  "right" namedspace = "veryverythinmathspace"  "verythinmathspace"  "thinmathspace"  "mediummathspace"  "thickmathspace"  "verythickmathspace"  "veryverythickmathspace" thickness = "thin"  "medium"  "thick" # number with units used to specified lengths lengthwithunit = xsd:string #{pattern="(?([09]+[09]*\.[09]+)(emexpxincmmmptpc%))0"} lengthwithoptionalunit = xsd:string #{pattern="?([09]+[09]*\.[09]+)(emexpxincmmmptpc%)?"} # This is just "infinity" that can be used as a length infinity = "infinity" # colors defined as RGB RGBcolor = xsd:string {pattern="#(([09][af]){3}([09][af]){6})"} # The mathematics style attributes. These attributes are valid on all # presentation token elements except "mspace" and "mglyph", and on no # other elements except "mstyle". Tokenstyle.attrib = attribute mathvariant {"normal"  "bold"  "italic"  "bolditalic"  "doublestruck"  "boldfraktur"  "script"  "boldscript"  "fraktur"  "sansserif"  "boldsansserif"  "sansserifitalic"  "sansserifbolditalic"  "monospace"  "initial"  "tailed"  "looped"  "stretched"}?, attribute mathsize {simplesize  lengthwithunit}?, attribute mathcolor {xsd:string}?, attribute mathbackground {xsd:string}? truefalse = "true"  "false" Operator.attrib = # this attribute value is normally inferred from the position of # the operator in its "<mrow"> attribute form {"prefix"  "infix"  "postfix"}?, # set by dictionary, else it is "thickmathspace" attribute lspace {lengthwithunit  namedspace}?, # set by dictionary, else it is "thickmathspace" attribute rspace {lengthwithunit  namedspace}?, # set by dictionnary, else it is "false" attribute fence {truefalse}?, # set by dictionnary, else it is "false" attribute separator {truefalse}?, # set by dictionnary, else it is "false" attribute stretchy {truefalse}?, # set by dictionnary, else it is "true" attribute symmetric {truefalse}?, # set by dictionnary, else it is "false" attribute movablelimits {truefalse}?, # set by dictionnary, else it is "false" attribute accent {truefalse}?, # set by dictionnary, else it is "false" attribute largeop {truefalse}?, attribute minsize {lengthwithunit  namedspace}?, attribute maxsize {lengthwithunit  namedspace  infinity  xsd:float}? mglyph = elementmglyph
{MathML.Common.attrib, attribute alt {xsd:string}?, (attribute src {xsd:anyURI} attribute fontfamily {xsd:string}), attribute width {xsd:string}?, attribute height {xsd:string}?, attribute baseline {xsd:string}?, attribute index {xsd:positiveInteger}?} linethickness.attrib = attribute linethickness {lengthwithoptionalunitthickness} mline = elementmline
{MathML.Common.attrib, linethickness.attrib?, attribute spacing {xsd:string}?, attribute length {lengthwithunit  namedspace}?} Glyphalignmark = malignmarkmglyph mi = elementmi
{MathML.Common.attrib,Tokenstyle.attrib,(Glyphalignmarktext)*} mo = elementmo
{MathML.Common.attrib,Operator.attrib,Tokenstyle.attrib, linebreak.attrib, (textGlyphalignmark)*} mn = elementmn
{MathML.Common.attrib,Tokenstyle.attrib,(textGlyphalignmark)*} mtext = elementmtext
{MathML.Common.attrib,Tokenstyle.attrib,(textGlyphalignmark)*} ms = elementms
{MathML.Common.attrib,Tokenstyle.attrib, attribute lquote {xsd:string}?, attribute rquote {xsd:string}?, (textGlyphalignmark)*} # And the group of any token Prestoken = mi  mo  mn  mtext  ms msub = elementmsub
{MathML.Common.attrib, attribute subscriptshift {lengthwithunit}?, ContInPres,ContInPres} msup = elementmsup
{MathML.Common.attrib, attribute supscriptshift {lengthwithunit}?, ContInPres,ContInPres} msubsup = elementmsubsup
{MathML.Common.attrib, attribute subscriptshift {lengthwithunit}?, attribute supscriptshift {lengthwithunit}?, ContInPres,ContInPres,ContInPres} munder = elementmunder
{MathML.Common.attrib, attribute accentunder {truefalse}?, ContInPres,ContInPres} mover = elementmover
{MathML.Common.attrib, attribute accent {truefalse}?, ContInPres,ContInPres} munderover = elementmunderover
{MathML.Common.attrib, attribute accentunder {truefalse}?, attribute accent {truefalse}?, ContInPres,ContInPres,ContInPres} PresExpornone = ContInPres  none mmultiscripts = elementmmultiscripts
{MathML.Common.attrib, ContInPres, (PresExpornone,PresExpornone)*, (mprescripts,(PresExpornone,PresExpornone)*)?} none = elementnone
{empty} mprescripts = elementmprescripts
{empty} Presscript = msubmsupmsubsupmundermovermunderovermmultiscripts linebreakvalues = "auto"  "newline"  "indentingnewline"  "nobreak"  "goodbreak"  "badbreak" mspace = elementmspace
{MathML.Common.attrib, attribute width {lengthwithunit  namedspace}?, attribute height {lengthwithunit}?, attribute depth {lengthwithunit}?, attribute spacing {text}?, linebreak.attrib} mrow = elementmrow
{MathML.Common.attrib,ContInPres*} mfrac = elementmfrac
{MathML.Common.attrib, attribute bevelled {truefalse}?, attribute denomalign {centering.values}?, attribute numalign {centering.values}?, linethickness.attrib?, ContInPres,ContInPres} msqrt = elementmsqrt
{MathML.Common.attrib,ContInPres*} mroot = elementmroot
{MathML.Common.attrib,ContInPres,ContInPres} mpaddedspace = xsd:string {pattern="(\+)?([09]+[09]*\.[09]+)(((%?)*(widthlspaceheightdepth))(emexpxincmmmptpc))"} mpaddedwidthspace = xsd:string {pattern="((\+)?([09]+[09]*\.[09]+)(((%?) *(widthlspaceheightdepth)?)(widthlspaceheightdepth)(emexpxincmmmptpc)))((veryverythinverythinthinmediumthickverythickveryverythick)mathspace)0"} mpadded = elementmpadded
{MathML.Common.attrib, attribute width {mpaddedwidthspace}?, attribute lspace {mpaddedspace}?, attribute height {mpaddedspace}?, attribute depth {mpaddedspace}?, ContInPres*} mphantom = elementmphantom
{MathML.Common.attrib,ContInPres*} mfenced = elementmfenced
{MathML.Common.attrib, attribute open {xsd:string}?, attribute close {xsd:string}?, attribute separators {xsd:string}?, ContInPres*} notationvalues = "actuarial""longdiv""radical" "box""roundedbox""circle" "left""right""top""bottom" "updiagonalstrike""downdiagonalstrike" "verticalstrike""horizontalstrike"  "madruwb" menclose = elementmenclose
{MathML.Common.attrib, attribute notation {list{notationvalues*}}?, ContInPres*} # And the group of everything Preslayout = mrowmfracmsqrtmrootmpaddedmphantommfencedmenclose Tablealignment.attrib = attribute rowalign {xsd:string {pattern="(topbottomcenterbaselineaxis)(topbottomcenterbaselineaxis)*"}}?, attribute columnalign {xsd:string {pattern="(leftcenterright)( (leftcenterright))*"}}?, attribute groupalign {xsd:string}? mtr.content = mtd mtr = elementmtr
{Tablealignment.attrib, MathML.Common.attrib,(mtr.content)+} mlabeledtr = elementmlabeledtr
{Tablealignment.attrib,MathML.Common.attrib,(mtr.content)*} mtd = elementmtd
{MathML.Common.attrib, Tablealignment.attrib, attribute columnspan {xsd:positiveInteger}?, attribute rowspan {xsd:positiveInteger}?, ContInPres*} mtable.content = mtrmlabeledtr mtable = elementmtable
{Tablealignment.attrib, attribute align {xsd:string}?, attribute alignmentscope {xsd:string {pattern="(truefalse)( true false)*"}}?, attribute columnwidth {xsd:string}?, attribute width {xsd:string}?, attribute rowspacing {xsd:string}?, attribute columnspacing {xsd:string}?, attribute rowlines {xsd:string}?, attribute columnlines {xsd:string}?, attribute frame {"none"  "solid"  "dashed"}?, attribute framespacing {xsd:string}?, attribute equalrows {truefalse}?, attribute equalcolumns {truefalse}?, attribute displaystyle {truefalse}?, attribute side {"left""right""leftoverlap""rightoverlap"}?, attribute minlabelspacing {lengthwithunit}?, MathML.Common.attrib, (mtable.content)*} maligngroup = elementmaligngroup
{MathML.Common.attrib, attribute groupalign {"left"  "center"  "right"  "decimalpoint"}?} malignmark = elementmalignmark
{MathML.Common.attrib,attribute edge {"left"  "right"}?} Prestable = mtablemaligngroupmalignmark mcolumn = elementmcolumn
{MathML.Common.attrib, attribute align {"left"  "right"}?,ContInPres*} mstyle = elementmstyle
{MathML.Common.attrib, linebreak.attrib, attribute scriptlevel {xsd:integer}?, attribute displaystyle {truefalse}?, attribute scriptsizemultiplier {xsd:decimal}?, attribute scriptminsize {lengthwithunit}?, attribute background {xsd:string}?, attribute veryverythinmathspace {lengthwithunit}?, attribute verythinmathspace {lengthwithunit}?, attribute thinmathspace {lengthwithunit}?, attribute mediummathspace {lengthwithunit}?, attribute thickmathspace {lengthwithunit}?, attribute verythickmathspace {lengthwithunit}?, attribute veryverythickmathspace {lengthwithunit}?, linethickness.attrib?, Operator.attrib,Tokenstyle.attrib, ContInPres*} merror = elementmerror
{MathML.Common.attrib,ContInPres*} maction = elementmaction
{MathML.Common.attrib, attribute actiontype {xsd:string}?, attribute selection {xsd:positiveInteger}?, ContInPres*} semanticspmml = elementsemantics
{semantics.attribs,PresExp, semanticsannotation*} PresExp = Prestoken  Preslayout  Presscript  Prestable  mspace  mline  mcolumn  maction  merror  mstyle  semanticspmml ContInPres = PresExp
Issue ednote_rnc_browserinterface_  wiki (member only) 

rnc:browserinterface 

Resolution  None recorded 
Issue ednote_rnc_unitspatterns_  wiki (member only) 

rnc:unitspatterns 

Resolution  None recorded 
Issue ednote_rnc_mathvariant_  wiki (member only) 

rnc:mathvariant 

Resolution  None recorded 
Issue ednote_mglyph_alt_  wiki (member only) 

mglyph_alt 

Resolution  None recorded 
Issue ednote_rnc_leftovermax_  wiki (member only) 

rnc:leftovermax 

Resolution  None recorded 
Issue permissive_units  wiki (member only) 

more permissive lengths/widths  
David wrote in an email: However we do claim css compatibility here which may suggest some answers to the
above css allows an optional leading Once we have firm answers to the above it should be easy to drop the regexp back in, and make the text match. I think we should not allow white space except at beginning and end
but allow a leading 

Resolution  None recorded 
The grammar for Strict Content MathML3 can be found at http://www.w3.org/Math/RelaxNG/mathml3/mathml3strict.rnc.
# This is the Mathematical Markup Language (MathML) 3.0, an XML # application for describing mathematical notation and capturing # both its structure and content. # # Copyright 19982008 W3C (MIT, ERCIM, Keio) # # Use and distribution of this code are permitted under the terms # W3C Software Notice and License # http://www.w3.org/Consortium/Legal/2002/copyrightsoftware20021231 # # # Revision: mathml3strict.rnc,v 1.8 2008/11/09 11:15:50 mkohlhas2 Exp $ # # Update to MathML3 and Relax NG: David Carlisle and Michael Kohlhase # # This is the RelaxNG schema module for the strict content part of MathML. default namespace m = "http://www.w3.org/1998/Math/MathML" include "mathml3common.rnc" math.content = ContExp opel.content = text # we want to extend this in pragmatic CMathML, so we introduce abbrevs here. cn.content = text (cn,cn) cn.type.vals = "integer""real""double" cn = elementcn
{attribute base {text}?, attribute type {cn.type.vals}?, Definition.attrib, MathML.Common.attrib, (cn.content)*} ci = elementci
{attribute type {xsd:string}?, attribute nargs {xsd:string}?, attribute occurrence {xsd:string}?, Definition.attrib, MathML.Common.attrib, opel.content, name.attrib?} cdname.attrib = attribute cd {xsd:NCName} csymbol = elementcsymbol
{MathML.Common.attrib, Definition.attrib,cdname.attrib?,cdbase.attrib?, opel.content} # the content of the apply element, leave it empty and extend it later apply = elementapply
{MathML.Common.attrib,cdbase.attrib?,apply.content} applyhead = applybindcicsymbolsemanticsapply apply.content = applyhead,ContExp* semanticsapply = elementsemantics
{semantics.attribs,applyhead, semanticsannotation*} qualifier = notAllowed # the content of the bind element, leave it empty and extend it later bind = elementbind
{MathML.Common.attrib,cdbase.attrib?,bind.content} bindhead = applycsymbolsemanticsbind bind.content = bindhead,bvar*,qualifier?,ContExp semanticsbind = elementsemantics
{semantics.attribs,bindhead, semanticsannotation*} bvar = elementbvar
{MathML.Common.attrib,cdbase.attrib?,bvarhead} bvarhead = cisemanticsbvar semanticsbvar = elementsemantics
{semantics.attribs,bvarhead, semanticsannotation*} share = elementshare
{MathML.Common.attrib,attribute href {xsd:anyURI}} # the content of the cerror element, leave it empty and extend it later cerror = elementcerror
{MathML.Common.attrib,cdbase.attrib?,cerror.content} cerrorhead = csymbolapplysemanticscerror cerror.content = cerrorhead,ContExp* semanticscerror = elementsemantics
{semantics.attribs,cerrorhead, semanticsannotation*} semanticscmml = elementsemantics
{semantics.attribs,ContExp, semanticsannotation*} ContExp = cn ci  csymbol  apply  bind  share  cerror  semanticscmml
Issue ednote_rnc_opelcontent_  wiki (member only) 

rnc:opelcontent 

Resolution  None recorded 
Issue ednote_rnc_cncontent_  wiki (member only) 

rnc:cncontent 

Resolution  None recorded 
The grammar for pragmatic MathML3 can be found at http://www.w3.org/Math/RelaxNG/mathml3/mathml3pragmatic.rnc.
# This is the Mathematical Markup Language (MathML) 3.0, an XML # application for describing mathematical notation and capturing # both its structure and content. # # Copyright 19982008 W3C (MIT, ERCIM, Keio) # # Use and distribution of this code are permitted under the terms # W3C Software Notice and License # http://www.w3.org/Consortium/Legal/2002/copyrightsoftware20021231 # # # Revision: mathml3pragmatic.rnc,v 1.10 2008/11/09 17:55:28 dcarlis Exp $ # # Update to MathML3 and Relax NG: David Carlisle and Michael Kohlhase # # This is the RelaxNG schema module for the pragmatic content part of # MathML (but without the presentation in token elements). default namespace m = "http://www.w3.org/1998/Math/MathML" ## the content of "cn" may have <sep> elements in it sep = elementsep
{empty} cn.content = (septextGlyphalignmark)* cn.type.vals = "enotation""rational""complexcartesian""complexpolar""constant" ## allow degree in bvar degree = elementdegree
{MathML.Common.attrib,ContExp} logbase = elementlogbase
{MathML.Common.attrib,ContExp} momentabout = elementmomentabout
{MathML.Common.attrib,ContExp} bvarhead = (degree?,ci)(ci,degree?) ## allow degree to modify <root/> apply.content = root_arith1_elt,degree,ContExp* apply.content = moment_s_data1_elt,(degree? & momentabout?),ContInPres* apply.content = log_transc1_elt,logbase,ContExp* ##allow apply to act as a binder apply.content = bind.content domainofapplication = elementdomainofapplication
{Definition.attrib,MathML.Common.attrib,cdbase.attrib?,ContExp} lowlimit = elementlowlimit
{Definition.attrib,MathML.Common.attrib,cdbase.attrib?,ContExp+} uplimit = elementuplimit
{Definition.attrib,MathML.Common.attrib,cdbase.attrib?,ContExp+} condition = elementcondition
{Definition.attrib,cdbase.attrib?,ContExp} ## allow the nonstrict qualifiers qualifier = domainofapplication(uplimit,lowlimit?)(lowlimit,uplimit?)degreecondition ## we collect the operator elements by role opel.constant = notAllowed opel.binder = notAllowed opel.application = notAllowed opel.semanticattribution = notAllowed opel.attribution = notAllowed opel.error = notAllowed opels = opel.constant  opel.binder  opel.application  opel.semanticattribution  opel.attribution  opel.error container = notAllowed ## the values of the MathML type attributes; MathMLType = "real"  "complex"  "function"  "algebraic"  "integer" ## we instantiate the strict content model by structure checking applybinderhead = semanticsapplybinderopel.binder apply.content = applybinderhead,bvar*,qualifier?,ContExp* semanticsapplybinder = elementsemantics
{semantics.attribs,applybinderhead, semanticsannotation*} applyhead = opel.application bindhead = opel.binder cerrorhead = opel.error ## allow all functions, constants, and containers to be content expressions on their own ContExp = opel.constantopel.applicationcontainer # allow no body bind.content = bindhead,bvar*,qualifier? # not sure what a sequence of things is supposed to map to in strict/OM # but is definitely allowed in pragmatic # see Content/SequencesAndSeries/product/recproduct3 math.content = ContExp* opel.content = PresExpGlyphalignmark # This is the Mathematical Markup Language (MathML) 3.0, an XML # application for describing mathematical notation and capturing # both its structure and content. # # Copyright 19982008 W3C (MIT, ERCIM, Keio) # # Use and distribution of this code are permitted under the terms # W3C Software Notice and License # http://www.w3.org/Consortium/Legal/2002/copyrightsoftware20021231 # # # Revision: mathml3pragmatic.rnc,v 1.10 2008/11/09 17:55:28 dcarlis Exp $ # # Update to MathML3 and Relax NG: David Carlisle and Michael Kohlhase # # This is the RelaxNG schema module for the pragmatic content part of # MathML (but without the presentation in token elements). default namespace m = "http://www.w3.org/1998/Math/MathML" ## the content of "cn" may have <sep> elements in it sep = elementsep
{empty} cn.content = (septextGlyphalignmark)* cn.type.vals = "enotation""rational""complexcartesian""complexpolar""constant" ## allow degree in bvar degree = elementdegree
{MathML.Common.attrib,ContExp} logbase = elementlogbase
{MathML.Common.attrib,ContExp} momentabout = elementmomentabout
{MathML.Common.attrib,ContExp} bvarhead = (degree?,ci)(ci,degree?) ## allow degree to modify <root/> apply.content = root_arith1_elt,degree,ContExp* apply.content = moment_s_data1_elt,(degree? & momentabout?),ContInPres* apply.content = log_transc1_elt,logbase,ContExp* ##allow apply to act as a binder apply.content = bind.content domainofapplication = elementdomainofapplication
{Definition.attrib,MathML.Common.attrib,cdbase.attrib?,ContExp} lowlimit = elementlowlimit
{Definition.attrib,MathML.Common.attrib,cdbase.attrib?,ContExp+} uplimit = elementuplimit
{Definition.attrib,MathML.Common.attrib,cdbase.attrib?,ContExp+} condition = elementcondition
{Definition.attrib,cdbase.attrib?,ContExp} ## allow the nonstrict qualifiers qualifier = domainofapplication(uplimit,lowlimit?)(lowlimit,uplimit?)degreecondition ## we collect the operator elements by role opel.constant = notAllowed opel.binder = notAllowed opel.application = notAllowed opel.semanticattribution = notAllowed opel.attribution = notAllowed opel.error = notAllowed opels = opel.constant  opel.binder  opel.application  opel.semanticattribution  opel.attribution  opel.error container = notAllowed ## the values of the MathML type attributes; MathMLType = "real"  "complex"  "function"  "algebraic"  "integer" ## we instantiate the strict content model by structure checking applybinderhead = semanticsapplybinderopel.binder apply.content = applybinderhead,bvar*,qualifier?,ContExp* semanticsapplybinder = elementsemantics
{semantics.attribs,applybinderhead, semanticsannotation*} applyhead = opel.application bindhead = opel.binder cerrorhead = opel.error ## allow all functions, constants, and containers to be content expressions on their own ContExp = opel.constantopel.applicationcontainer # allow no body bind.content = bindhead,bvar*,qualifier? # not sure what a sequence of things is supposed to map to in strict/OM # but is definitely allowed in pragmatic # see Content/SequencesAndSeries/product/recproduct3 math.content = ContExp* opel.content = PresExpGlyphalignmark
This grammar focuses on the pragmatic extensions in , , , and .
Editorial note: MiKo  
check this again 
The pragmatic extensions in , , and rely on information that is specified in the MathML content dictionaries. This is handled in the schema http://www.w3.org/Math/RelaxNG/mathml3/mathml3cdspragmatic.rnc.
Editorial note: MiKo  
The generated grammar allows type attributes
for the operator elements, this is incorrect

Finally, the pragmatic extensions given in are not covered in this schema, but will be left for full MathML in the next section.
The grammar for the deprecated features in MathML3 can be found at http://www.w3.org/Math/RelaxNG/mathml3/mathml3deprecated.rnc.
# This is the Mathematical Markup Language (MathML) 3.0, an XML # application for describing mathematical notation and capturing # both its structure and content. # # Copyright 19982008 W3C (MIT, ERCIM, Keio) # # Use and distribution of this code are permitted under the terms # W3C Software Notice and License # http://www.w3.org/Consortium/Legal/2002/copyrightsoftware20021231 # # # Revision: mathml3deprecated.rnc,v 1.9 2008/12/17 09:10:34 mkohlhas2 Exp $ # # Update to MathML3 and Relax NG: David Carlisle and Michael Kohlhase default namespace m = "http://www.w3.org/1998/Math/MathML" Tokenstyle.attrib &= attribute fontsize {xsd:string}? , attribute fontstyle {xsd:string}? , attribute fontweight {xsd:string}? , attribute color {xsd:string}? , attribute fontfamily {xsd:string}? #Deprecated Content Elements depcontent = elementreln
{ContExp*} elementfn
{ContExp} ContExp = depcontent applyhead = depcontent declare = elementdeclare
{attribute type {xsd:string}?, attribute scope {xsd:string}?, attribute nargs {xsd:nonNegativeInteger}?, attribute occurrence {"prefix""infix""functionmodel"}?, Definition.attrib,cdbase.attrib?, ContExp+} ContExp = declare mtr.content = ContInPres
Normally, a MathML expression does not constitute an entire XML document. MathML is designed to be used as the mathematics fragment of larger markup languages. In particular it is designed to be used as a module in documents marked up with the XHTML family of markup languages. As RelaxNG directly supports modular development, this is usually very easy: an XHTML+MathML schema can be specified as simply as
# A RelaxNG Schema for XHTML+MathML include "xhtml.rnc" math = external "mathml3.rnc" Inline.class = math Block.class = math
assuming that we have access to a modular RelaxNG schema for xhtml that uses
Inline.class
and Block.class
to collect the the content models
for inline and blocklevel elements.
Editorial note: Miko  
check this and reference an external schema 
Specilizing the MathML3 schema so that we can check the content of
annotationxml
elements is similarly simple:
# A RelaxNG Schema for MathML with OpenMath3 annotations omobj = external "openmath3.rnc" include "mathml3.rnc" {anotationxml.model = omobj}
For details about RelaxNG grammars and modularization see [RelaxNG] or [RelaxNGBook].
Editorial note: Miko  
check this and reference an external schema; I think we can even tie the OpenMath model to the value OpenMath in the encoding attribute.

Editorial note: David  
DTD to be generated from Relax NG 
Editorial note: Bruce  
I've moved DTD related material from Chapter 2 to here. It most likely needs to be pruned somewhat 
The use of namespace prefixes creates an issue for DTD validation of documents embedding MathML. DTD validation requires knowing the literal (possibly prefixed) element names used in the document. However, the Namespaces in XML Recommendation [Namespaces] allows the prefix to be changed at arbitrary points in the document, since namespace prefixes may be declared on any element.
The 'historical' method of bridging this gap was to write a DTD with a fixed prefix, or in the case of XHTML and MathML, with no prefix, and mandate that the specified form must be used throughout the document. However, this is somewhat restricting for a modular DTD that is intended for use in conjunction with another DTD, which is exactly the situation with MathML in XHTML. In essence, the MathML DTD would have to allocate a prefix for itself and hope no other module uses the same prefix to avoid name clashes, thus losing one of the main benefits of XML namespaces.
One strategy for addressing this problem is to make every element name in the DTD be accessed by an entity reference. This means that by declaring a couple of entities to specify the prefix before the DTD is loaded, the prefix can be chosen by a document author, and compound DTDs that include several modules can, without changing the module DTDs, specify unique prefixes for each module to avoid clashes. The MathML DTD has been designed in this fashion. See Section A.3 Using the MathML DTD and [Modularization] for details.
An extra issue arises in the case where explicit prefixes are used
on the toplevel math
element, but a default
namespace is used for other MathML elements. In this case, one wants
the MathML module to be included into XHTML with the prefix set to
empty. However, the 'driver' DTD file that sets up the inclusion of
the MathML module would then need to define a new element called
m:math. This would allow the toplevel math
element to use an explicit prefix, for attaching rendering behaviors
in current browsers, while the contents would not need an explicit
prefix, for ease of interoperability between authoring tools, etc.
In an XML DTD, allowed attribute values can be declared as general strings, or they can be constrained in various ways, either by enumerating the possible values, or by declaring them to be certain special data types. The choice of an XML attribute type affects the extent to which validity checks can be performed using a DTD.
The MathML DTD specifies formal XML attribute types for all MathML attributes, including enumerations of legitimate values in some cases. In general, however, the MathML DTD is relatively permissive, frequently declaring attribute values as strings; this is done to provide for interoperability with SGML parsers while allowing multiple attributes on one MathML element to accept the same values (such as "true" and "false"), and also to allow extension to the lists of predefined values.
At the same time, even though an attribute value may be declared as a string in the DTD, only certain values are legitimate in MathML, as described above and in the rest of this specification. For example, many attributes expect numerical values. In the sections which follow, the allowed attribute values are described for each element. To determine when these constraints are actually enforced in the MathML DTD, consult Appendix A Parsing MathML. However, lack of enforcement of a requirement in the DTD does not imply that the requirement is not part of the MathML language itself, or that it will not be enforced by a particular MathML renderer. (See Section 2.3.2 Handling of Errors for a description of how MathML renderers should respond to MathML errors.)
Furthermore, the MathML DTD is provided for convenience; although it is intended to be fully compatible with the text of the specification, the text should be taken as definitive if there is a contradiction. (Any contradictions which may exist between various chapters of the text should be resolved by favoring Chapter 7 Characters, Entities and Fonts first, then Chapter 3 Presentation Markup, Chapter 4 Content Markup, then Section 2.1 MathML Syntax and Grammar, and then other parts of the text.) For the MathML schema the situation will be the same: the published Recommendation text takes precedence. Though this is what is intended to happen, there is a practical difficulty. If the system processing the MathML uses a validating parser, whether it be based on a DTD or on a schema, the process will probably simply stop when it hits something held to be incorrect syntax, whether or not further MathML processing in full harmony with the specification would have processed the piece correctly.