default namespace = "http://www.w3.org/2000/svg"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"

## 
##     SVG 1.1 Basic Structure Module
##     file: svg-basic-structure.rng
## 
##     This is SVG, a language for describing two-dimensional graphics in XML.
##     Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved.
##
##     Modifications Copyright 2007 Mozilla Foundation
## 
##     $Id$
##   

## 
##     Basic Structure
## 
##         svg, g, defs, desc, title, metadata, use
## 
##     This module declares the major structural elements and their attributes.
##   
[ xml:lang = "en" ]
grammar {
    
    # removed start = -- hsivonen

    ## 
    ##       Include core set of modules
    ##     
    div {
        
        ## 
        ##         Datatypes Module
        ##       
        include "svg-datatypes.rnc"
        
        ## 
        ##         Core Attribute Module
        ##       
        include "svg-core-attrib.rnc"
    }
    a:documentation [
        "\x{a}" ~
        "    Content Models (Default)\x{a}" ~
        "  "
    ]
    SVG.Profile.class = notAllowed
    SVG.Gradient.class = notAllowed
    SVG.Pattern.class = notAllowed
    SVG.Clip.class = notAllowed
    SVG.Mask.class = notAllowed
    SVG.Filter.class = notAllowed
    SVG.Cursor.class = notAllowed
    SVG.Marker.class = notAllowed
    SVG.View.class = notAllowed
    SVG.Script.class = notAllowed
    SVG.Font.class = notAllowed
    SVG.Extensibility.class = notAllowed
    SVG.Conditional.class = notAllowed
    SVG.Image.class = notAllowed
    SVG.Style.class = notAllowed
    SVG.Shape.class = notAllowed
    SVG.Text.class = notAllowed
    SVG.Hyperlink.class = notAllowed
    SVG.Animation.class = notAllowed
    a:documentation [
        "\x{a}" ~
        "    Attribute Collections (Default)\x{a}" ~
        "  "
    ]
    SVG.Container.attrib = empty
    SVG.Viewport.attrib = empty
    SVG.Text.attrib = empty
    SVG.TextContent.attrib = empty
    SVG.Opacity.attrib = empty
    SVG.Marker.attrib = empty
    SVG.Profile.attrib = empty
    SVG.Gradient.attrib = empty
    SVG.Clip.attrib = empty
    SVG.Mask.attrib = empty
    SVG.Filter.attrib = empty
    SVG.FilterColor.attrib = empty
    SVG.Cursor.attrib = empty
    SVG.External.attrib = empty
    SVG.Conditional.attrib = empty
    SVG.Color.attrib = empty
    SVG.Paint.attrib = empty
    SVG.Graphics.attrib = empty
    SVG.DocumentEvents.attrib = empty
    SVG.GraphicalEvents.attrib = empty
    SVG.onload.attrib = empty
    SVG.AnimationEvents.attrib = empty
    SVG.XLink.attrib = empty
    SVG.XLinkRequired.attrib = empty
    SVG.XLinkEmbed.attrib = empty
    SVG.XLinkReplace.attrib = empty
    SVG.Style.attrib = empty
    SVG.Font.attrib = empty
    a:documentation [
        "\x{a}" ~
        "    SVG.Description.class\x{a}" ~
        "  "
    ]
    SVG.Description.extra.class = notAllowed
    SVG.Description.class =
        desc | title | metadata | SVG.Description.extra.class
    a:documentation [ "\x{a}" ~ "    SVG.Use.class\x{a}" ~ "  " ]
    SVG.Use.extra.class = notAllowed
    SVG.Use.class = use | SVG.Use.extra.class
    a:documentation [ "\x{a}" ~ "    SVG.Structure.class\x{a}" ~ "  " ]
    SVG.Structure.extra.class = notAllowed
    SVG.Structure.class =
        svg | g | defs | SVG.Use.class | SVG.Structure.extra.class
    a:documentation [
        "\x{a}" ~
        "    SVG.Presentation.attrib\x{a}" ~
        "  "
    ]
    SVG.Presentation.extra.attrib = empty
    SVG.Presentation.attrib =
        SVG.Container.attrib,
        SVG.Viewport.attrib,
        SVG.Text.attrib,
        SVG.TextContent.attrib,
        SVG.Font.attrib,
        SVG.Paint.attrib,
        SVG.Color.attrib,
        SVG.Opacity.attrib,
        SVG.Graphics.attrib,
        SVG.Marker.attrib,
        SVG.Profile.attrib,
        SVG.Gradient.attrib,
        SVG.Clip.attrib,
        SVG.Mask.attrib,
        SVG.Filter.attrib,
        SVG.FilterColor.attrib,
        SVG.Cursor.attrib,
        attribute flood-color { SVGColor.datatype }?,
        attribute flood-opacity { OpacityValue.datatype }?,
        attribute lighting-color { SVGColor.datatype }?,
        SVG.Presentation.extra.attrib
    a:documentation [
        "\x{a}" ~
        "    svg: SVG Document Element\x{a}" ~
        "  "
    ]
    SVG.svg.content =
        (SVG.Description.class
         | SVG.Animation.class
         | SVG.Structure.class
         | SVG.Conditional.class
         | SVG.Image.class
         | SVG.Style.class
         | SVG.Shape.class
         | SVG.Text.class
         | SVG.Marker.class
         | SVG.Profile.class
         | SVG.Gradient.class
         | SVG.Pattern.class
         | SVG.Clip.class
         | SVG.Mask.class
         | SVG.Filter.class
         | SVG.Cursor.class
         | SVG.Hyperlink.class
         | SVG.View.class
         | SVG.Script.class
         | SVG.Font.class)*
    svg = element svg { attlist.svg, SVG.svg.content }
    attlist.svg &=
        SVG.Core.attrib,
        SVG.Conditional.attrib,
        SVG.Style.attrib,
        SVG.Presentation.attrib,
        SVG.DocumentEvents.attrib,
        SVG.GraphicalEvents.attrib,
        SVG.External.attrib,
        common.attrs.aria?,
        attribute x { Coordinate.datatype }?,
        attribute y { Coordinate.datatype }?,
        attribute width { Length.datatype }?,
        attribute height { Length.datatype }?,
        attribute viewBox { ViewBoxSpec.datatype }?,
        [ a:defaultValue = "xMidYMid meet" ]
        attribute preserveAspectRatio {
            PreserveAspectRatioSpec.datatype
        }?,
        [ a:defaultValue = "magnify" ]
        attribute zoomAndPan { string "disable" | string "magnify" }?,
        [ a:defaultValue = "1.1" ]
        attribute version { string "1.0" | string "1.1" | string "1.2" }?, # Allow 1.0 and 1.2 -- hsivonen
        attribute baseProfile { Text.datatype }?,
        [ a:defaultValue = "text/ecmascript" ]
        attribute contentScriptType { ContentType.datatype }?,
        [ a:defaultValue = "text/css" ]
        attribute contentStyleType { ContentType.datatype }?
    a:documentation [ "\x{a}" ~ "    g: Group Element\x{a}" ~ "  " ]
    SVG.g.content =
        (SVG.Description.class
         | SVG.Animation.class
         | SVG.Structure.class
         | SVG.Conditional.class
         | SVG.Image.class
         | SVG.Style.class
         | SVG.Shape.class
         | SVG.Text.class
         | SVG.Marker.class
         | SVG.Profile.class
         | SVG.Gradient.class
         | SVG.Pattern.class
         | SVG.Clip.class
         | SVG.Mask.class
         | SVG.Filter.class
         | SVG.Cursor.class
         | SVG.Hyperlink.class
         | SVG.View.class
         | SVG.Script.class
         | SVG.Font.class)*
    g = element g { attlist.g, SVG.g.content }
    attlist.g &=
        SVG.Core.attrib,
        SVG.Conditional.attrib,
        SVG.Style.attrib,
        SVG.Presentation.attrib,
        SVG.GraphicalEvents.attrib,
        SVG.External.attrib,
        (common.attrs.aria.implicit.group | common.attrs.aria)?,
        attribute transform { TransformList.datatype }?
    a:documentation [
        "\x{a}" ~
        "    defs: Definisions Element\x{a}" ~
        "  "
    ]
    SVG.defs.content =
        (SVG.Description.class
         | SVG.Animation.class
         | SVG.Structure.class
         | SVG.Conditional.class
         | SVG.Image.class
         | SVG.Style.class
         | SVG.Shape.class
         | SVG.Text.class
         | SVG.Marker.class
         | SVG.Profile.class
         | SVG.Gradient.class
         | SVG.Pattern.class
         | SVG.Clip.class
         | SVG.Mask.class
         | SVG.Filter.class
         | SVG.Cursor.class
         | SVG.Hyperlink.class
         | SVG.View.class
         | SVG.Script.class
         | SVG.Font.class)*
    defs = element defs { attlist.defs, SVG.defs.content }
    attlist.defs &=
        SVG.Core.attrib,
        SVG.Conditional.attrib,
        SVG.Style.attrib,
        SVG.Presentation.attrib,
        SVG.GraphicalEvents.attrib,
        SVG.External.attrib,
        attribute transform { TransformList.datatype }?
    a:documentation [
        "\x{a}" ~
        "    desc: Description Element\x{a}" ~
        "  "
    ]
    any_element = element * { (attribute * { text } | any_element * | text)* }
    SVG.desc.content = any_element* & text
    desc = element desc { attlist.desc, SVG.desc.content }
    attlist.desc &= SVG.Core.attrib, SVG.Style.attrib
    a:documentation [ "\x{a}" ~ "    title: Title Element\x{a}" ~ "  " ]
    SVG.title.content = text
    title = element title { attlist.title, SVG.title.content }
    attlist.title &= SVG.Core.attrib, SVG.Style.attrib
    a:documentation [
        "\x{a}" ~
        "    metadata: Metadata Element\x{a}" ~
        "  "
    ]
    SVG.metadata.content = text
    metadata =
        element metadata { attlist.metadata, SVG.metadata.content }
    attlist.metadata &= SVG.Core.attrib
    a:documentation [ "\x{a}" ~ "    use: Use Element\x{a}" ~ "  " ]
    SVG.use.content = SVG.Description.class*, SVG.Animation.class*
    use = element use { attlist.use, SVG.use.content }
    attlist.use &=
        SVG.Core.attrib,
        SVG.Conditional.attrib,
        SVG.Style.attrib,
        SVG.Presentation.attrib,
        SVG.GraphicalEvents.attrib,
        SVG.XLinkEmbed.attrib,
        SVG.External.attrib,
        common.attrs.aria?,
        attribute x { Coordinate.datatype }?,
        attribute y { Coordinate.datatype }?,
        attribute width { Length.datatype }?,
        attribute height { Length.datatype }?,
        attribute transform { TransformList.datatype }?
}
