-1

I Have following table

<table>
<tbody>
    <tr>
        <td>First Row | First Column</td>
        <td>First Row | Second Column</td>
    </tr>
    <tr>
        <td>Second Row | First Column</td>
        <td>Second Row | Second Column</td>
    </tr>
    <tr>
        <td>Third Row | First Column</td>
        <td>Third Row | Second Column</td>
    </tr>
    <tr>
        <td>Forth Row | First Column</td>
        <td>Forth Row | Second Column</td>
    </tr>
    <tr>
        <td>Fifth Row | First Column</td>
        <td>Fifth Row | Second Column</td>
    </tr>
    <tr>
        <td>Sixth Row | First Column</td>
        <td>Sixth Row | Second Column</td>
    </tr>
</tbody>

I need to use xpath expresion to receive grouped 3 records:

  1. First Row | Second Column, Second Row | Second Column
  2. Third Row | Second Column, Forth Row | Second Column
  3. Fifth Row | Second Column, Sixth Row | Second Column

How I can achive that using only xpath 1.0?

1 Answers1

0

Here you go, xpath expression:

concat(//tr[1]/td[2], ' , ', //tr[2]/td[2], codepoints-to-string(10), //tr[3]/td[2], ' , ', //tr[4]/td[2], codepoints-to-string(10), //tr[5]/td[2], ' , ', //tr[6]/td[2])

The above will return the following string:

First Row | Second Column , Second Row | Second Column
Third Row | Second Column , Forth Row | Second Column
Fifth Row | Second Column , Sixth Row | Second Column
RomanPerekhrest
  • 88,541
  • 4
  • 65
  • 105