I use xmllint as an external command in VIM editor. When I ran the command below on a buffer containing well-formed xml
%!xmllint --xpath '//a/@href' --encode UTF-8 -
it returned the number of matches that I expected. But as I wanted only the values of href's
I ran the other command that made use of string()
:
%!xmllint --xpath 'string(//a/@href)' --encode UTF-8 -
but I was very surprised to see only the value of the first matched href
. Don't I understand something in XPath or is it a bug?
I can attach the source XML (ca 450 lines) if needed but I think it should be clear from the description that the culprit is somewhere else.