camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r909364 - in /websites/production/camel/content: cache/main.pageCache xslt.html
Date Tue, 20 May 2014 08:17:50 GMT
Author: buildbot
Date: Tue May 20 08:17:50 2014
New Revision: 909364

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/xslt.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/xslt.html
==============================================================================
--- websites/production/camel/content/xslt.html (original)
+++ websites/production/camel/content/xslt.html Tue May 20 08:17:50 2014
@@ -161,7 +161,7 @@ Note: from <strong>Camel 2.9</strong> a 
 </div></div><p>From Camel 2.10.4 onwards we have made this easier as Camel
will use the prefix from the endpoint configuration as the default prefix. So from Camel 2.10.4
onwards you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;xsl:include
href=&quot;staff_template.xsl&quot;/&gt;
 ]]></script>
-</div></div><p>Which will load the staff_template.xsl resource from the
file system, as the endpoint was configured with "file:" as prefix.<br clear="none">
You can still though explicit configure a prefix, and then mix and match. And have both file
and classpath loading. But that would be unusual, as most people either use file or classpath
based resources.</p><h3 id="XSLT-Dynamicstylesheets">Dynamic stylesheets</h3><p><strong>Available
as of Camel 2.9</strong><br clear="none"> Camel provides the <code>CamelXsltResourceUri</code>
header which you can use to define a stylesheet to use instead of what is configured on the
endpoint URI. This allows you to provide a dynamic stylesheet at runtime.</p><h3
id="XSLT-NotesonusingXSLTandJavaVersions">Notes on using XSLT and Java Versions</h3><p>Here
are some observations from Sameer, a Camel user, which he kindly shared with us:</p><blockquote><p>In
case anybody faces issues with the XSLT endpoint please review these points.</p><p>I
was tryi
 ng 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.</p><p>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.</p><p>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):</p><p>1. Use the transformerFactory option in the route <code>("xslt:my-transformer.xsl?transformerFactory=tFactory")</code>
with the <code>tFactory</code> bean having bean defined in the spring context
for <code>class="org.apache.xalan.xsltc.trax.TransformerFactoryImpl"</code>.<br
clear="none"> 2. Added the Xalan jar into my maven pom.</p><p>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.</p><p>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 <code>jre/lib/endorsed</code> directory for the jvm or as specified
by the container.</p><p>Hope this post saves newbie Camel riders some time.</p></blockquote><p></p><h3
id="XSLT-SeeAlso">See Also</h3>
+</div></div><p>Which will load the staff_template.xsl resource from the
file system, as the endpoint was configured with "file:" as prefix.<br clear="none">
You can still though explicit configure a prefix, and then mix and match. And have both file
and classpath loading. But that would be unusual, as most people either use file or classpath
based resources.</p><h3 id="XSLT-Dynamicstylesheets">Dynamic stylesheets</h3><p>To
provide a dynamic stylesheet at runtime you can define a dynamic URI. See&#160;<a shape="rect"
href="how-to-use-a-dynamic-uri-in-to.html">How to use a dynamic URI in to()</a> for
more information.</p><p><strong>Available as of Camel 2.9 (removed in 2.11.4,
2.12.3 and 2.13.0)</strong><br clear="none"> Camel provides the <code>CamelXsltResourceUri</code>
header which you can use to define a stylesheet to use instead of what is configured on the
endpoint URI. This allows you to provide a dynamic stylesheet at runtime.</p><h3
id="XSLT-NotesonusingXSLTandJavaVersions">
 Notes on using XSLT and Java Versions</h3><p>Here are some observations from
Sameer, a Camel user, which he kindly shared with us:</p><blockquote><p>In
case anybody faces issues with the XSLT endpoint please review these points.</p><p>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.</p><p>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.</p><p>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):</p><p>1. Use the transformerFactory option in the route <code>("xslt:my-transformer.xsl?transformerFactory=tFactory")</code>
with the <code>tFactory</code> bean having bean defined in the spring context
for <code>cla
 ss="org.apache.xalan.xsltc.trax.TransformerFactoryImpl"</code>.<br clear="none">
2. Added the Xalan jar into my maven pom.</p><p>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.</p><p>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 <code>jre/lib/endorsed</code> directory for the jvm or as specified
by the container.</p><p>Hope this post saves newbie Camel riders some time.</p></blockquote><p></p><h3
id="XSLT-SeeAlso">See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a
shape="rect" href="component.html">Component</a></li><li><a shape="rect"
href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting
Started</a></li></ul></div>
         </td>
         <td valign="top">



Mime
View raw message