html - how to combine two nodes into one group in Xpath? -


i have html this:

<div>     <div class="a">10</div>     <div class="b">11</div>     <div class="a">20</div>     <div class="b">21</div>  </div> 

sometimes use //div[@class="a" or @class="b"] 4 groups: [10, 11, 20, 21].

but time want this, 2 groups: ["10 11", "20 21"], i?

i mean how combine 2 nodes(class a, class b) 1 group?

this working xpath 2.0 solution (running example):

//div[@class="a"]/concat(     text(),      ' ',      string-join((following-sibling::div[@class="b"]/text())[1], '') ) 

i don't think solution xpath 1.0 possible here.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -