Rainer
Rainer

Reputation:

Restrict exclusive key-value pairs in XSD

In the XSD, there are two elements, A and B. They are siblings.

A can have a value of either "1" or "2". B can have a value of either "one" or "two".

I want to restrict this, however, so that only "1-one" and "2-two" are valid combinations, not "1-two" or "2-one". Is there a way of doing that in the XSD?

Upvotes: 3

Views: 848

Answers (1)

Dirk Vollmar
Dirk Vollmar

Reputation: 176159

Schematron can be used to define such co-occurrence constraints. You can find some introductory articles here:

Upvotes: 2

Related Questions