Hi Vito,

If you are using a JDK that includes Xalan and Xerces then classpath is not sufficient to override the version in the JDK.  You need to use -Djava.endorsed.dirs instead to get the newer version of Xalan.  Try both of the following to see the difference in the version:

java org.apache.xalan.Version        (should show the version that is included with the JDK)
java -Djava.endorsed.dirs=D:\javatools\xalan_2_7_0 org.apache.xalan.Version        (should show the version that is installed in D:\javatools\xalan_2_7_0)

Also, XInclude processing is not enabled by default.  See http://xerces.apache.org/xerces2-j/features.html for more information about enabling the http://apache.org/xml/features/xinclude feature.  It looks like it can only be enabled programatically so you will need to write a little Java wrapper to do the transformation (the site has examples).

Hope this helps!

Erin Harris




"Vito Caleandro" <[EMAIL PROTECTED]>

11/23/2005 06:01 AM

To
<[email protected]>
cc
Subject
Building simple transformations on document that use XInclude





Hi all,
I have to build a simple transformation on a document that contain a XIncude
element.
I try using xalan-J-2.7.0 with a batch script like this:

set
classpath=D:\javatools\xalan_2_7_0\xalan.jar;D:\javatools\xalan_2_7_0\xerces
impl.jar;D:\javatools\xalan_2_7_0\xml-apis.jar
java -cp %classpath% xalan.jar -V -IN inputDoc.xml -XSL
transformation.xsl -OUT outputDoc.html

(all classpath specification seems correct).

The piece of input :
...
   <segmentoSQL>
                <xi:include href="" parse="text"
xmlns:xi="http://www.w3.org/1999/XSL/XInclude">
                  <xi:fallback>
         Document non found
       </xi:fallback>
     </xi:include>
    </segmentoSQL>
...
and the piece of transformation
                ...
    <xsl:template match="testresults">
           ...
                                 <xsl:apply-templates select="results/failure"/>
                                 <xsl:apply-templates select="results/error"/>
                                 <p>Sezione SQL</p>
                                 <xsl:value-of select="results/segmentoSQL" />
                                 <p>
                                                  <a href="" al Riepilogo</a>
                                 </p>
           ...
                </xsl:template>

As results, first i got the strange version message :

>>>>>>> Versione Xalan XSLT4J Java 2.5.4, <<<<<<<

and then

I verify that the xi:include statament was totally ignored.

No other error message.

I suspect that the xerces parser were not used, nor his xi:include-treatment
is enabled
I know the there are some properties that I can set but I don't know how to
do this in such a simple batch scenario.

Can anyone give me a suggest?
Thanks in advance
Vito Caleandro


Reply via email to