datatypes w = "http://whattf.org/datatype-draft"

# Definition of Common Datatypes for MathML 2.0

# 
# RELAX NG Schema on MathML 2.0
# 
# See COPYING for the status of this software.
# Yutaka Furubayashi (Poka-Poka Dream Factory) <info@yupotan.sppd.ne.jp>
# Modified by Henri Sivonen <hsivonen@iki.fi>
#

mml.id.datatype = w:xml-name
mml.idref.datatype = w:xml-name
mml.number.datatype = xsd:integer
mml.positiveinteger.datatype = xsd:positiveInteger
mml.uri.datatype = w:iri-ref
mml.nonnegativefloat.datatype = xsd:float { minInclusive = "0" }
mml.length.datatype =
    xsd:string {
        pattern = '\s*((-?[0-9]*(\.[0-9]*)?(e[mx]|in|cm|mm|p[xtc]|%)?)|(negative)?((very){0,2}thi(n|ck)|medium)mathspace)\s*'
    }
mml.color.datatype =
    xsd:string { pattern = "#[0-9A-Fa-f]{6}" }
    | xsd:string { pattern = "#[0-9A-Fa-f]{3}" }
    | string "transparent"
# Annotation datatypes
mml.Annotation.datatype =
    text
    # It depends on the encoding format
    
mml.Annotation-xml.datatype =
    mixed {
        element * {
            attribute * { text }*,
            mml.Annotation-xml.datatype
        }*
    }
# Space datatype
mml.namedspace.datatype = mml.length.datatype
    # <ref name="mml.length.datatype"/> forbidden pattern list//ref
# datatypes for making matrix
mml.align.datatype =
    list {
        # (top | bottom | center | baseline | axis) [ rownumber ]
        (string "top" | string "bottom" | string "center" | string "baseline" | string "axis"),
        # <ref name="mml.positiveinteger.datatype"/> forbidden pattern list//ref
        xsd:positiveInteger?
    }
mml.rowalign.datatype =
    list {
        # (top | bottom | center | baseline | axis) +
        (string "top" | string "bottom" | string "center" | string "baseline" | string "axis")+
    }
mml.columnalign.datatype =
    list {
        # (left | center | right) +
        (string "left" | string "center" | string "right")+
    }
mml.columnwidth.datatype =
    list {
        # ( auto | number h-unit | namedspace | fit ) +
        (string "auto"
         | mml.length.datatype
         | string "fit")+
    }
mml.groupalign.datatype =
    text
    # group-alignment-list-list
    
mml.alignmentscope.datatype =
    list {
        # (true | false) +
        (string "true" | string "false")+
    }
mml.rowspacing.datatype =
    list {
        # ( number v-unit ) +
        # <ref name="mml.length.datatype"/> forbidden pattern list//ref
        mml.length.datatype+
    }
mml.columnspacing.datatype =
    list {
        mml.length.datatype+
    }
mml.columnspan.datatype =
    mml.positiveinteger.datatype
mml.rowspan.datatype =
    mml.positiveinteger.datatype
mml.lines.datatype =
    list {
        # (none | solid | dashed) +
        (string "none" | string "solid" | string "dashed")+
    }
mml.framespacing.datatype =
    list {
        # (number h-unit | namedspace) (number v-unit | namedspace)
        mml.length.datatype
    }
