Previous: Using type identifiers in schema locating files, Up: Schema locating files

6.2.5 Using multiple schema locating files

The ‘include’ element includes rules from another schema locating file. The behavior is exactly as if the rules from that file were included in place of the ‘include’ element. Relative URIs are resolved into absolute URIs before the inclusion is performed. For example,

     <include rules="../rules.xml"/>

includes the rules from ‘rules.xml’.

The process of locating a schema takes as input a list of schema locating files. The rules in all these files and in the files they include are resolved into a single list of rules, which are applied strictly in order. Sometimes this order is not what is needed. For example, suppose you have two schema locating files, a private file

     <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
       <namespace ns="http://www.w3.org/1999/xhtml" uri="xhtml.rnc"/>
     </locatingRules>

followed by a public file

     <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
       <transformURI pathSuffix=".xml" replacePathSuffix=".rnc"/>
       <namespace ns="http://www.w3.org/1999/XSL/Transform" typeId="XSLT"/>
     </locatingRules>

The effect of these two files is that the XHTML ‘namespace’ rule takes precedence over the ‘transformURI’ rule, which is almost certainly not what is needed. This can be solved by adding an ‘applyFollowingRules’ to the private file.

     <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
       <applyFollowingRules ruleType="transformURI"/>
       <namespace ns="http://www.w3.org/1999/xhtml" uri="xhtml.rnc"/>
     </locatingRules>