<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         ns="http://jelix.org/ns/suburls/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
         >

   <start>
      <element name="suburls">
         <oneOrMore>
            <ref name="url" />
         </oneOrMore>
      </element>
   </start>

   <define name="url">
      <element name="url">
         <attribute name="pathinfo" />
         <attribute name="action" />
         <optional>
            <attribute name="actionoverride" />
         </optional>
         <zeroOrMore>
            <ref name="param" />
         </zeroOrMore>
         <zeroOrMore>
            <ref name="static" />
         </zeroOrMore>
         <optional> <attribute name="optionalTrailingSlash"><data type="boolean"/></attribute> </optional>
      </element>
   </define>

   <define name="url.handler">
      <element name="url">
         <optional>
            <attribute name="pathinfo" />
         </optional>
         <optional>
            <attribute name="action" />
            <optional>
               <attribute name="actionoverride" />
            </optional>
         </optional>
         <attribute name="handler" />
         <empty/>
      </element>
   </define>

   <define name="param">
      <element name="param">
         <attribute name="name" />
         <optional>
            <choice>
               <attribute name="type">
                  <choice>
                     <value>string</value>
                     <value>char</value>
                     <value>letter</value>
                     <value>number</value>
                     <value>int</value>
                     <value>integer</value>
                     <value>digit</value>
                     <value>date</value>
                     <value>year</value>
                     <value>month</value>
                     <value>day</value>
                  </choice>
               </attribute>
               <attribute name="regexp"/>
            </choice>
         </optional>
         <optional><attribute name="escape"><data type="boolean"/></attribute></optional>
         <empty />
      </element>
   </define>

   <define name="static">
      <element name="static">
         <attribute name="name" />
         <attribute name="value" />
         <empty />
      </element>
   </define>

</grammar>