使用 xPath 查找文本包含"en"的所有元素:


<svg width="400" height="550">
<g style="enable-background:new"> 
<rect x="40" y="20" width="300" height="450" style="fill:url(#MyGradient)" />     <g style="font-size:75px;fill:#888888;fill-opacity:.6"> 
<text x="50" y="90" filter="url(#normal)">Normal</text> 
<text x="50" y="180" filter="url(#multiply)">Multiply</text> 
<text x="50" y="270" filter="url(#screen)">Screen</text> 
<text x="50" y="360" filter="url(#darken)">Darken</text> 
<text x="50" y="450" filter="url(#lighten)">Lighten</text> 
</g>
</g>  
</svg>
//text[contains(text(), 'en')]

这个 xpath 给了我以下结果。

'<text filter="url(#screen)" x="50" y="270">Screen</text>'
'<text filter="url(#darken)" x="50" y="360">Darken</text>'
'<text filter="url(#lighten)" x="50" y="450">Lighten</text>'

最新更新