Reputation: 170
I have a variable set as
<set-variable variableName="productIdvar" value="#[xpath://productId]" doc:name="Variable" />
On logging its coming right,
I want to use the value of the variable productIdvar in my xpath expression,
<when expression="//*[local-name()='itemid']=?" evaluator="xpath">
or
<when expression="#[xpath://*[local-name()='itemid']=?]">
What should i use in place of ? to get the value of the variable?
Thanks Rahul.
Upvotes: 0
Views: 3365
Reputation: 8321
You can use XPATH3 and try something like this
#[xpath3('/products/validlity')== flowVars.productIdvar]
Xpath3 reference :- https://developer.mulesoft.com/docs/display/current/XPath
Upvotes: 0
Reputation: 8287
If your MEL gets a bit messy, try my mule-module-dxpath - an XPath transformer which dynamicaly resolves XPath variables.
Upvotes: 0
Reputation: 6697
The following expression should work for you.
<when expression="#[xpath('//*[local-name()=\'itemid\']').text == productIdvar ]">
This way you should be able to compare the result of the xpath with the "productIdVar" variable.
Hope this helps.
Upvotes: 2
Reputation: 4551
<when expression="#[xpath('//*[local-name()=itemid]') == productIdvar ]">
Note that there are no quotation marks surrounding itemid
in expression
Upvotes: 0