tags:

views:

57

answers:

2

Hi,

Using SoapUI (great tool for WS by the way), I have the following xml result :

<code>c</code>
<code>b</code>
<code>a</code>

For this sample above, i would like to test the code value are order asc. Of course, for this sample the test will fail like excepted.

Any solution with xquery or xpath (i can use groovy inside the test if necessary)

Thanks in advance.

+1  A: 

Use (XQuery or XPath 2.0):

not(code[. > following-sibling::code])
Dimitre Novatchev
A: 

Two other ways:

empty(
  for $x at $p in code
  where ($x > code[$p + 1])
  return $x
)

and

deep-equal(for $x in code order by $x return $x/data(.), code/data(.))

But Dimitre's answer seems the cleanest.

Oliver Hallam