I have a piece of XML like so:
<root>
<foo src=""/>
<foo src="bar"/>
<foo />
</root>
I want to know which elements have a src attribute, which are empty and which have values.
The furthest I have come is with
$ xmlstarlet sel -t -m '//foo' -v @src -n foo.xml
bar
Though that doesn't tell me the third foo is missing the attribute.