I'm trying to do xpath expression from string literal. I create my xpath from some variables so I can't precalculate them. I end up with sth like this:
count(concat("//sales:", "$variable", "Available"))
and it results in an error:
Can not convert #STRING to a NodeList!
I think it would suffice if I could somehow evaluate() the result of concat so it would become the actual NodeList. Is there an appropriate function to do this?
I'm doing this text manipulation in Apache Camel, but it's not so important IMO.
EDITED:
To be more precise: Apache Camel works as a pipeline, XMLs go through it and you can process those XMLs in some ways - like impose some rules based on XMLs content or structure. That is why I need this to be dynamic.
My situation looks like this:
- look at the xml and get the content of element operationName
- search in some other document for an element that is constructed from the lower-cased operationName and string literal 'Available'
So if my operationName is FOOBAR, than I want to check for the existence of node //sales:foobarAvailable