Vivekananda Athukuri
Vivekananda Athukuri

Reputation: 351

How to group two nodes which are not related in xpath?

I have html structure like this:

<a>
  <c>
  </c>
</a>
<b>
  <d>
  </d>
</b>

<a>
  <c>
  </c>
</a>
<b>
  <d>
  </d>
</b>

How do I group node 'a' and node 'b' together? The xpath should be able to select the pairs of node 'a' and 'b'. The nodes have auto generated id's and name's so I can't use them in xpath.

Upvotes: 0

Views: 100

Answers (1)

choroba
choroba

Reputation: 241968

You can use the | operator for two unrelated XPath Expressions:

 (//a | //b)

Upvotes: 1

Related Questions