Element Substitution

Paul Mensonides <[email protected]> Sun, 2 May 2021 14:35:13 -0700
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
I am trying to wrap my head around the rules for element substitution in 
XML Schema, but I am running into some kind of namespace problem.

[a.xsd]
<?xml version="1.1" encoding="UTF-8"?>
<xs:schema
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
     xmlns:a="urn:a"
     targetNamespace="urn:a"
     elementFormDefault="qualified"
     vc:minVersion="1.1">
     <xs:complexType name="type">
         <xs:sequence>
             <xs:element ref="a:element"
                 minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
     <xs:element name="element" type="a:type"/>
</xs:schema>

[b.xsd]
<?xml version="1.1" encoding="UTF-8"?>
<xs:schema
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
     xmlns:a="urn:a" xmlns:b="urn:b"
     targetNamespace="urn:b"
     elementFormDefault="qualified"
     vc:minVersion="1.1">
     <xs:import namespace="urn:a" schemaLocation="a.xsd"/>
     <xs:complexType name="type">
         <xs:complexContent>
             <xs:extension base="a:type"/>
         </xs:complexContent>
     </xs:complexType>
     <xs:element name="element" type="b:type"
         substitutionGroup="a:element"/>
</xs:schema>

[x.xml]
<?xml version="1.1" encoding="UTF-8"?>
<a:element
     xmlns:a="urn:a" xmlns:b="urn:b"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="urn:a a.xsd urn:b b.xsd">
     <b:element/>
</a:element>

In Saxon 9.9.1.5 (which is the latest I have access to from the command 
line), this works fine.

However, in Saxon 9.9.1.7 (which is what my version of Oxygen is using), 
it fails:

In content of element <a:element>: The content model does not allow 
element <Q{urn:b}element> to appear as the first child. The element is 
in namespace urn:b but it should be in namespace urn:a.

Note that a:element/a:element, b:element/a:element, and 
b:element/b:element all work.

Is there some rule that I am missing?

Regards,
Paul Mensonides