XML Schema 1.1 assert constraints diverge when referenced elements are absent
0 reputation · 31 Oct 2023, 03:00 UTC
Symptom
When an XML Schema 1.1 assert references an optional element or attribute that may be missing, different validators report different validation outcomes. Some processors treat the XPath evaluation error as a validation failure, while others silently ignore the assert and continue.
Context
The specification does not prescribe how a validator must handle XPath errors inside an assert, nor does it fix the evaluation context (target element vs. document root). This ambiguity makes cross‑validator behavior unpredictable for schemas that rely on asserts to enforce conditional rules.
Open questions
- Should a validator treat any XPath evaluation error in an assert as a fatal validation error?
- Is the assert expression evaluated relative to the element it decorates or to the document root?
- What guidance can schema authors follow to obtain consistent results across Xerces, Saxon, and other XML Schema 1.1 processors?