Control over schema validation in parse-xml(), doc(), etc. #490
Labels
Enhancement
A change or improvement to an existing feature
PRG-hard
Categorized as "hard" at the Prague f2f, 2024
PRG-required
Categorized as "required for 4.0" at the Prague f2f, 2024
XQFO
An issue related to Functions and Operators
I'm struggling with a problem with the stylesheet that generates QT4 tests from the examples in the function catalog, and I think it's an example of a more general problem in schema-aware processing.
The spec gives this example (for json-to-xml):
But the test we actually generate expects the result:
and the test is failing because the result produced by Saxon correctly excludes the
escaped-key="false"
attributes which the test is expecting. How did the attributes get there?The answer is that the stylesheet is doing
parse-xml()
followed by some transformation to normalise whitespace, followed byserialize()
. Theparse-xml()
call is invoking schema validation, which adds default attributes.We probably don't want schema validation here; if we do want it, we probably don't want default attribute values to be expanded. But parse-xml() doesn't give us the choice. It says it's implementation-defined and it gives no options for the user to control it. Saxon provides configuration-level options but they aren't fine-grained enough to use here.
Without being able to control this, the only option seems to be for the stylesheet to transform the result to take out the defaulted attributes that the schema processor has added.
We need options on functions like
doc()
andparse-xml()
to control whether and how schema validation is performed.One of the options we need whenever we do validation is probably "validate+strip" - validate the input, report errors if it's invalid, but return the untyped data that was supplied to the validator, not the type-annotated data with expanded defaults.
The text was updated successfully, but these errors were encountered: