I'm having the following html code:
<dl>
<dt>1</dt>
<dd>2</dd>
<dt>3</dt>
<dd>4</dd>
<dt>5</dt>
<dd>6</dd>
<dt>7</dt>
<dd>8</dd>
</dl>
Now I want to concatenate each dt
and dd
tag, is that possible with xpath 1.0?
So the results should be:
12
34
56
78
Tried already something like this, but didn't work:
//*/dl[concat(dt/text(), ./following-sibling::node()/text())]
Got it working using python:
content = sel.xpath('//*/dl').extract()
p = re.compile(ur'<dt[^>]*>(.*?)<\/dd[^>]*>')
for s in p.findall(str(prod_specs)):
print BeautifulSoup(s).text