Demo: inspect sitemap URLs with XPath
XPath is useful for XML sitemaps, but namespaces and repeated url nodes can make quick checks error-prone. Preview the match list before turning an expression into a script.
- Use local-name() when namespace handling is uncertain.
- Avoid positional indexes until you know the URL order is stable.
- Check both loc and lastmod when reviewing sitemap quality.
//*[local-name()="url"]/*[local-name()="loc"]/text()
---
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://example.com/en</loc><lastmod>2026-06-18</lastmod></url>
</urlset>