LibraryToggle FramesPrintFeedback

In addition to the standard XPath functions, the XPath language defines additional functions. These additional functions (which are listed in Table 19.4) can be used to access the underlying exchange, to evaluate a simple expression or to look up a property in the Fuse Mediation Router property placeholder component.

For example, the following example uses the in:header() function and the in:body() function to access a head and the body from the underlying exchange:

from("direct:start").choice()
  .when().xpath("in:header('foo') = 'bar'").to("mock:x")
  .when().xpath("in:body() = '<two/>'").to("mock:y")
  .otherwise().to("mock:z");

Notice the similarity between theses functions and the corresponding in:HeaderName or in:body variables. The functions have a slightly different syntax however: in:header('HeaderName') instead of in:HeaderName; and in:body() instead of in:body.

Comments powered by Disqus