通过属性值的子字符串匹配查找节点(不区分大小写)

XML

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

XPATH

/Galaxy/*[contains(lower-case(@name),'ear')]

要么

//*[contains(lower-case(@name),'ear')]

或者,用双引号中的字符串:

//*[contains(lower-case(@name), "ear")]

OUTPUT

<CelestialObject name="Earth" type="planet" />