I have multiple tables on a website like so:
<table>
<tr>
<td>Name</td>
<td>foo</td>
</tr>
<tr>
<td>Count</td>
<td>15</td>
</tr>
<tr>
<td>Date</td>
<td>2014-11-17</td>
</tr>
</table>
<table>
<tr>
<td>Name</td>
<td>bar</td>
</tr>
<tr>
<td>Count</td>
<td>42</td>
</tr>
<tr>
<td>Date</td>
<td>2014-12-24</td>
</tr>
</table>
...
I want to receive something like this
foo 15
bar 42
My first attempt in xidel was xidel --xpath "//table/tr[1]/td[2]" --xpath "//table/tr[2]/td[2]"
but this is giving
foo
bar
15
42
How can I extract two values in one line?
Using XPath or XQuery 3.0:
//table/tbody/(tr[1]/td[2] || ' ' || tr[2]/td[2])
. I think you need to request that version explicitly, at least I needed to do so on http://videlibri.sourceforge.net/cgi-bin/xidelcgi. And I parsed as HTML where the parser adds a tbody element and the path needs that too.