need help with xinclude

Discussion in 'XML' started by CB, Aug 25, 2004.

  1. CB

    CB Guest

    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
    CB, Aug 25, 2004
    #1
    1. Advertising

  2. On 25/08/04 23:07, CB wrote:
    > 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
    Igor Zlatkovic, Aug 25, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ed Dennison
    Replies:
    0
    Views:
    449
    Ed Dennison
    Sep 12, 2003
  2. Erdem Guven

    XInclude

    Erdem Guven, Aug 12, 2004, in forum: XML
    Replies:
    1
    Views:
    595
    Matthias Jung
    Aug 12, 2004
  3. SL
    Replies:
    0
    Views:
    515
  4. pxpilot
    Replies:
    1
    Views:
    379
    Pavel Lepin
    Oct 16, 2007
  5. chuck
    Replies:
    6
    Views:
    961
    chuck
    Nov 25, 2011
Loading...

Share This Page