xpath Find nodes that have a specific attribute Find nodes by substring matching the end of an attribute's value

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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


Got any xpath Question?