知道如何从这里获取/includes/images/large/BW93942/hermes-swift-retourne-kelly-32-indigo-1.jpg吗?
/<img class="cloudzoom-gallery img-responsive cloudzoom-gallery-active" src="/includes/images/thumb/BW93942/xhermes-swift-retourne-kelly-32-indigo-1.jpg.pagespeed.ic.PQKVquZdzC.webp" data-cloudzoom="useZoom: '.cloudzoom', image: '/includes/images/BW93942/hermes-swift-retourne-kelly-32-indigo-1.jpg', zoomImage: '*/includes/images/large/BW93942/hermes-swift-retourne-kelly-32-indigo-1.jpg*' " pagespeed_url_hash="271624911" onload="pagespeed.CriticalImages.checkImageForCriticality(this);">
答案 0 :(得分:0)
尝试下面
//img/@src
OR
//img[@class='cloudzoom-gallery img-responsive cloudzoom-gallery-active']/@src
希望它会对你有所帮助:)。
答案 1 :(得分:0)
您可以使用XPath字符串函数substring-before
来获取@src
之前的.pagespeed
属性部分。应用您发布的HTML时,XPath
substring-before(//img[@class="cloudzoom-gallery img-responsive cloudzoom-gallery-active"]/@src, ".pagespeed")
产量
/includes/images/thumb/BW93942/xhermes-swift-retourne-kelly-32-indigo-1.jpg