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 ...

Get RELAX NG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.