[relaxng-user] A question on content models

James Clark jjc at jclark.com
Wed Sep 24 14:18:06 ICT 2003


> I have a master RNG file that describes general properties of my
> grammar, and individual RNG files that describe individual
> elements. The master file <include>s the individual ones.

It's also worth mentioning that you can use a similar technique with 
attributes.

> The master file has declarations like
> 
>   <define name="class.filter">
>     <notAllowed/>
>   </define>

For sets of attributes, use <empty/> instead of <notAllowed/>

<define name="i18n.attributes">
   <empty/>
</define>

> Individual files usually say something like
> 
>   <define combine="choice" name="class.reader">
>     <element name="switch">
>       <!-- CM -->
>     </element>
>   </define>

Then use combine="interleave" instead of combine="choice".

<define combine="interleave" name="i18n.attributes">
   <attribute name="xml:lang">
     <data type="language"/>
   </attribute>
</define>

James




More information about the relaxng-user mailing list