I was trying to pull some data out of an XML file using xmlstarlet, but
xmlstarlet sel -t -v '//div[contains(@class,'addresses')]/a'
was getting me a lot more than I expected.
I finally worked out - with the help of replacing -v with -c to debug the xpath - that it was because the single quotes around 'addresses' were vanishing because the whole argument is single-quoted: replacing that with "addresses" worked as expected.
What I'm really confused about is quite what contains(@class,addresses) does - because xmlstarlet didn't flag it as an error or warn about it, even though I presume it's treated as an undefined variable.
I checked the source in https://github.com/fishjam/xmlstarlet/blob/master/src/xml_select.c but I can't spot a 'warnings' flag - should there be something like that, or are xpaths defined to allow this?