Earlier quoted context omitted.
> In every single task I do that involves munching on XML with xpath And more generally that's true of every single task involving muching on namespaced XML. Namespaces are a good idea implemented absolutely terribly. XPath is a good idea well-implemented (no, XPath 2 does not exist, there is only one XPath). One of the few I've found in XML-land. I still hate that we have to use CSS selectors rather than XPath (alth…
> Also, that might have finally gotten us a non-eye-stabbing standard function for "match any item of a space-separated list in an attribute" CSS handles this rather nicely: [class~=foo] https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_s...
[contains(concat(' ', normalize-space(@class), ' '), ' foo ')]
the normalize-space can be dropped IIF you're certain all spaces are normalized, the spaces around the needle not.xpath 2 does quite a bit better through `tokenize`:
//*[tokenize(@class, '\s+')='foo']
but still not great. And god forbid you need to match multiple classes in the same selector.[0] or xpath 1 + exslt if your xpath implementation provides it. exslt actually does slightly better as the pattern is optional and defaults to whitespace characters