P
P
piko2015-02-16 17:02:27
XPath
piko, 2015-02-16 17:02:27

How to parse this table using XPath?

UPDATE: solution in comment.
The following is required: if one of the <td> in any <tr> contains the word "Rubles", then it is required to return this <tr> and all subsequent ones that are combined using rowspan. Those. in this case, you need to return 3 rows.
Tried like this:

tr[//td[contains(text(), "Рубли")]]/following-sibling::*

but didn't work.
<table class="rates"> 
  <tbody>
    <tr>
      <th colspan="7">Процентная ставка</th> 
    </tr>  
    <tr>
      <th>Первоначальный взнос</th>
      <th>от 30 до 89 дней</th>
      <th>от 90 до 179 дней</th>
      <th>от 180 до 364 дней</th>
      <th>от 365 до 729 дней</th>
      <th>от 730 до 1115 дней</th>
    </tr>
    <tr>
      <td rowspan="3">Рубли</td>
      <td>от 3 000 до 699 999</td>
      <td>6,50</td>
      <td>7,20</td>
      <td>8,80</td>
      <td>10,30</td>
      <td>10,40</td>
    </tr>
    <tr>
      <td>от 700 000 до 1 499 999</td>
      <td>6,60</td>
      <td>7,30</td>
      <td>8,90</td>
      <td>10,40</td>
      <td>10,50</td>
    </tr>
    <tr>
      <td>от 1 500 000</td>
      <td>6,70</td>
      <td>7,40</td>
      <td>9,00</td>
      <td>10,50</td>
      <td>10,60</td>
    </tr>
    <tr>
      <td>Доллары США</td>
      <td>от 100</td>
      <td>3,30</td>
      <td>3,75</td>
      <td>4,15</td>
      <td>4,80</td>
      <td>4,95</td>
    </tr>
  <tr>
      <td>Евро</td>
      <td>от 100</td>
      <td>2,80</td>
      <td>3,25</td>
      <td>3,65</td>
      <td>4,30</td>
      <td>4,45</td>
    </tr> 
  </tbody>
</table>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2015-02-16
@piko

//tr[td[text()="Рубли"]]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question