need help with xinclude

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • CB

    #1

    need help with xinclude

    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.xer ces.xni.parser. XMLParserConfig uration=\
    org.apache.xerc es.parsers.XInc ludeParserConfi guration \
    org.apache.xala n.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"
    elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
    <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:noNamespace SchemaLocation= "simple.xsd ">
    <element>hell o</element>
    </root>


    ---- world.xml ----

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

    ---- simple.xslt ----

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

    ---- expected output ----

    hello
    world

    ---- actual output ----

    world
  • Igor Zlatkovic

    #2
    Re: need help with xinclude

    On 25/08/04 23:07, CB wrote:[color=blue]
    > 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?[/color]

    I believe you will need these:

    javax.xml.parse rs.DocumentBuil derFactory=
    org.apache.xerc es.jaxp.Documen tBuilderFactory Impl
    javax.xml.parse rs.SAXParserFac tory=
    org.apache.xerc es.jaxp.SAXPars erFactoryImpl

    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

    Comment

    Working...