I have a situation where I would like to define an XSD to allow to different "groups" of data.  I would
like to use the xsd:choice mechanism to allow Xerces to choose between the two groups during validation.
The groups contain the same makeup, however there is different values depending on the <source>.  For example:
 
Choice 1:
<element1>
   <source>foo</source>
   <value>bar</value>
</element1>
 
Choice 2:
<element1>
   <source>anystring</source>
   <value>anyvalue</value>
</element1>
 
So if <source> element has a value of "foo" I would like the <value> element to be forced to be part of an
enumeration (foo, bar, foobar).  If the <source> element does not have a value of "foo" then I really don't care what the value
of <value> element is, it can be any string. 
 
Choice 3 is INVALID, since cat is not a valid enumeration for the value element if the source element is
set to foo.
<element1>
   <source>foo</source>
   <value>cat</value>
<element1>
 
Does anyone know how I can write my XSD to allow this situation? Can this be done with the current W3C XSD Recommendation?
Thanks for any help
Schawn

Reply via email to