<?xml version="1.0"?>
<!-- $Id: xlink.trex,v 1.2 2001/01/26 11:22:06 jjc Exp $ -->
<!-- This disallows things that don't have an XLink-defined meaning. -->

<grammar xmlns="http://www.thaiopensource.com/trex"
  xmlns:xlink="http://www.w3.org/1999/xlink">

<start name="any">
  <choice>
    <ref name="simple"/>
    <ref name="extended"/>
    <ref name="other"/>
    <anyString/>
  </choice>
</start>

<define name="simple">
  <element>
    <anyName/>
    <attribute name="xlink:type">
      <string>simple</string>
    </attribute>
    <optional>
      <attribute name="xlink:href"/>
    </optional>
    <optional>
      <attribute name="xlink:role"/>
    </optional>
    <optional>
      <attribute name="xlink:arcrole"/>
    </optional>
    <optional>
      <attribute name="xlink:title"/>
    </optional>
    <ref name="behave.atts"/>
    <ref name="other.atts"/>
    <zeroOrMore>
      <ref name="any"/>
    </zeroOrMore>
  </element>
</define>

<define name="extended">
  <element>
    <anyName/>
    <attribute name="xlink:type">
      <string>extended</string>
    </attribute>
    <optional>
      <attribute name="xlink:role"/>
    </optional>
    <optional>
      <attribute name="xlink:title"/>
    </optional>
    <ref name="other.atts"/>
    <zeroOrMore>
      <choice>
        <ref name="any"/>
        <ref name="title"/>
        <ref name="resource"/>
        <ref name="locator"/>
        <ref name="arc"/>
      </choice>
    </zeroOrMore>
  </element>
</define>

<define name="locator">
  <element>
    <anyName/>
    <attribute name="xlink:type">
      <string>locator</string>
    </attribute>
    <attribute name="xlink:href"/>
    <optional>
      <attribute name="xlink:role"/>
    </optional>
    <optional>
      <attribute name="xlink:title"/>
    </optional>
    <attribute name="xlink:label"/>
    <ref name="other.atts"/>
    <zeroOrMore>
      <choice>
        <ref name="any"/>
        <ref name="title"/>
      </choice>
    </zeroOrMore>
  </element>
</define>

<define name="arc">
  <element>
    <anyName/>
    <attribute name="xlink:type">
      <string>arc</string>
    </attribute>
    <optional>
      <attribute name="xlink:arcrole"/>
    </optional>
    <optional>
      <attribute name="xlink:title"/>
    </optional>
    <ref name="behave.atts"/>
    <optional>
      <attribute name="xlink:from"/>
    </optional>
    <optional>
      <attribute name="xlink:to"/>
    </optional>
    <ref name="other.atts"/>
    <zeroOrMore>
      <choice>
        <ref name="any"/>
        <ref name="title"/>
      </choice>
    </zeroOrMore>
  </element>
</define>

<define name="resource">
  <element>
    <anyName/>
    <attribute name="xlink:type">
      <string>resource</string>
    </attribute>
    <optional>
      <attribute name="xlink:role"/>
    </optional>
    <optional>
      <attribute name="xlink:title"/>
    </optional>
    <attribute name="xlink:label"/>
    <ref name="other.atts"/>
    <zeroOrMore>
      <ref name="any"/>
    </zeroOrMore>
  </element>
</define>

<define name="title">
  <element>
    <anyName/>
    <attribute name="xlink:type">
      <string>title</string>
    </attribute>
    <ref name="other.atts"/>
    <zeroOrMore>
      <ref name="any"/>
    </zeroOrMore>
  </element>
</define>

<define name="other">
  <element>
    <anyName/>
    <ref name="other.atts"/>
    <zeroOrMore>
      <ref name="any"/>
    </zeroOrMore>
  </element>
</define>

<define name="behave.atts">
  <optional>
    <attribute name="xlink:show">
      <choice>
	<string>new</string>
	<string>replace</string>
	<string>embed</string>
	<string>other</string>
	<string>none</string>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="xlink:show">
      <choice>
	<string>onLoad</string>
	<string>onRequest</string>
	<string>other</string>
	<string>none</string>
      </choice>
    </attribute>
  </optional>
</define>

<define name="other.atts">
  <zeroOrMore>
    <attribute>
      <not>
	<nsName ns="http://www.w3.org/1999/xlink"/>
      </not>
    </attribute>
  </zeroOrMore>
</define>

</grammar>
