用于从样式标记解析背景图像URL的Xpath

时间:2017-08-30 22:55:59

标签: xpath

<div class="card-image" style="background-image: url("https://cdn6.bigcommerce.com/s-0kvv9/images/stencil/500x659/products/170691/242554/dicemastgreenflash__36803.1503934716.jpg?c=2");">
</div>

当我输入时,

.//*[@class='card-image']/@style

它返回:

background-image:url('https://cdn6.bigcommerce.com/s-0kvv9/images/stencil/500x659/products/170691/242554/dicemastgreenflash__36803.1503934716.jpg?c=2');

我只想让它返回网址。

1 个答案:

答案 0 :(得分:1)

这个XPath,

SELECT * from testimonials WHERE score > 8 OR (source = 'source2' AND score > 3) ORDER BY rand()

将根据要求仅选择URL。