Re: [xml] One question about XPath



MANU_TA wrote:
Hello Daniel,

I have a question about XPath.

Let's supposed we have the following xml doc:

<main>

 <label_1>
  <sublabel_1>value1</sublabel_1>
  <sublabel_2>response1</sublabel_2>
 </label_1>

 <label_1>
  <sublabel_1>value2</sublabel_1>
  <sublabel_2>response2</sublabel_2>
 </label_1>

 <label_1>
  <sublabel_1>value3</sublabel_1>
  <sublabel_2>response3</sublabel_2>
 </label_1>

</main>

- My question is: Can I use XPath in order to obtain the <sublabel_2> value (responseX) from <sublabel_1> value (valueX)?. - Could you tell me what XPath "expresion" I have to use, please?

/main/label_1[sublabel_1='value1']/sublabel_2


Regards,
                Stefan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]