If you are using Xerces as your XML parser, you can have Xerces expand any XInclude
-xi option on the command line causes XInclude processing to be applied to all input
XML documents. This includes source documents, stylesheets, and schema documents listed on the command line, and
also those loaded indirectly for example by calls on the
doc() function or by mechanisms such as
From the Java API, the equivalent is to call
setXInclude() on the
or to set the attribute denoted by
Boolean.TRUE on the
XInclude processing can be requested at a per-document level by creating an
AugmentedSource and calling
setXIncludeAware() method. The corresponding method is also recognized on Saxon's implementation of the
DocumentBuilderFactory. When the
function is called from an XPath expression, XInclude processing can be enabled by including
among the query parameters in the URI.
It is also possible to switch on XInclude processing (for all documents) by setting the system property:
An alternative approach is to incorporate an XInclude processor as a SAX filter in the input pipeline.
You can find a suitable SAX filter at http://xincluder.sourceforge.net/, and
you can incorporate it into your application as described at Writing Input Filters.
On the .NET platform, there is a customized
XmlReader that performs XInclude processing available at
http://www.xmlmvp.org/xinclude/index.html. You can supply
this as an argument to the method
Build(XmlReader parser) in the
of the .NET Saxon API.
For further information on using XInclude, see