This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] java 1.5 and xsltc and endorsed stuff.
comments inline:-
Wendy Smoak wrote:
From: "David Tolpin" <dvd@davidashen.net>
The problem arises when it is called through JAXP — it then uses what
javax.xml.transform.TransformerFactory returns, and the
TransformerFactory itself is, naturally, the first one found in
CLASSPATH.
How to put Xalan's or Saxon's (6.5.3) TransformerFactory before the
built-in xsltc, I don't know.
I did convince Java 1.5 to use a replacement xalan.jar file by placing
it in $JRE_HOME/lib/endorsed. (I had to create the 'endorsed' directory.)
basically this puts xalan on the classpath, but not in the "official" way:-
endorsed = override classes already in the JVM, like SAX or DOM
extension = add classes to the JVM, thus don't have to put them in the
claspath
classpath = per execution variable
so there are three ways of using xalan in 1.5, isn't Sun great :-)
Another way to override the default behavior is to use a tool like Ant
that lets you specify the classpath it should use to find the XSLT
processor. After some false starts, the Ant xslt (or style) task is
working when told to use saxon.jar or xalan.jar. This method probably
involves a custom ClassLoader, though I haven't looked at the Ant source
code to confirm.
yes, <xslt> will try to find the first implementation on the classpath
it's given, which can be done in a huge number of ways, the ant manual
can explain this
however this logic is a royal pain the arse, a test I've just done by
using:-
<xsl:message>
<xsl:value-of select="system-property('xsl:vendor')"/>
</xsl:message>
confirms that the default on jdk 1.5 is xalan's compiler (which can't
deal with the current docbook scripts), that putting saxon.jar on
ANT_HOME/lib doesn't work when it should and that putting both xalan and
saxon on the tasks's classpath in the build script makes the task choose
the first one (swap them round and the output changes accordingly)
it's always been this messy, so i just use <java> and saxon's command
line, sure a little more work in the build script but so much less
hassle (and a better xslt processor to boot :-)
Ian