xpath Find nodes by substring matching the end of an attribute's value


Example

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')]

or

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

OUTPUT

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