I was trying to parse out text between specific tags on a mac in various html files. I was looking for the first heading in the body. Example:
Try the --html option. Otherwise, xmllint parses your document as XML which is a lot stricter than HTML. Also note that XPath indices are 1-based and that HTML tags are converted to lowercase when parsing. The command
--html
xmllint
xmllint --html --xpath '/html/body/h1[1]' - < Dublin EOF
prints
Dublin