# Unable to get a complex XPath expression to work in Mediator

**URL:** <https://techcommunity.softwareag.com/t/unable-to-get-a-complex-xpath-expression-to-work-in-mediator/58560>\
**Category:** Forum\
**Tags:** Former-Crossvision-Products, Service-Orchestrator\
**Created:** [May 24, 2004, 12:31pm UTC](https://techcommunity.softwareag.com/t/unable-to-get-a-complex-xpath-expression-to-work-in-mediator/58560 "2004-05-24T12:31:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![KooKie](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@KooKie](https://techcommunity.softwareag.com/u/KooKie)\
**Post date:** [May 24, 2004, 12:31pm UTC](https://techcommunity.softwareag.com/t/unable-to-get-a-complex-xpath-expression-to-work-in-mediator/58560/1 "2004-05-24T12:31:11Z")

</div>

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\_Requester\>  
\<PRQ\_Req\_Name [email="mrrequester@email.com](mailto:email=%22mrrequester@email.com)"\>Tommy\</PRQ\_Req\_Name\>  
\</PRQ\_Requester\>  
  
60000  
  
  
  
  
  
\</Biz\_Process\>  
=======================================================================  
  
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??  
Thanks.

---

<div class="post-metadata">

**Author:** ![KooKie](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@KooKie](https://techcommunity.softwareag.com/u/KooKie)\
**Post date:** [May 24, 2004, 12:38pm UTC](https://techcommunity.softwareag.com/t/unable-to-get-a-complex-xpath-expression-to-work-in-mediator/58560/2 "2004-05-24T12:38:55Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Mike\_Bernat](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Mike\_Bernat](https://techcommunity.softwareag.com/u/Mike_Bernat)\
**Post date:** [May 24, 2004, 9:50pm UTC](https://techcommunity.softwareag.com/t/unable-to-get-a-complex-xpath-expression-to-work-in-mediator/58560/3 "2004-05-24T21:50:51Z")

</div>

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,  
 Mike

---

<div class="post-metadata">

**Author:** ![KooKie](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@KooKie](https://techcommunity.softwareag.com/u/KooKie)\
**Post date:** [May 25, 2004, 8:42am UTC](https://techcommunity.softwareag.com/t/unable-to-get-a-complex-xpath-expression-to-work-in-mediator/58560/4 "2004-05-25T08:42:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:39pm UTC](https://techcommunity.softwareag.com/t/unable-to-get-a-complex-xpath-expression-to-work-in-mediator/58560/5 "2021-04-02T14:39:20Z")

</div>


