首页 > 解决方案 > Xidel:如何打印出节点而不是值?

问题描述

html示例:

<p class="si-price" data-price="910000.00">Rp 910.000</p>

所以在xidel,我这样做:

xidel -se '(//p[@class="si-price"])[1]' 'https://www.anekalogam.co.id/id'

我想要的910000是在data-price而不是Rp 910.000

我可以这样做吗?

标签: xpathxidel

解决方案


Try changing it to:

xidel -se '(//p[@class="si-price"])/@data-price' 'https://www.anekalogam.co.id/id'

Output:

905000.00
1750000.00
2595000.00
4300000.00
8550000.00
21250000.00
42400000.00
84000000.00

推荐阅读