通過屬性值的子字串匹配查詢節點(不區分大小寫)

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" />