I believe this has to do with keyref but I\'m not for sure, and I am really not sure that it can be done at all.
For example, say I have myElement1 and
What I would suggest is to create XSD for each cases defined below:
Cases like:
And create there own XML for that.