Enforcing 'conditions' without using XSLT

Hello,

I'm trying to figure out if the new draft for schemas supports 'conditions' 
i.e. I have the following XML snippet;

<parameter name="burt" type="int">
     <value>1</value>
</parameter>

In my schema, I have the 'type' attribute as a NMTOKEN with for example 
'int | float | string' as enumerations.

I'd like to be able to specify that the schema type of the value node 
reflects the value of this 'type' attribute, to enforce that when the XML 
states the parameter type attribute is 'x' that the child value node *is* 
of type 'x'

Kind being able to write in the schema;

<xs:element name="Parameter">
     <xs:complexType>
         <xs:attribute name="name" type="xs:string" use="required" />
         <xs:attribute name="type" use="required">
             </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:NMTOKEN">
                     <xs:enumeration value="int" />
                     <xs:enumeration value="float" />
                     <xs:enumeration value="string" />
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>

         <!-- here's where the actual data type is set for the value 
element -->

         <xs:condition attribute="type" equals="int">
             <xs:element name="value" type="xs:int" />
         </xs:condition>
         <xs:condition attribute="type" equals="float">
             <xs:element name="value" type="xs:float" />
         </xs:condition>
         <xs:condition attribute="type" equals="string">
             <xs:element name="value" type="xs:string" />
         </xs:condition>

     </xs:complexType>
</xs:element>

Thanks,
--phil 

Received on Thursday, 6 March 2003 13:35:05 UTC