<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-form-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: xhtml-form-1.rng,v 1.1 2010/12/12 23:24:10 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-form-1.rng
     .................................................................... -->
<!-- Forms Module -->
<!-- Unlike the DTD implementation, this builds on the xhtml-basic-form module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<include href="xhtml-basic-form-1.rng">

  <define name="xhtml.select">
    <element name="select">
      <ref name="xhtml.select.attlist"/>
      <oneOrMore>
	<choice>
	  <ref name="xhtml.option"/>
	  <ref name="xhtml.optgroup"/>
	</choice>
      </oneOrMore>
    </element>
  </define>

</include>

<define name="xhtml.form.attlist" combine="interleave">
  <optional>
    <attribute name="accept-charset">
      <ref name="xhtml.Charsets.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accept">
      <ref name="xhtml.ContentTypes.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="name"/>
  </optional>
</define>

<define name="xhtml.input.attlist" combine="interleave">
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="readonly">
      <value>readonly</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="alt"/>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accept">
      <ref name="xhtml.ContentTypes.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.InputType.class" combine="choice">
  <choice>
    <value>image</value>
    <value>button</value>
    <value>file</value>
  </choice>
</define>

<define name="xhtml.select.attlist" combine="interleave">
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.option.attlist" combine="interleave">
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="label">
      <ref name="xhtml.Text.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.optgroup">
  <element name="optgroup">
    <ref name="xhtml.optgroup.attlist"/>
    <oneOrMore>
      <ref name="xhtml.option"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.optgroup.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <attribute name="label">
    <ref name="xhtml.Text.datatype"/>
  </attribute>
</define>

<define name="xhtml.textarea.attlist" combine="interleave">
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="readonly">
      <value>readonly</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.fieldset">
  <element name="fieldset">
    <ref name="xhtml.fieldset.attlist"/>
    <ref name="xhtml.legend"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.fieldset.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.button">
  <element name="button">
    <ref name="xhtml.button.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.button.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="name"/>
  </optional>
  <optional>
    <attribute name="value"/>
  </optional>
  <optional>
    <attribute name="type">
      <choice>
        <value>button</value>
        <value>submit</value>
        <value>reset</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accesskey">
      <ref name="xhtml.Character.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.legend">
  <element name="legend">
    <ref name="xhtml.legend.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.legend.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="accesskey">
      <ref name="xhtml.Character.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.Form.class" combine="choice">
  <ref name="xhtml.fieldset"/>
</define>

<define name="xhtml.Formctrl.class" combine="choice">
  <ref name="xhtml.button"/>
</define>

</grammar>

