I want to select a set of elements as nodes (the content of div[@class="Adres"]
):
<div class="KolumnaStyl">
<div class="Nazwa">ABCD</div>
<div class="Adres">
12-345 Warszawa
<br/>
ul. Krasnobrodzka 5
<br/>
Mazowieckie
This can be done with:
//div[@class="KolumnaStyl"]/div[@class="Adres"]/node()
As it happens, there are two identical div[@class="Adres"]
on the page, which means that node()
currently selects the content of both of them. I can't, however, call //div[@class="KolumnaStyl"][1]
- that doesn't select the first occurrence.
How can I select a unique set of nodes if the parent directory exists multiple times?