Stylesheets icon indicating copy to clipboard operation
Stylesheets copied to clipboard

Broken content models when some elements are not included

Open raffazizzi opened this issue 8 years ago • 1 comments

When including elements, e.g. via moduleRef/@include, some RNG content models may be broken if all elements references within a content child (e.g. alternate or sequence) are excluded.

For example:

<moduleRef key="textcrit" include="app rdg rdgGrp"/>

Will cause the definition of rdgGrp to be broken:

<oneOrMore>
   <choice>
      <group>
         <ref name="rdgGrp"/>                  
      </group>               
      <zeroOrMore>
         <group>
            <optional>                        
               <!-- NOT VALID -->
            </optional>                     
            <group>
               <ref name="model.rdgLike"/>                        
            </group>
         </group>
      </zeroOrMore>               
      <zeroOrMore>
         <ref name="model.noteLike"/>
      </zeroOrMore>               
   </choice>
</oneOrMore>

In short: if all elementRefs are dropped from a sequence or alternate, do not ouput the corresponding RNG element.

raffazizzi avatar Nov 29 '17 21:11 raffazizzi

This is a generic problem, I think. When a grouping element such as <sequence> or alternate has no children because they have been deleted, the grouping element itself should also be deleted. It matters less if a child is a class reference, even if that class has no members, because RNG is more forgiving of that situation.

lb42 avatar Nov 30 '17 15:11 lb42