Consider this XSD:
Check this question about co-occurrence constraints: XSD: Define attributes based on the value of previous attribute
Summarizing: