You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by chrisdutz <ch...@c-ware.de> on 2012/02/23 18:06:55 UTC

dynamic uri of xsl transformation?

Hi,

this is actually my first day working with camel and I have to admit I
allready love it. Currently I am stuck with one last thing to have my first
camel project up and running.

I have one route that starts by loading xml files from the filesystem. A
processor then adds a client-id to the requests header based on the content
of the xml. 

My customers requirement is that there are some clients that need special
processing. For these customers there should be an xsl transformation with
an uri like this:
"xslt://file:custom-transformations/${headers.gst}/convert.xslt". I have
managed to check if the file exists and to use a different path in that
case. The problem is, that Camel doesn't seem to like dynamic uris ... how
could I manage to achieve this?

Here a shortend version of my route ... 
        <camel:route>
            <camel:from
uri="file:input?move=imported&amp;moveFailed=failed&amp;filter=#xmlInputFilter"/>
            <camel:convertBodyTo type="org.w3c.dom.Document"/>
            
            <camel:process ref="gstDataCsvProcessor"/>
            <camel:choice>
                <camel:when>
                    
                    <method ref="applyCustomTransformationPredicate"/>
                    
                    <camel:to
uri="xslt://file:custom-transformations/${headers.gst}/convert.xslt"/>
                    <camel:to
uri="xslt://file:xslt/ToEasySPED.xslt?contentCache=false"/>
                    <camel:to uri="file:output"/>
                </camel:when>
                <camel:otherwise>
                    <camel:to
uri="xslt://file:xslt/ToEasySPED.xslt?contentCache=false"/>
                    <camel:to uri="file:output"/>
                </camel:otherwise>
            </camel:choice>
        </camel:route>

I would really appreciate some help with this last step.

Chris

--
View this message in context: http://camel.465427.n5.nabble.com/dynamic-uri-of-xsl-transformation-tp5508662p5508662.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: dynamic uri of xsl transformation?

Posted by chrisdutz <ch...@c-ware.de>.
Hi Claus,

thanks for that hint. I have to admit that I allready saw hints on this
while googling around, but I thougt it didn't fit my usecase. Now I tried it
and it works :-) 

Thanks,
    Chris

--
View this message in context: http://camel.465427.n5.nabble.com/dynamic-uri-of-xsl-transformation-tp5508662p5518080.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: dynamic uri of xsl transformation?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Welcome on the Camel ride.

Seems you got pretty far on your first day.

About the dynamic to, then there is a EIP pattern for that. We have
added a FAQ about this at
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html


On Thu, Feb 23, 2012 at 6:06 PM, chrisdutz <ch...@c-ware.de> wrote:
> Hi,
>
> this is actually my first day working with camel and I have to admit I
> allready love it. Currently I am stuck with one last thing to have my first
> camel project up and running.
>
> I have one route that starts by loading xml files from the filesystem. A
> processor then adds a client-id to the requests header based on the content
> of the xml.
>
> My customers requirement is that there are some clients that need special
> processing. For these customers there should be an xsl transformation with
> an uri like this:
> "xslt://file:custom-transformations/${headers.gst}/convert.xslt". I have
> managed to check if the file exists and to use a different path in that
> case. The problem is, that Camel doesn't seem to like dynamic uris ... how
> could I manage to achieve this?
>
> Here a shortend version of my route ...
>        <camel:route>
>            <camel:from
> uri="file:input?move=imported&amp;moveFailed=failed&amp;filter=#xmlInputFilter"/>
>            <camel:convertBodyTo type="org.w3c.dom.Document"/>
>
>            <camel:process ref="gstDataCsvProcessor"/>
>            <camel:choice>
>                <camel:when>
>
>                    <method ref="applyCustomTransformationPredicate"/>
>
>                    <camel:to
> uri="xslt://file:custom-transformations/${headers.gst}/convert.xslt"/>
>                    <camel:to
> uri="xslt://file:xslt/ToEasySPED.xslt?contentCache=false"/>
>                    <camel:to uri="file:output"/>
>                </camel:when>
>                <camel:otherwise>
>                    <camel:to
> uri="xslt://file:xslt/ToEasySPED.xslt?contentCache=false"/>
>                    <camel:to uri="file:output"/>
>                </camel:otherwise>
>            </camel:choice>
>        </camel:route>
>
> I would really appreciate some help with this last step.
>
> Chris
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/dynamic-uri-of-xsl-transformation-tp5508662p5508662.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/