<xs:choice/> accepts empty content as valid
#1 Updated by Michael Kay over 4 years ago
- Status changed from New to In Progress
I traced this to a problem in the spec, in the definition of "emptiable". The spec leads to the conclusion that xs:choice/ is emptiable (that is, an empty sequence is a valid instance), but it is not. Saxon uses the fact that the content is emptiable to conclude in this case that the only legal content is an empty sequence; it then optimizes away the element-only content model and the finite state machine by setting variety="EMPTY". I've patched it by refining this test so that we don't set variety=EMPTY when the content model is an empty choice. The patch fixes this case, though we need to check for side-effects.
Please register to edit this issue