need help with xinclude

C

CB

I am using xerces 2.5.0 and xalan 2.6.0, and am following the xinclude
instructions on the xerces faq at
http://xml.apache.org/xerces2-j/faq-xinclude.html, and I am having no
luck. I imagine I must be missing something fundamental, can someone
point it out, please?

Here are all the gory details;

---- command line ----

java \
-Djava.endorsed.dirs='/usr/local/xerces-j;/usr/local/xalan-j' \
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=\
org.apache.xerces.parsers.XIncludeParserConfiguration \
org.apache.xalan.xslt.Process -in world.xml -xsl simple.xslt

---- simple.xsd ----

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="element"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

---- hello.xml ----

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="simple.xsd">
<element>hello</element>
</root>


---- world.xml ----

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="simple.xsd">
<xi:include href="hello.xml"
xmlns:xi="http://www.w3.org/2003/XInclude" />
<element>world</element>
</root>

---- simple.xslt ----

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="text" indent="no"/>
<xsl:template match="//root/element">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>

---- expected output ----

hello
world

---- actual output ----

world
 
I

Igor Zlatkovic

I am using xerces 2.5.0 and xalan 2.6.0, and am following the xinclude
instructions on the xerces faq at
http://xml.apache.org/xerces2-j/faq-xinclude.html, and I am having no
luck. I imagine I must be missing something fundamental, can someone
point it out, please?

I believe you will need these:

javax.xml.parsers.DocumentBuilderFactory=
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
javax.xml.parsers.SAXParserFactory=
org.apache.xerces.jaxp.SAXParserFactoryImpl

Pass them with -D or put them in a file called jaxp.properties in the
lib directory of the JRE. I believe, the Java runtime won't use Xerces
without these but will resort to its own Crimson parser.

Ciao,
Igor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top