I suppose you've in mind w3c xml schema. In the broadly supported v1.0, this kind of constraints cannot be expressed by and from within the schema document. Possible solutions would be either to relegate the checking (assertion) to a small device at application level or use schematron (basically an xslt of specific construction) in tandam with w3c xml schema or use an entirely different schema like relaxng. In v1.1 which has now reached as a w3c recommendation, additional elements are added, following to a big degree the approach used by schematron, to resolve these co-constraint issues. However the support of v1.1 is much less wide-spread and it takes time to get things done properly naturally. So, in that regard, it is your call.