titles = hxs.xpath("//table[@class='orders overhaul-services-table']//tr")
for title in titles:
item['year'] = title.xpath('./td[2]/span/text()').extract()
item['organization'] = title.xpath('./td[2]/a/text()').extract()
$html = '<div class="zoomContainer">
<div class="zoomWindow" style="position: absolute; background-image: url(\'/files/images/g_102_734659.jpg\');"/>
</div>';
$doc = new DOMDocument('UTF-8');
$doc->loadHTML($html);
$xpath = new DOMXPath($doc);
$res = $xpath->evaluate('substring-before(substring-after(//div[@class="zoomWindow"]/@style, "background-image: url(\'"), "\')")'); //важно использовать именно evaluate
var_dump($res); // $res - итоговая строка
$results = $xpath->query('//div[@class="example"]'); // тут путь до элемента, внутренности которого нужны
$innerHTML = '';
$children = $results->item(0)->childNodes;
foreach ($children as $child)
$innerHTML .= $results->item(0)->ownerDocument->saveHTML($child);
echo $innerHTML; // тут все внутренности
//div[@class="characteristic" and text()[contains(normalize-space(.), "Серия процессора")]]/following-sibling::div[@class = "value"]
$html = mb_convert_encoding($html, 'HTML-ENTITIES', "UTF-8");
//*[text()[contains(normalize-space(.),"Employment type")]]
//div[contains(@class, "some-class")]/div/span[1]/following-sibling::text()
//div[contains(@class, "some-class")]/div/text()[normalize-space()]
$xml = '<CurrencyRateListAnswer>
<Result>
<Content>
<Item FirstCode="USD" SecondCode="RUB">69.966015</Item>
<Item FirstCode="CNY" SecondCode="KZT">50.799100</Item>
<Item FirstCode="RUB" SecondCode="KZT">4.859019</Item>
<Item FirstCode="USD" SecondCode="KZT">323.777331</Item>
<Item FirstCode="RUB" SecondCode="CNY">0.091096</Item>
<Item FirstCode="USD" SecondCode="CNY">6.070173</Item>
</Content>
</Result>
</CurrencyRateListAnswer>';
$dom = new DOMDocument('UTF-8');
$dom->preserveWhiteSpace = false;
$dom->loadXML($xml);
$xpath = new DOMXPath($dom);
$query = $xpath->query('//Item[@FirstCode="USD" and @SecondCode="KZT"]');
echo $query->item(0)->nodeValue; // 323.777331
//div/strong/following-sibling::text()
$q = $xpath->query('//div/p');
$r = $q->item(0)->nodeValue; // самый первый параграф
preg_match('/\*(.*)/i', $r, $match);
echo trim($match[1]); // результат
$views = $xpath->query('//div[@class="item-views"]');
echo $views->item(0)->nodeValue; // независимо от наличия span тут будет значение