How to set exchange headers from xslt

537 Views Asked by At

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?

1

There are 1 best solutions below

0
Ankush soni On BEST ANSWER

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.