camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r898789 - in /websites/production/camel/content: cache/main.pageCache xslt.html
Date Fri, 21 Feb 2014 18:18:45 GMT
Author: buildbot
Date: Fri Feb 21 18:18:44 2014
New Revision: 898789

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 Fri Feb 21 18:18:44 2014
@@ -86,24 +86,10 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="XSLT-XSLT">XSLT</h2>
-
-<p>The <strong>xslt:</strong> component allows you to process a message
using an <a shape="rect" class="external-link" href="http://www.w3.org/TR/xslt" rel="nofollow">XSLT</a>
template. This can be ideal when using <a shape="rect" href="templating.html">Templating</a>
to generate respopnses for requests.</p>
-
-<h3 id="XSLT-URIformat">URI format</h3>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-xslt:templateName[?options]
+<div class="wiki-content maincontent"><h2 id="XSLT-XSLT">XSLT</h2><p>The
<strong>xslt:</strong> component allows you to process a message using an <a
shape="rect" class="external-link" href="http://www.w3.org/TR/xslt" rel="nofollow">XSLT</a>
template. This can be ideal when using <a shape="rect" href="templating.html">Templating</a>
to generate respopnses for requests.</p><h3 id="XSLT-URIformat">URI format</h3><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[xslt:templateName[?options]
 ]]></script>
-</div></div>
-
-<p>Where <strong>templateName</strong> is the classpath-local URI of the
template to invoke; or the complete URL of the remote template. Refer to the <a shape="rect"
class="external-link" href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/core/io/DefaultResourceLoader.html"
rel="nofollow">Spring Documentation for more detail of the URI syntax</a></p>
-
-<p>You can append query options to the URI in the following format, <code>?option=value&amp;option=value&amp;...</code></p>
-
-<p>Here are some example URIs</p>
-<div class="confluenceTableSmall">
+</div></div><p>Where <strong>templateName</strong> is the classpath-local
URI of the template to invoke; or the complete URL of the remote template. Refer to the <a
shape="rect" class="external-link" href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/core/io/DefaultResourceLoader.html"
rel="nofollow">Spring Documentation for more detail of the URI syntax</a></p><p>You
can append query options to the URI in the following format, <code>?option=value&amp;option=value&amp;...</code></p><p>Here
are some example URIs</p><div class="confluenceTableSmall">
 <table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p> URI </p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p> Description </p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> <div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[xslt:com/acme/mytransform.xsl]]></script>
 </div></div> </td><td colspan="1" rowspan="1" class="confluenceTd"><p>
refers to the file com/acme/mytransform.xsl on the classpath </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"> <div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
@@ -111,81 +97,39 @@ xslt:templateName[?options]
 </div></div> </td><td colspan="1" rowspan="1" class="confluenceTd"><p>
refers to the file /foo/bar.xsl </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"> <div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[xslt:http://acme.com/cheese/foo.xsl]]></script>
 </div></div> </td><td colspan="1" rowspan="1" class="confluenceTd"><p>
refers to the remote http resource </p></td></tr></tbody></table>
-</div>
-
-<p>Maven users will need to add the following dependency to their <code>pom.xml</code>
for this component when using <strong>Camel 2.8</strong> or older:</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;dependency&gt;
+</div><p>Maven users will need to add the following dependency to their <code>pom.xml</code>
for this component when using <strong>Camel 2.8</strong> or older:</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;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-spring&lt;/artifactId&gt;
     &lt;version&gt;x.x.x&lt;/version&gt;
     &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
 ]]></script>
-</div></div>
-<p>From Camel 2.9 onwards the <a shape="rect" href="xslt.html">XSLT</a>
component is provided directly in the camel-core.</p>
-
-<h3 id="XSLT-Options">Options</h3>
-<div class="confluenceTableSmall">
+</div></div><p>From Camel 2.9 onwards the <a shape="rect" href="xslt.html">XSLT</a>
component is provided directly in the camel-core.</p><h3 id="XSLT-Options">Options</h3><div
class="confluenceTableSmall">
 <table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p> Name </p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p> Default Value </p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p> Description </p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>converter</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Option
to override default <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/converter/jaxp/XmlConverter.html">XmlConverter</a>.
Will lookup for the converter in the <a shape="rect" href="registry.html" title="Registry">Registry</a>.
The provided converted must be of type org.apache.camel.converter.jaxp.XmlConverter. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>transformerFactory</code>
</p></td><td colspan=
 "1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Option to override default <a
shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/TransformerFactory.html"
rel="nofollow">TransformerFactory</a>. Will lookup for the transformerFactory in
the <a shape="rect" href="registry.html" title="Registry">Registry</a>. The provided
transformer factory must be of type javax.xml.transform.TransformerFactory. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>transformerFactoryClass</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Option
to override default <a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/TransformerFactory.html"
rel="nofollow">TransformerFactory</a>. Will create a TransformerFactoryC
 lass instance and set it to the converter. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>uriResolver</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel
2.3</strong>: Allows you to use a custom <code>javax.xml.transformation.URIResolver</code>.
Camel will by default use its own implementation <code>org.apache.camel.builder.xml.XsltUriResolver</code>
which is capable of loading from classpath. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>resultHandlerFactory</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel
2.3:</strong> Allows you to use a custom <code>org.apache.camel.builder.xml.ResultHandlerFactory</code>
which is capable of using custom <code>org.apache.camel.builder.xml.ResultHandler</code>
types
 . </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
<code>failOnNullBody</code> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> <code>true</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.3:</strong>
Whether or not to throw an exception if the input body is null. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>deleteOutputFile</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel
2.6:</strong> If you have <code>output=file</code> then this option dictates
whether or not the output file should be deleted when the <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a> is done processing. For example suppose the output
file is a temporary file, then it can be a good idea to delete it after use. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <co
 de>output</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>
<code>string</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>
<strong>Camel 2.3:</strong> Option to specify which output type to use. Possible
values are: <code>string, bytes, DOM, file</code>. The first three options are
all in memory based, where as <code>file</code> is streamed directly to a <code>java.io.File</code>.
For <code>file</code> you <strong>must</strong> specify the filename
in the IN header with the key <code>Exchange.XSLT_FILE_NAME</code> which is also
<code>CamelXsltFileName</code>. Also any paths leading to the filename must be
created beforehand, otherwise an exception is thrown at runtime. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>contentCache</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>true</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel
2.6:</strong> Cache for the 
 resource content (the stylesheet file) when it is loaded. If set to <code>false</code>
Camel will reload the stylesheet file on each message processing. This is good for development.
<br clear="none">
-Note: from <strong>Camel 2.9</strong> a cached stylesheet can be forced to reload
at runtime via JMX using the <code>clearCachedStylesheet</code> operation. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>allowStAX</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel
2.8.3/2.9:</strong> Whether to allow using StAX as the <code>javax.xml.transform.Source</code>.
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
<code>transformerCacheSize</code> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> <code>0</code> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> <strong>Camel 2.9.3/2.10.1:</strong>
 The number of <code>javax.xml.transform.Transformer</code> object that are cached
for reuse to avoid calls to <code>Template.newTransformer()</code>. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluen
 ceTd"><p> <code>saxon</code> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11:</strong>
Whether to use Saxon as the <code>transformerFactoryClass</code>. If enabled then
the class <code>net.sf.saxon.TransformerFactoryImpl</code>. You would need to
add Saxon to the classpath. </p></td></tr></tbody></table>
-</div>
-
-<h3 id="XSLT-UsingXSLTendpoints">Using XSLT endpoints</h3>
-
-<p>For example you could use something like</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-from(&quot;activemq:My.Queue&quot;).
+Note: from <strong>Camel 2.9</strong> a cached stylesheet can be forced to reload
at runtime via JMX using the <code>clearCachedStylesheet</code> operation. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>allowStAX</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.8.3/2.9:</strong>
Whether to allow using StAX as the <code>javax.xml.transform.Source</code>. The
option is default <code>false</code> in Camel 2.11.3/2.12.2 or older. And default
<code>true</code> in Camel 2.11.4/2.12.3 onwards. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>transformerCacheSize</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>0</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel
2.9.3/2.10.1:</strong>  The number of <code>javax.xml.transform.Transformer</code>
object that are cached for reu
 se to avoid calls to <code>Template.newTransformer()</code>. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>saxon</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11:</strong>
Whether to use Saxon as the <code>transformerFactoryClass</code>. If enabled then
the class <code>net.sf.saxon.TransformerFactoryImpl</code>. You would need to
add Saxon to the classpath. </p></td></tr></tbody></table>
+</div><h3 id="XSLT-UsingXSLTendpoints">Using XSLT endpoints</h3><p>For
example you could use something like</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[from(&quot;activemq:My.Queue&quot;).
   to(&quot;xslt:com/acme/mytransform.xsl&quot;);
 ]]></script>
-</div></div>
-
-<p>To use an XSLT template to formulate a response for a message for InOut message
exchanges (where there is a <code>JMSReplyTo</code> header).</p>
-
-<p>If you want to use InOnly and consume the message and send it to another destination
you could use the following route:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-from(&quot;activemq:My.Queue&quot;).
+</div></div><p>To use an XSLT template to formulate a response for a message
for InOut message exchanges (where there is a <code>JMSReplyTo</code> header).</p><p>If
you want to use InOnly and consume the message and send it to another destination you could
use the following route:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[from(&quot;activemq:My.Queue&quot;).
   to(&quot;xslt:com/acme/mytransform.xsl&quot;).
   to(&quot;activemq:Another.Queue&quot;);
 ]]></script>
-</div></div>
-
-<h3 id="XSLT-GettingParametersintotheXSLTtoworkwith">Getting Parameters into the XSLT
to work with</h3>
-
-<p>By default, all headers are added as parameters which are available in the XSLT.<br
clear="none">
-To do this you will need to declare the parameter so it is then <em>useable</em>.</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;setHeader headerName=&quot;myParam&quot;&gt;&lt;constant&gt;42&lt;/constant&gt;&lt;/setHeader&gt;
+</div></div><h3 id="XSLT-GettingParametersintotheXSLTtoworkwith">Getting
Parameters into the XSLT to work with</h3><p>By default, all headers are added
as parameters which are available in the XSLT.<br clear="none"> To do this you will
need to declare the parameter so it is then <em>useable</em>.</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;setHeader
headerName=&quot;myParam&quot;&gt;&lt;constant&gt;42&lt;/constant&gt;&lt;/setHeader&gt;
 &lt;to uri=&quot;xslt:MyTransform.xsl&quot;/&gt;
 ]]></script>
-</div></div>
-
-<p>And the XSLT just needs to declare it at the top level for it to be available:</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: ...... &gt;
+</div></div><p>And the XSLT just needs to declare it at the top level for
it to be available:</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:
...... &gt;
 
    &lt;xsl:param name=&quot;myParam&quot;/&gt;
   
     &lt;xsl:template ...&gt;
 ]]></script>
-</div></div>
-
-<h3 id="XSLT-SpringXMLversions">Spring XML versions</h3>
-
-<p>To use the above examples in Spring XML you would use something like</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;camelContext xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;&gt;
+</div></div><h3 id="XSLT-SpringXMLversions">Spring XML versions</h3><p>To
use the above examples in Spring XML you would use something like</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;camelContext xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;&gt;
     &lt;route&gt;
       &lt;from uri=&quot;activemq:My.Queue&quot;/&gt;
       &lt;to uri=&quot;xslt:org/apache/camel/spring/processor/example.xsl&quot;/&gt;
@@ -193,113 +137,31 @@ To do this you will need to declare the 
     &lt;/route&gt;
   &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-<p>There is a <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java">test
case</a> along with <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/XsltTest-context.xml">its
Spring XML</a> if you want a concrete example.</p>
-
-<h3 id="XSLT-Usingxsl:include">Using xsl:include</h3>
-<p><strong>Camel 2.2 or older</strong><br clear="none">
-If you use xsl:include in your XSL files then in Camel 2.2 or older it uses the default <code>javax.xml.transform.URIResolver</code>
which means it can only lookup files from file system, and its does that relative from the
JVM starting folder.</p>
-
-<p>For example this include:</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;
+</div></div><p>There is a <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/XsltTest.java">test
case</a> along with <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/XsltTest-context.xml">its
Spring XML</a> if you want a concrete example.</p><h3 id="XSLT-Usingxsl:include">Using
xsl:include</h3><p><strong>Camel 2.2 or older</strong><br clear="none">
If you use xsl:include in your XSL files then in Camel 2.2 or older it uses the default <code>javax.xml.transform.URIResolver</code>
which means it can only lookup files from file system, and its does that relative from the
JVM starting folder.</p><p>For example this include:</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>Will lookup the <code>staff_tempkalte.xsl</code> file from the starting
folder where the application was started.</p>
-
-<p><strong>Camel 2.3 or newer</strong> <br clear="none">
-Now Camel provides its own implementation of <code>URIResolver</code> which allows
Camel to load included files from the classpath and more intelligent than before.</p>
-
-<p>For example this include:</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;
+</div></div><p>Will lookup the <code>staff_tempkalte.xsl</code>
file from the starting folder where the application was started.</p><p><strong>Camel
2.3 or newer</strong> <br clear="none"> Now Camel provides its own implementation
of <code>URIResolver</code> which allows Camel to load included files from the
classpath and more intelligent than before.</p><p>For example this include:</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>Will now be located relative from the starting endpoint, which for example could
be:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-.to(&quot;xslt:org/apache/camel/component/xslt/staff_include_relative.xsl&quot;)
+</div></div><p>Will now be located relative from the starting endpoint,
which for example could be:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[.to(&quot;xslt:org/apache/camel/component/xslt/staff_include_relative.xsl&quot;)
 ]]></script>
-</div></div>
-
-<p>Which means Camel will locate the file in the <strong>classpath</strong>
as <code>org/apache/camel/component/xslt/staff_template.xsl</code>.<br clear="none">
-This allows you to use xsl include and have xsl files located in the same folder such as
we do in the example <code>org/apache/camel/component/xslt</code>.</p>
-
-<p>You can use the following two prefixes <code>classpath:</code> or <code>file:</code>
to instruct Camel to look either in classpath or file system. If you omit the prefix then
Camel uses the prefix from the endpoint configuration. If that neither has one, then classpath
is assumed.</p>
-
-<p>You can also refer back in the paths such as</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-    &lt;xsl:include href=&quot;../staff_other_template.xsl&quot;/&gt;
+</div></div><p>Which means Camel will locate the file in the <strong>classpath</strong>
as <code>org/apache/camel/component/xslt/staff_template.xsl</code>.<br clear="none">
This allows you to use xsl include and have xsl files located in the same folder such as we
do in the example <code>org/apache/camel/component/xslt</code>.</p><p>You
can use the following two prefixes <code>classpath:</code> or <code>file:</code>
to instruct Camel to look either in classpath or file system. If you omit the prefix then
Camel uses the prefix from the endpoint configuration. If that neither has one, then classpath
is assumed.</p><p>You can also refer back in the paths such as</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
   &lt;xsl:include href=&quot;../staff_other_template.xsl&quot;/&gt;
 ]]></script>
-</div></div>
-
-<p>Which then will resolve the xsl file under <code>org/apache/camel/component</code>.</p>
-
-<h4 id="XSLT-Usingxsl:includeanddefaultprefix">Using xsl:include and default prefix</h4>
-
-<p>When using xsl:include such as: </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;
+</div></div><p>Which then will resolve the xsl file under <code>org/apache/camel/component</code>.</p><h4
id="XSLT-Usingxsl:includeanddefaultprefix">Using xsl:include and default prefix</h4><p>When
using xsl:include such as:</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>Then in Camel 2.10.3 and older, then Camel will use "classpath:" as the default
prefix, and load the resource from the classpath. This works for most cases, but if you configure
the starting resource to load from file, </p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-.to(&quot;xslt:file:etc/xslt/staff_include_relative.xsl&quot;)
-]]></script>
-</div></div>
-<p>.. then you would have to prefix all your includes with "file:" as well.</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;file:staff_template.xsl&quot;/&gt;
+</div></div><p>Then in Camel 2.10.3 and older, then Camel will use "classpath:"
as the default prefix, and load the resource from the classpath. This works for most cases,
but if you configure the starting resource to load from file,</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[.to(&quot;xslt:file:etc/xslt/staff_include_relative.xsl&quot;)
 ]]></script>
-</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;
+</div></div><p>.. then you would have to prefix all your includes with
"file:" as well.</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;file: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 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>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>
-
-<h3 id="XSLT-SeeAlso">See Also</h3>
+</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>
 <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