Hai folks,

I want to get the secondary people's first names under listing1.
so the result would be Dorothy and Desmond.

I just the below xpath predicate. but not working it seems.

Note: i cant use [last()-1] here. coz there lot of listing like this. i just posted two listing only.

Code:
$result = $xml->xpath('//wp:listing[1]/wp:people/wp:person[wp:rank="secondary"]');


Code:
<wp:listings>
-<wp:listing>
--<wp:people>

---<wp:person wp:rank="primary">
-----<wp:firstname>Harry</wp:firstname>
---</wp:person>

---<wp:person wp:rank="secondary">
----<wp:firstname>Dorothy</wp:firstname>
---</wp:person>

---<wp:person wp:rank="secondary">
----<wp:firstname>Desmond</wp:firstname>
---</wp:person>

--</wp:people>
-</wp:listing>

-<wp:listing>
--<wp:people>

---<wp:person wp:rank="primary">
-----<wp:firstname>John</wp:firstname>
---</wp:person>

---<wp:person wp:rank="secondary">
----<wp:firstname>jancy</wp:firstname>
---</wp:person>

---<wp:person wp:rank="secondary">
----<wp:firstname>jenny</wp:firstname>
---</wp:person>

--</wp:people>
-</wp:listing>
<wp:listings>