- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Fri, 9 Nov 2001 09:26:15 +0000
- To: Abdalhmed Maran <Abdalhmed.Maran@supelec.fr>
- CC: xmlschema-dev@w3.org
Hi Abdalhmed,
> Is it possible to restrict the number of <A> element referencing <B>
> the child of <doc>? For example, three <B> elements in <A> are
> referencing the same <B>three<B> (child of <doc>). Is it possible to
> say that for each <B> appearing in <doc>, it is referenced at least
> by one <A> element and at most by 2 <A> elements? A kind of min and
> max Occurs for referenced elements and not for referencing elements.
You might be able to get part way there.
Saying that each of the B elements inside A must point to a separate
B element is another way of saying that each of the B elements within
a particular A element must have a different value. You can do this
with another key, this time defined on the A element (since that's the
scope):
<xs:element name="A">
...
<xs:key name="UniqueBKeyRef">
<xs:selector xpath="B" />
<xs:field xpath="." />
</xs:key>
</xs:element>
The difficulty is saying that there are a maximum of two A elements
that hold a reference to any particular B element. I don't think that
you can state this in XML Schema.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
Received on Friday, 9 November 2001 04:26:17 UTC