undefinedfix
Sign in

How to use XPath to calculate the number of peer elements in two adjacent nodes?

apoem edited in Fri, 25 Nov 2022

For example:

<h2>Section 1</h2>
<p>xxx</p>
<p>xxx</p>
<p>xxx</p>
<p>xxx</p>
<h2>Section 2</h2>
<p>xxx</p>
<p>xxx</p>
<h2>Section 3</h2>
<p>xxx</p>
<p>xxx</p>
<p>xxx</p>
<p>xxx</p>
<p>xxx</p>

The result to be obtained: [4, 2, 5] is the number of P elements in each section

0 Replies