XML Schema has a type for globally unique IDs - xs:ID
- but you can't use that here because values of this type have to be valid XML names (so in particular they can't start with a digit).
The way to apply more general uniqueness constraints is to use xs:unique
:
<xs:element name="siss-statusquery">
<xs:complexType>
<!-- as before -->
</xs:complexType>
<xs:unique name="uniqueId">
<xs:selector xpath="lhs:myhash" />
<xs:field xpath="@id" />
</xs:unique>
</xs:element>
The way to read this is that within the scope of the containing element, all the elements matched by the selector
must have different values for their field
. So in this case, within the siss-statusquery
, all the myhash
elements must have different id
attributes.