I have defined a header in my route and want to use the value of the header to determine the other header value.
Example:
<route id="use_reference_number">
<from uri="direct:file_name:use_reference_number">
<setHeader headerName="FirstNameOfStudent">
<xpath resultType="java.lang.String">//*/Student/StudentName/FirstName/text()</xpath>
</setHeader>
<setHeader headerName="NumberOfStudentByThatName">
<xpath>count(//*/Student[StudentName/FirstName/text() = ${in.header.FirstNameOfStudent}])</xpath>
</setHeader>
</route>
Basically here based on the result from separate x path I want to determine the count of students tags in second one and finally using "NumberOfStudentByThatName" in choice - when to take separate routes. but when I use this expression it returns 0. I think it is not able to resolve the header.
<setHeader headerName="NumberOfStudentByThatName">
<xpath>count(//*/Student[StudentName/FirstName/text() = 'AMAN'])</xpath>
</setHeader>
When I use it like above it works perfectly fine , but I don't want to hard code any value instead use what is in the input .
In this case I have two separate xmls and want to use them in cleaner way.