<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: testSuite.rng,v 1.12 2003/01/29 12:24:07 jjc Exp $ -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:sp="http://web-cpan.berlios.de/modules/XML-Grammar-Screenplay/screenplay-xml-0.2/"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
    >
    <start>
        <element name="sp:document">
            <element name="sp:head">
                <empty/>
            </element>
            <element name="sp:body">
                <attribute name="id">
                    <data type="ID"/>
                </attribute>
                <optional>
                    <attribute name="xml:lang">
                        <data type="NCName" />
                    </attribute>
                </optional>
                <oneOrMore>
                    <ref name="scene" />
                </oneOrMore>
            </element>
        </element>
    </start>
    <define name="several_paras">
        <oneOrMore>
            <ref name="para"/>
        </oneOrMore>
    </define>
    <define name="description_paras">
        <oneOrMore>
            <choice>
                <ref name="para"/>
                <element name="sp:para">
                    <element name="sp:code_blk">
                        <attribute name="syntax">
                            <value>text</value>
                        </attribute>
                        <attribute name="tag_role">
                            <choice>
                                <value>asciiart</value>
                                <value>code_block</value>
                            </choice>
                        </attribute>
                        <attribute name="title">
                            <text/>
                        </attribute>
                        <attribute name="alt">
                            <text/>
                        </attribute>
                        <text />
                    </element>
                </element>
            </choice>
        </oneOrMore>
    </define>
    <define name="single_inline_elem">
        <choice>
            <text/>
            <ref name="ulink"/>
            <ref name="bold"/>
            <ref name="italics"/>
            <ref name="image"/>
        </choice>
    </define>
    <define name="scene">
        <element name="sp:scene">
            <attribute name="id">
                <data type="ID"/>
            </attribute>
            <optional>
                <attribute name="xml:lang">
                    <data type="NCName" />
                </attribute>
            </optional>
            <optional>
                <attribute name="title">
                    <text/>
                </attribute>
            </optional>
            <zeroOrMore>
                <choice>
                    <element name="sp:description">
                        <ref name="description_paras"/>
                    </element>
                    <element name="sp:saying">
                        <attribute name="character">
                            <text/>
                        </attribute>
                        <ref name="several_paras"/>
                    </element>
                </choice>
            </zeroOrMore>
            <zeroOrMore>
                <ref name="scene" />
            </zeroOrMore>
        </element>
    </define>
    <define name="para">
        <element name="sp:para">
            <zeroOrMore>
                <choice>
                    <text/>
                    <element name="sp:inlinedesc">
                        <zeroOrMore>
                            <ref name="single_inline_elem"/>
                        </zeroOrMore>
                    </element>
                    <ref name="single_inline_elem"/>
                    <element name="sp:br">
                        <empty/>
                    </element>
                </choice>
            </zeroOrMore>
        </element>
    </define>
    <define name="bold">
        <element name="sp:bold">
            <text />
        </element>
    </define>
    <define name="image">
        <element name="sp:image">
            <attribute name="url">
                <text/>
            </attribute>
            <attribute name="alt">
                <text/>
            </attribute>
            <attribute name="title">
                <text/>
            </attribute>
        </element>
    </define>
    <define name="italics">
        <element name="sp:italics">
            <text />
        </element>
    </define>
    <define name="hyperlink_inner">
        <zeroOrMore>
            <choice>
                <text />
                <ref name="bold"/>
                <ref name="italics"/>
            </choice>
        </zeroOrMore>
    </define>
    <define name="ulink">
        <choice>
            <element name="sp:ulink">
                <attribute name="url">
                    <text/>
                </attribute>
                <ref name="hyperlink_inner"/>
            </element>
            <element name="sp:a">
                <attribute name="xlink:href">
                    <text/>
                </attribute>
                <ref name="hyperlink_inner"/>
            </element>
        </choice>
    </define>
</grammar>

