1

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?

4

2 回答 2

1

您可以将 xpath 简化为

boolean(//Payment/Line[IsFeePayment='true' and IsServiceProduct='true'])
于 2009-11-26T04:47:47.153 回答
0

只需在 xpath 表达式周围添加一个 boolean() 我已经解决了问题脸红

所以 ...

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

于 2009-11-26T04:33:57.243 回答