[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xalan-j-users
Subject:    Re: Building simple transformations on document that use XInclude
From:       Erin Harris <eharris () ca ! ibm ! com>
Date:       2005-11-23 16:12:34
Message-ID: OFA1FCEA65.98CF9404-ON852570C2.0052EA80-852570C2.0058A6CA () ca ! ibm ! com
[Download RAW message or body]

This is a multipart message in MIME format.
--=_alternative 0058A6C8852570C2_=
Content-Type: text/plain; charset="US-ASCII"

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" <kalosandros@katamail.com> 
11/23/2005 06:01 AM

To
<xalan-j-users@xml.apache.org>
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="D:\myIncludedDocument.txt" 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="#overview">Torna 
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



--=_alternative 0058A6C8852570C2_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Hi Vito,</font>
<br>
<br><font size=2 face="sans-serif">If you are using a JDK that includes
Xalan and Xerces then classpath is not sufficient to override the version
in the JDK. &nbsp;You need to use -Djava.endorsed.dirs instead to get the
newer version of Xalan. &nbsp;Try both of the following to see the difference
in the version:</font>
<br>
<br><font size=2 face="sans-serif">java org.apache.xalan.Version &nbsp;
&nbsp; &nbsp; &nbsp;(should show the version that is included with the
JDK)</font>
<br><font size=2 face="sans-serif">java -Djava.endorsed.dirs=D:\javatools\xalan_2_7_0
org.apache.xalan.Version &nbsp; &nbsp; &nbsp; &nbsp;(should show the version
that is installed in D:\javatools\xalan_2_7_0)</font>
<br>
<br><font size=2 face="sans-serif">Also, XInclude processing is not enabled
by default. &nbsp;See </font><a \
href="http://xerces.apache.org/xerces2-j/features.html"><font size=2 color=blue \
face="sans-serif">http://xerces.apache.org/xerces2-j/features.html</font></a><font \
size=2 face="sans-serif"> for more information about enabling the \
http://apache.org/xml/features/xinclude feature. &nbsp;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).<br>
</font>
<br><font size=2 face="sans-serif">Hope this helps!</font>
<br><font size=2 face="sans-serif"><br>
Erin Harris<br>
<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>&quot;Vito Caleandro&quot;
&lt;kalosandros@katamail.com&gt;</b> </font>
<p><font size=1 face="sans-serif">11/23/2005 06:01 AM</font>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 \
face="sans-serif">&lt;xalan-j-users@xml.apache.org&gt;</font> <tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Building simple transformations
on document that use XInclude</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Hi all,<br>
I have to build a simple transformation on a document that contain a XIncude<br>
element.<br>
I try using xalan-J-2.7.0 with a batch script like this:<br>
<br>
set<br>
classpath=D:\javatools\xalan_2_7_0\xalan.jar;D:\javatools\xalan_2_7_0\xerces<br>
impl.jar;D:\javatools\xalan_2_7_0\xml-apis.jar<br>
java -cp %classpath% xalan.jar -V -IN inputDoc.xml -XSL<br>
transformation.xsl -OUT outputDoc.html<br>
<br>
(all classpath specification seems correct).<br>
<br>
The piece of input :<br>
...<br>
 &nbsp; &nbsp;&lt;segmentoSQL&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&lt;xi:include href=&quot;D:\myIncludedDocument.txt&quot; parse=&quot;text&quot;<br>
xmlns:xi=&quot;http://www.w3.org/1999/XSL/XInclude&quot;&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &lt;xi:fallback&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Document non found<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;/xi:fallback&gt;<br>
 &nbsp; &nbsp; &nbsp;&lt;/xi:include&gt;<br>
 &nbsp; &nbsp; &lt;/segmentoSQL&gt;<br>
...<br>
and the piece of transformation<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
...<br>
 &nbsp; &nbsp; &lt;xsl:template match=&quot;testresults&quot;&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;xsl:apply-templates
select=&quot;results/failure&quot;/&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;xsl:apply-templates
select=&quot;results/error&quot;/&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;p&gt;Sezione
SQL&lt;/p&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;xsl:value-of
select=&quot;results/segmentoSQL&quot; /&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;p&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&lt;a href=&quot;#overview&quot;&gt;Torna al Riepilogo&lt;/a&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/p&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&lt;/xsl:template&gt;<br>
<br>
As results, first i got the strange version message :<br>
<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Versione Xalan XSLT4J Java 2.5.4, \
&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br> <br>
and then<br>
<br>
I verify that the xi:include statament was totally ignored.<br>
<br>
No other error message.<br>
<br>
I suspect that the xerces parser were not used, nor his xi:include-treatment<br>
is enabled<br>
I know the there are some properties that I can set but I don't know how
to<br>
do this in such a simple batch scenario.<br>
<br>
Can anyone give me a suggest?<br>
Thanks in advance<br>
Vito Caleandro<br>
<br>
</tt></font>
<br>
--=_alternative 0058A6C8852570C2_=--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic