I'm using xpath to perform searches on an xml document (document 1) based on the elements present in a second xml document (document 2).
There is a one to many relationship between the two documents so that an element in the second xml document may match many in document 1.
So the xpath search may return a nodeset of many elements.
What i then want to do is be able to carry on searching from those returned nodes recursively.
But i want the xpath search to be only relevant from the individual nodes.
eg first search : /root/foo
then for each foo:
/root/foo[x]/bar
to return all bars in foo[x]
...
trouble is php's xpath doesn't seem to except square bracket to identify a subtree of the xml document and you can't seem to be able to create a new xpath_new_context of child elements of the xml document.
Is it possible, then, to create a new xpath query of an xml subtree returned from a previous xpath query, limiting the results exclusively to those in that subtree?
I can't seem to find any documentation in my php+xml books that refers to this.
(sorry if this doesn't makes sense or seems rushed, it is. i wanted to get this posted before i leave work and someones waiting in the car for me 🙂)
Thanks anyway for any help you can offer.
best,
ed_