MAJOR EDIT Originally I missed the requirement that you need to use xsd:extension
. Note that xsd:extension
works as if there was xsd:sequence
with contents of the base type followed by contents of the extended type. As XML Schema Primer puts it:
When a complex type is derived by extension, its effective content model is the content model of the base type plus the content model specified in the type derivation. Furthermore, the two content models are treated as two children of a sequential group.
Therefore, it seems that the only way to make this work is to have an empty base type and store the whole alternative in the extended type, or vice versa (everything in the base and an empty extension). Like this: