camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weather99 <>
Subject RE: camel xslt 2.0 support
Date Tue, 26 Jun 2012 19:38:18 GMT
O.K.  I created an OSGI bundle which wrapped Saxon’s TransformerFactoryImpl class.  In the
OSGI implementation, I included the class files expanded from the saxhon9he jar.

I got the same result.  I was not able to set Camel’s transformerFactory or transformerFactoryClass
to my implementation any better than I was able to point it to the servicemix-saxon or camel-saxon
bundles.  There are no errors, but the result is that the converted message has a prolog and
nothing else.  This is the same effect I get in standalone camel (2.9.0) if I have a xalan
jar file anywhere on my build path.

If you have this working, may I ask what version of Camel and Servicemix you are using, and
whether or not you have a xalan-2.7.1 jar in ./lib/endorsed/ ?


From: Nowakowski, Mateusz-2 [via Camel] []
Sent: Sunday, June 24, 2012 7:34 AM
To: Fleishaker, Frank
Subject: RE: camel xslt 2.0 support

> I made the following change to ./etc/

I don't recommend changing ./etc/ to Saxon because it won't work honestly.

Saxon (xslt2 implementation) is a bundle and is loaded just before camel-saxon but it doesn't
 "javax.xml.transform.TransformerFactory" won't see saxon because it is on system classloader
and system classloader don't see bundles classloaders.

The only proper way to use saxon is to ... create net.sf.saxon.TransformerFactoryImpl myself
 in the blueprint/or spring dm and provide it via "transformerFactory" parameter in camel.
Secondly when you use Saxon you need to be aware: that saxon works better when you work on
Saxon data format (NodeInfo/DocumentInfo) and your all xslts use the same Saxon transformer
factory instance.
So in my app I have one bundle which exports transformer factory OSGI service and I inject
the same service instance where I need.
(I have own Camel xslt and xpaths endpoint as well, because Camel one doesn't support working
on Saxon native data format and  so you can consider having own xslt/xpath camel endpoint
as well and solve this issue there).

PS. You can try to.. copy  Saxon jar to ./lib
But there is nice readme.txt:

"This directory is the standard Java classpath directory.
Any jar in this folder will be part of the main classloader used to load Karaf.
However, in OSGi, classes defined in these jars won't be available to other
bundles unless one of the org.osgi.framework.system.packages.extra or
org.osgi.framework.bootdelegation properties in the etc/ file
is modified to export or delegate the packages.
Please refer to the OSGi Core Specification for more information on these
properties and the OSGi classloading mechanism."

But I don't recommend touching this dir until it is your last resort, because this is a hack
and you can't control how the rest smx bundles are configured.

Mateusz Nowakowski

-----Original Message-----
From: Claus Ibsen [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=5714988&i=0>]
Sent: Sunday, June 24, 2012 09:49
To: [hidden email]</user/SendEmail.jtp?type=node&node=5714988&i=1>
Subject: Re: camel xslt 2.0 support


You can try upgrading SMX.

On Fri, Jun 22, 2012 at 6:46 PM, weather99 <[hidden email]</user/SendEmail.jtp?type=node&node=5714988&i=2>>

> I tried installing camel-saxon but got the same results.
> I made the following change to ./etc/
> #javax.xml.transform.TransformerFactory=org.apache.xalan.processor.Tra
> nsformerFactoryImpl
> javax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactory
> Impl
> This also had no effect.  I'm still at the same place.  My camel xslt
> 2.0 transform returns prolog only.  When using a bean xslt 2.0
> transformer the bean returns errors for xslt 2.0 tags.  Removing the
> xalan-2.7.1.jar from ./ib/endorsed causes my route to fail to load.
> I have no problem getting this to work in standalone Camel.  I have
> been able to duplicate the problem in standalone Camel by putting a
> xalan jar file on my classpath.  In that case, the Camel xslt
> transformer gives me a prolog only.
> --
> View this message in context:
> 4932.html Sent from the Camel - Users mailing list archive at

Claus Ibsen
Email: [hidden email]</user/SendEmail.jtp?type=node&node=5714988&i=3>
Twitter: davsclaus, fusenews
Author of Camel in Action:

If you reply to this email, your message will be added to the discussion below:
To unsubscribe from camel xslt 2.0 support, click here<>.

View this message in context:
Sent from the Camel - Users mailing list archive at
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message