I am trying to validate that a parent has unique child elements by the element name. I also need to validate that at least one of the possible elements exists.
Example
<StorageTypes>
<Status/>
<Warning/>
<Error/>
</StorageTypes>
Would be valid but
<StorageTypes>
<Status/>
<Status/>
<Warning/>
<Error/>
</StorageTypes>
and
<StorageTypes>
</StorageTypes>
would be invalid.
I have tried using xs:unique, selecting the the current node, but am unable to generically select the elements with the field element.
The below acheives what I am looking to do but it is not the robust solution I am looking for. I would like to be able to add more Types with out changing the xpath for every change.
<element ect.>
<xs:unique name="something">
<xs:selector xpath="."/>
<xs:field xpath="Status"/>
<xs:field xpath="Warning"/>
<xs:field xpath="Error"/>
</xs:unique>
</element>
Is this possible? Is this good practice? Any advice would be appreciated.