Unable to get a complex XPath expression to work in Mediator

Hi. I had a problem in Mediator 7.3.1 in getting a complex XPath expression to work.

I have this source XML doc.

<Biz_Process ProcessID=“PRQ”>
<PRQ_Req_Name email="mrrequester@email.com">Tommy</PRQ_Req_Name>



I have this EMail component in my sequence as below

My original XPath expression for the “xbd.mail.to” property is
{/Biz_Process/Approval/Manager[(@ApprAmt >= …/…/Product/Amount) and (@ApprAmt < …/Manager/@ApprAmt)]/@email}
and I know this expression works in the Xpath tester.

But seems like Mediator changes the “>” to the entity > and “<” to entity < in my Xpath expression, thus causing it not to work. If I change the respective entities back to “>” or “<” in my sequence file, mediator will complain that it’s not a wellform sequence file.

May I know how to solve this problem??

Ok, seems like this forum also rewrite my “greater than” and “less than” entity notations.

Wat I mean is that mediator changes my > to “& g t ;” (without spaces & quotes)

Hi KooKie,

First, the Mediator Studio will change any greater/less symbols into their appropriate entities to allow the XML to be property parsed.

When I use this expression in the xpath tester, I get 0 nodes selected. The expression seems a little strange, due to the second part of the “and” clause. If I leave out that part, I get one node selected, which proves that the issue is not a misinterpretation of the “<”. The second part of the “and” is:

(@ApprAmt < …/Manager/@ApprAmt)

This is weird, because “…/Manager/@ApprAmt” selects two nodes, and the integer value of a node set of two is the value of the first node (here 100000). But the first part of the “and” is:

(@ApprAmt >= …/…/Product/Amount)

This selects the first attribute node for @ApprAmt, which is the attribute whose value is 100000.

The expression is saying is "select all Manager/@email nodes such that the value of @ApprAmt is > 60000, which is the one whose value is 100000. But the second part of the “and” selects the first @ApprAmt (due to the way node sets are evaluated), which is the attribute with value 100000. So there is no way 100000 can be less than 100000!

Perhaps I am misinterpreting things, but this seems like a user error. Perhaps you can clarify what the intent of the xpath is.

Best regards,

Hi Mike. Thanks for your help. Me bad. Indeed it’s the XPath error, thus it’ll return zero value to the xbd.mail.to property, causing it to return a HTTP 500 error. Because the error points to the xbd.mail.to property, I thought the changing of “>” to “& g t ;”(w/o spaces) causes the problem. ( Cuz in xsl stylesheets, they dun change the > and < to the entity notations)

I had since change the XPath statement, and now it works fine. Thanks again.