Shortcomings

Consider the following case. A schema A, shown in Figure 1, “schema-a.sch, includes a pattern from a different schema B, shown in Figure 2, “schema-b.sch.

Figure 1. schema-a.sch

<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
  <sch:ns prefix="example" uri="http://example.com/ns"/>
  <sch:include href="schema-b.sch#pattern-b"/>
</sch:schema>

Figure 2. schema-b.sch

<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
  <sch:ns prefix="ex" uri="http://example.com/ns"/>
  <sch:let name="allowedTypes" value="tokenize('foo bar', ' ')"/>
  <sch:pattern id="pattern-b">
    <sch:rule context="ex:element[@type = $allowedTypes]">
      <sch:assert test="false()"/>
    </sch:rule>
  </sch:pattern>
</sch:schema>

Simply replacing the sch:include element in A with the pattern from B does not produce a working schema.

In general, the interaction of schema composition with rule based validation is underspecified.