通过子字符串匹配属性值的末尾来查找节点

XML

<Galaxy>
    <name>Milky Way</name>
    <CelestialObject name="Earth" type="planet"/>
    <CelestialObject name="Sun" type="star"/>
</Galaxy>

XPATH

/Galaxy/*[ends-with(lower-case(@type),'tar')]

要么

//*[ends-with(lower-case(@type),'tar')]

OUTPUT

<CelestialObject name="Sun" type="star" />