1
votes

I have the following Xml structure; Payment/Line which has amongst its element a IsFeePayment and a IsServiceProduct elements of type bool.

<Payment>
   <Line>
      <IsFeePayment>true</IsFeePayment>
       <ISServiceProduct>true</IsServiceProduct>    
   </Line>
 </Payment>

i want an xpath statement that returns 'true' when both of these are are they are, true. if either one is false, i want the xpath statement to return 'false'

THe xpath below is almost there, it returns the line when both are true.

/[local-name()='Payment']/[local-name()='Line'][*[local-name()='IsFeePayment'][text()='true'] and *[local-name()='IsServiceProduct'][text()='true']]

how do i just get a simple bool out instead of the whole element?

2
essentially the same question as stackoverflow.com/questions/1460028/…bignose

2 Answers

1
votes

You can simplify the xpath to

boolean(//Payment/Line[IsFeePayment='true' and IsServiceProduct='true'])
0
votes

simply adding a boolean() around the xpath expression i already had fixes the problem blush

so ...

boolean(/[local-name()='Payment']/[local-name()='Line'][*[local-name()='IsFeePayment'][text()='true'] and *[local-name()='IsServiceProduct'][text()='true']])