Substitution groups are not merged
Taking this over as a sub-problem of bug #3202.
MHK IntelliJ project Saxon9.8/XBRLTest
When there are several independent calls on SchemaManager.load(), each call on load() results in a new PreparedSchema being built; and if the schema is then found to be valid, its components are merged into the global schema for the Configuration. (We carefully avoid making any changes to the global schema until the new local schema has been verified as being valid.)
If two of these calls on load() specify two different schemas which both import some common schema, it's possible that either or both may declare elements to be in the substitution group of some element declaration in the common schema. When this happens then the process of merging the local schema into the global schema should form the union of the two substitution groups (and in turn, this should trigger recompilation of any affected types). This is not happening: we use one element declaration or the other, but we never merge them in this way.
The logic is complicated by xs:redefine, but let's focus on getting it right in the absence of xs:redefine.
Updated by Michael Kay about 5 years ago
I wrote a simple unit test to demonstrate the problem (TestValidator/testMergeSubstitutionGroups). This test is failing on the status quo code, but it succeeds after making the change documented under bug #3202 to maintain the cache of loaded schema documents at global level rather than within a particular schema compiler.
However, this is not the end of the matter, because although this unit test is now passing, the complex XBRL test case is still failing.
Please register to edit this issue