You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sameer Nambiar <sa...@nambiar.net> on 2009/06/17 11:25:49 UTC

XSLT endpoint usage notes.

Hi,

In case anybody faces issues with the XSLT endpoint please review these
points.

I was trying to use an xslt endpoint for a simple transformation from one
xml to another using a simple xsl. The output xml kept appearing (after the
xslt processor in the route) with outermost xml tag with no content within.

No explanations show up in the DEBUG logs. On the TRACE logs however I did
find some error/warning indicating that the XMLConverter bean could no be
initialized.

After a few hours of cranking my mind, I had to do the following to get it
to work (thanks to some posts on the users forum that gave some clue):

1. Use the transformerFactory option in the route
("xslt:my-transformer.xsl?transformerFactory=tFactory") with the tFactory
bean having bean defined in the spring context for
class="org.apache.xalan.xsltc.trax.TransformerFactoryImpl".
2. Added the Xalan jar into my maven pom.

My guess is that the default xml parsing mechanism supplied within the JDK
(I am using 1.6.0_03) does not work right in this context and does not throw
up any error either. When I switched to Xalan this way it works. This is not
a Camel issue, but might need a mention on the xslt component page.

Another note, jdk 1.6.0_03 ships with JAXB 2.0 while Camel needs 2.1. One
workaround is to add the 2.1 jar to the jre/lib/endorsed directory for the
jvm or as specified by the container.

Hope this post saves newbie Camel riders some time.

Thanks,
Sameer.
-- 
View this message in context: http://www.nabble.com/XSLT-endpoint-usage-notes.-tp24069975p24069975.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: XSLT endpoint usage notes.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Thanks a lot Sameer.

I have added your notes to the XSLT wiki page so others will notice them
when they start using this component.
Yeah the JDK6 is bad with its JAXB and XSTL bundling in the rt.jar. A pain
to get working if you want to use others than provided in there. Bad Sun.


On Wed, Jun 17, 2009 at 11:25 AM, Sameer Nambiar <sa...@nambiar.net> wrote:

>
> Hi,
>
> In case anybody faces issues with the XSLT endpoint please review these
> points.
>
> I was trying to use an xslt endpoint for a simple transformation from one
> xml to another using a simple xsl. The output xml kept appearing (after the
> xslt processor in the route) with outermost xml tag with no content within.
>
> No explanations show up in the DEBUG logs. On the TRACE logs however I did
> find some error/warning indicating that the XMLConverter bean could no be
> initialized.
>
> After a few hours of cranking my mind, I had to do the following to get it
> to work (thanks to some posts on the users forum that gave some clue):
>
> 1. Use the transformerFactory option in the route
> ("xslt:my-transformer.xsl?transformerFactory=tFactory") with the tFactory
> bean having bean defined in the spring context for
> class="org.apache.xalan.xsltc.trax.TransformerFactoryImpl".
> 2. Added the Xalan jar into my maven pom.
>
> My guess is that the default xml parsing mechanism supplied within the JDK
> (I am using 1.6.0_03) does not work right in this context and does not
> throw
> up any error either. When I switched to Xalan this way it works. This is
> not
> a Camel issue, but might need a mention on the xslt component page.
>
> Another note, jdk 1.6.0_03 ships with JAXB 2.0 while Camel needs 2.1. One
> workaround is to add the 2.1 jar to the jre/lib/endorsed directory for the
> jvm or as specified by the container.
>
> Hope this post saves newbie Camel riders some time.
>
> Thanks,
> Sameer.
> --
> View this message in context:
> http://www.nabble.com/XSLT-endpoint-usage-notes.-tp24069975p24069975.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus