How does XPath retrieve everything between two nodes?

<div class="a">
  <div class="b">
  </div>

  

  <div class="d">
  </div>
</div>
Mar.01,2021

suppose the data are as follows:

<div class="a">
  <div class="b">
      text1
  </div>

  

  <div class="d">
      text2
  </div>
</div>

get it through the following xpath:

div[1]//div[contains(text(),"text1")]/following-sibling::node()[position() <= count( div[1]//div[contains(text(),"text2")]/following-sibling::node()) + 1]

try

Menu