<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.cdisc.org/ns/odm/v1.3"
           xmlns="http://www.cdisc.org/ns/odm/v1.3"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:data="http://www.cdisc.org/ns/Dataset-XML/v1.0"
           xmlns:odm="http://www.cdisc.org/ns/odm/v1.3"
           elementFormDefault="qualified" attributeFormDefault="unqualified">


  <xs:import namespace="http://www.cdisc.org/ns/Dataset-XML/v1.0" schemaLocation="dataset-ns.xsd"/>

    <xs:redefine schemaLocation="../cdisc-odm-1.3.2/ODM1-3-2-foundation.xsd">

      <!-- DatasetXMLVersion as attribute for ODM - mandatory - fixed to "1.0" -->
        <xs:attributeGroup name="ODMAttributeExtension">
          <xs:attributeGroup  ref="ODMAttributeExtension"/>
          <xs:attribute ref="data:DatasetXMLVersion" use="required"/>
        </xs:attributeGroup>

      <!-- ItemGroupDataSeq as attribute for ItemGroupData - mandatory -->
        <xs:attributeGroup name="ItemGroupDataAttributeExtension">
          <xs:attributeGroup  ref="ItemGroupDataAttributeExtension"/>
          <xs:attribute ref="data:ItemGroupDataSeq" use="required"/>
        </xs:attributeGroup>

        <!-- Allow ItemGroupData to come within ClinicalData -->
        <xs:group name="ClinicalDataElementExtension">
          <xs:sequence>
            <xs:group ref="ClinicalDataElementExtension"/>
            <xs:element ref="odm:ItemGroupData" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:group>
    </xs:redefine>

</xs:schema>
