Problem solved. Thanks for the tip. I had already tried that but with the
wrong syntax. Here is the example I have:
<xs:key name="responseNameKey">
<xs:selector xpath="./QuestionList/Question/ResponseList/Response |
../QuestionList/Question/ResponseList/Response/ResponseOptions/ResponseOption
|
../QuestionList/Question/QuestionGroupList/QuestionGroup/ResponseList/Response
|
../QuestionList/Question/QuestionGroupList/QuestionGroup/ResponseList/Response/ResponseOptions/ResponseOption
|
../QuestionList/Question/QuestionGroupList/QuestionGroup/QuestionList/Question/ResponseList/Response
|
../QuestionList/Question/QuestionGroupList/QuestionGroup/QuestionList/Question/ResponseList/Response/ResponseOptions/ResponseOption" />
<xs:field xpath="@name" />
</xs:key>
It is this complicated because not all elements have an attribute that
should be considered an unique key, so I enumerated the elements that have
the attribute that can't be repeated. I included this schema fragment at the
root level.
Tnanks a lot
Miguel
"Martin Honnen" wrote:
Quote:
>
>
Miguel Isidoro wrote:
>
>
Quote:
I am trying to include a xsd:unique element in my schema to make an
attribute of an element unique at the whole document level.
|
>
Quote:
The problem with my schema is that it only validates the duplicate id
<Responseelements inside the same <Questionelement, not at the whole
document level as I want. Is there any way to achieve this?
|
>
Why don't you simply type that attribute as type xs:ID?
>
If you want to use the xs:unique element then you need to put it in the
definition of the root element (e.g. the Form element).
>
>
--
>
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
>
|