The Saxon message makes it clear that the error message comes from Xerces.
 
I believe that the version of Xerces included in JDK 1.5 is fairly buggy in the XInclude area and I suggest you try to substitute a more recent version of Xerces from the apache.com site.
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of David Valentiate
Sent: 20 September 2007 18:16
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Nested XInclude Limit

I am using xi:include to pull in other xml files which in turn include other xml files until I done this 5 levels deep. But after the the 3rd level of nesting I get an error.  Unfortunately either Saxon or Xerces fails giving the following error:

SXXP0003: Error reported by XML parser: The prefix "xi" for element "xi:include" is not bound.

I am using Saxon 8.9.0.4 running on Sun Java 1.5.0_11

To be clear I have attached a zip with sample files that demonstrate the problem and also show them below.

I have found that I can use XIncluder ( http://xincluder.sourceforge.net/) to do the nested includes and then use Saxon to do my transforms. So I have a work around but it would be nice if this worked out of the gate as advertised.

I run from the command line:
java -cp ../tools/saxon8.jar net.sf.saxon.Transform -xi -s level1.xml transform.xslt

transform.xslt
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="nest">
        <xsl:value-of select="."></xsl:value-of>
    </xsl:template>
</xsl:stylesheet>

level1.xml
<?xml version="1.0" encoding="UTF-8"?>
<nest xmlns:xi="http://www.w3.org/2001/XInclude">
    level 1
    <xi:include href="level2.xml"/>
</nest>

level2.xml
<?xml version="1.0" encoding="UTF-8"?>
<nest xmlns:xi="http://www.w3.org/2001/XInclude">
    level 2
    <xi:include href="level3.xml"/>
</nest>

level3.xml
<?xml version="1.0" encoding="UTF-8"?>
<nest xmlns:xi="http://www.w3.org/2001/XInclude">
    level 3
    <xi:include href=" level4.xml"/>
</nest>

level4.xml
<?xml version="1.0" encoding="UTF-8"?>
<nest xmlns:xi="http://www.w3.org/2001/XInclude">
    level 4
</nest>

The complete error message is:
Error on line 4 column 33 of file:/media/sda1/nestedXIncludeProblem/level3.xml:
  SXXP0003: Error reported by XML parser: The prefix "xi" for element "xi:include" is not bound.
Error on line 4 column 33 of file:/media/sda1/nestedXIncludeProblem/level2.xml:
  SXXP0003: Error reported by XML parser: Error attempting to parse XML file (href=' level3.xml').
Error on line 4 column 33 of file:/media/sda1/nestedXIncludeProblem/level1.xml:
  SXXP0003: Error reported by XML parser: Error attempting to parse XML file (href='level2.xml').
Transformation failed: Run-time errors were reported