by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)


Name

include — Grammar merge

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 { ... }
 )*
 )
}

Class

grammar-content

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

This attribute defines the default datatype library. The value is inherited.

href

This attribute defines the location of the schema and specifies the grammar to be included.

ns

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


This text is released under the Free Software Foundation GFDL.