XML : How can I get the text from an element using its attribute in a xpath expression?

I'm new around here and after searching a lot I still have a doubt about how to make a xpath expression. Here's the XML code:

      <perfil>          <person idP="P1">              <studied refidEs="Es3"/>      .      .      .        <schools>          <school idEs="Es3">              <name>Name of the school</name>          </school>    

In the beggining of the document I have a reference made to a certain school, and in the end I have the name of the school with its proper id. In the xpath expression, I have to mention what's in the beggining (e.g. perfil/person/studied[@refidEs]), and I want it to show the name of the school. The thing is that, when I use the expression on the example, it only shows the id of the school. Even if I end with /text(), it shows no results.

Appreciate all the help you can give :)

No comments:

Post a Comment