RELAX NG by Eric van der Vlist will be published by O'Reilly & Associates (ISBN: 0596004214)

You are welcome to use our annotation system to give your feedback.


Name

include — Grammar merge

Class:

grammar-content

Synopsis

element include
{
   attribute href { xsd:anyURI },
   (
      attribute ns { text }?,
      attribute datatypeLibrary { xsd:anyURI }?,
      attribute * - (rng:* | local:*) { text }*
   ),
   (
      ( element * - rng:* { ... }* )
    & (
         ( element start { ... } )
       | ( element define { ... } )
       | element div { ... }
      )*
   )
}

May be included in:

div, grammar.

Compact syntax equivalent:

include

Description:

The include pattern includes a grammar and merges its definitions with the definitions of the current grammar. The definitions of the included grammar may be redefined and overridden by the definitions embedded in the include pattern. Note that a schema must contain an explicit grammar definition in order to be included.

Example:

  <grammar xmlns="http://relaxng.org/ns/structure/1.0">
   <start>
    <element name="library">
     <oneOrMore>
      <ref name="book-element"/>
     </oneOrMore>
    </element>
   </start>
   <include href="included.rng"/>
   .../...
  </grammar>

  <grammar xmlns="http://relaxng.org/ns/structure/1.0">
   <include href="flat.rng">
     <define name="book-element">
       <element name="book">
         <attribute name="id"/>
         <attribute name="available"/>
         <ref name="isbn-element"/>
         <ref name="title-element"/>
         <ref name="description-element"/>
         <zeroOrMore>
           <ref name="author-element"/>
         </zeroOrMore>
       </element>
     </define>
   </include>
   <define name="description-element">
     <element name="description">
       <text/>
     </element>
   </define>
 </grammar>

      

Attributes:

datatypeLibrary

The datatypeLibrary attribute defines the default datatype library. The value of datatypeLibrary is inherited.

href

The href attribute defines the location of the schema and which grammar should be included.

ns

The ns attribute defines the default namespace for the elements defined in a portion of schema. The value of ns is inherited.


You are welcome to use our annotation system to give your feedback.
[Annotations for this page]
All text is copyright Eric van der Vlist, Dyomedea. During development, I give permission for non-commercial copying for educational and review purposes. After publication, all text will be released under the Free Software Foundation GFDL.