Forum Discussion

dpwest's avatar
dpwest
New Contributor
14 years ago

xpath lookup

I have a response that looks like this with multiple <item>s:

<SomeTitle>
<item>
.
.
<Fund>Test<Fund/>
.
.
<OriginalBudget>12345.0</OriginalBudget>
.
.
</item>

I want to Assert that for fund "Test" the Original Budget = 12345.0. Can xpath assertion do this?

Thanks in advance,

Dpwest

2 Replies

  • dpwest's avatar
    dpwest
    New Contributor
    Looking at this this morning it may not be as clear as it could be.

    There are about 40 <item>s in the response. I want to assert selectively based on the value of <Fund>, Test for example..

    I'm hoping for something like ......./item[indexof(<Fund> = 'Test')]/OriginalBudget = 12345.0.

    Thanks,
  • dpwest's avatar
    dpwest
    New Contributor
    I found it.

    .../item/Fund[text()="Test"]/../OriginalBudget