2.7. Collection of X-definitions

More X-definitions in one XML object, cross-references between them:

<xd:collection xmlns:xd="http://www.xdef.org/xdef/4.2" >

<xd:def xd:name="Example" xd:root="Family" >
  <Family>
  <Father xd:script="occurs ?; ref common#Person;" />
  <Mother xd:script="occurs 1; ref common#Person;" />
     <xd:mixed>
        <Son      xd:script="occurs 0..12; ref common#Person;" />
        <Daughter xd:script="occurs 0..12; ref common#Person;" />
     </xd:mixed>
  <Address xd:script= "occurs 1; ref common#Address;" />
  </Family>
</xd:def>

<!-- Models of referred elements -->
<xd:def xd:name="common" >
   <Person Firstname ="required string(1,30)"
           Familyname="required string(1,30)"
           BirthDate ="required date()" />
   <Address Street="required string(1,30)"
            Number="optional int()"
            City  ="required string()" />
</xd:def>

</xd:collection>
You can try it HERE