apache-cameljbossfuseswitchyard

How to set exchange headers from xslt


I am using camel 2.10 version.

I would like to set exchange headers while calling XSLT component. I am able to Get Parameters into the XSLT, but I need to do vice-versa.

Can you please tell how can I achieve it?


Solution

  • You can use xpath to grab something from an XML body and then store that as a header. http://camel.apache.org/xpath

    .setHeader("foo", xpath("/foo/bar"))
    

    The trick is to write the xpath expression so it works. As your XML message uses namespaces you need to use them in the xpath expression also. See that link for more details.