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

# Datatypes Module

# This file is based upon the work of James Clark "Modularization of XHTML in RELAX NG"
# (see http://www.thaiopensource.com/relaxng/xhtml/ and
# the accompanying jing-copying.html file)
# All changes are marked with relevant comments.
# The following license refers just to those changes.

# Copyright (c) 2005 Petr Nalevka
# Copyright (c) 2007-2008 Mozilla Foundation
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
#    derived from this software without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Folded datatype names to hyphenated lower case in order to avoid
# conflicts with the W3C SVG 1.1 schema -- hsivonen

# Length defined for cellpadding/cellspacing

# nn for pixels or nn% for percentage length
length.datatype =
    # modified - pattern: nn for pixels or nn% for percentage length
    # Use HTML5 datatypes. -- hsivonen
    w:integer-non-negative | xsd:string { pattern = "[0-9]+%" }
# space-separated list of link types
link-types.datatype = nmtokens.datatype
# single or comma-separated list of media descriptors
media-desc.datatype =
    # Use HTML5 datatype -- hsivonen
    w:media-query
# pixel, percentage, or relative
multilength.datatype =
    # modified - pattern: pixel, percentage, or relative
    (length.datatype | xsd:string { pattern="[0-9]+\*" })
# added - bugfix - comma-separated list of MultiLength
multi-lengths.datatype =
    xsd:string {
        # <param name="pattern">[-+]?(\d+|\d+(\.\d+)?%)|[1-9]?(\d+)?\*</param>
        pattern =
            "([\-+]?(\d+|\d+(\.\d+)?%)|[1-9]?(\d+)?\*)(( )*,( )*[\-+]?(\d+|\d+(\.\d+)?%)|[1-9]?(\d+)?\*)*"
    }
# one or more digits (NUMBER)
number.datatype =
    # Use HTML5 datatype -- hsivonen
    w:integer-non-negative
# added - integer between 0 and 32767
tabindexnumber.datatype =
    w:integer # Use HTML5 datatype -- hsivonen
# integer representing length in pixels
pixels.datatype =
    # Use HTML5 datatype -- hsivonen
    w:integer-non-negative
# script expression
script.datatype = text
# textual content
text.datatype = text
# Imported Datatypes ................................

# a single character from [ISO10646]
character.datatype =
    # modified - restriction to lenght 1
    xsd:string { length = "1" }
# a character encoding, as per [RFC2045]
charset.datatype = text
# a space separated list of character encodings, as per [RFC2045]
charsets.datatype = list { w:charset+ } # Use HTML5 datatype -- hsivonen
# media type, as per [RFC2045]
content-type.datatype = w:mime-type # Use HTML5 datatype -- hsivonen
# comma-separated list of media types, as per [RFC2045]
content-types.datatype = text
# date and time information. ISO date format
datetime.datatype =
    # Use HTML5 datatype -- hsivonen
    w:datetime-tz
# formal public identifier, as per [ISO8879]
fpi.datatype = text
# a language code, as per [RFC1766]
language-code.datatype = w:string "" | w:language # Use HTML5 datatype -- hsivonen
# a Uniform Resource Identifier, see [URI]
uri.datatype = w:string "" | w:iri-ref # Use HTML5 datatype -- hsivonen
# a space-separated list of Uniform Resource Identifiers, see [URI]
uris.datatype = list { w:iri-ref+ } # Use HTML5 datatype -- hsivonen
nmtoken.datatype = xsd:NMTOKEN
nmtokens.datatype = xsd:NMTOKENS
id.datatype = w:xml-name # Use HTML5 datatype -- hsivonen
idref.datatype = w:xml-name # Use HTML5 datatype -- hsivonen
idrefs.datatype = list { w:xml-name+ } # Use HTML5 datatype -- hsivonen
# added - bugfix - just the reserved names may start without an alphabethic character
target.datatype =
    w:browsing-context-or-keyword # Use HTML5 datatype -- hsivonen
