Instance-parameterised constraints

We are working on an application based on XML Schemas that supports
configurable products.
We would like to specify constraints in schemas based on the values of
certain elements in the instance document. 
This is what you call instance-parameterised constraints. The current
version of the XML Schema specs do not support this but could you give me
some hints about the way you would solve this?

We are thinking in the direction of specifying expressions instead of
constant values in occurrence constraints or other attributes. See example
below. Whats your opinion?

For example the following should be possible. If the value "VW Golf" is
specified for "Model" then a "CarrierSet" can be chosen too (maxOccurs="1").
If the value "VW Cabrio" is specified for "Model" then a "CarrierSet" is not
allowed (maxOccurs="0").

<complexType name="Car">

	<element name="Model">
		<simpleType base="string">
			<enumeration value="VW Golf" />
			<enumeration value="VW Cabrio" />
		</simpleType>
	</element>

	<!-- CarrierSet. Not allowed when Model "VW Cabrio" is chosen. -->
	<!-- CarrierSet. Allowed when another Model is chosen. -->

	<element name="CarrierSet" type="boolean" 
		minOccurs="0"
		maxOccurs="'Model' == 'VW Cabrio' ? '0' : '1'" /> <!--
Expression instead of constant value -->

</complexType>


With regards, 
Peter van de Hoef

Springsite

Received on Thursday, 25 May 2000 15:50:35 UTC