I have some basic knowledge of XPath so yes, no problem to find all h2 tags in a XHTML file assuming they have been created by the pre-processor. I understand now if this is not the case you cannot do anything useful with the build-in filters and XPath expression but rather need some extra preprocessing outside Calibre.
You are absolutely right that ASCII is not well formatted input. Actually my major input format would be PDF but when Calibre fails there I could still use some external pfd2text tools and then modify easily some ASCII Text.
Thus Calibre is not a full fledged end-2-end converter but could only be used as a final step of a longer conversion chain.