upvote
> the tags as they are in the file

Is not actually relevant and is not an information the average XML processor even receives. If the file uses a default namespace (xmlns), then the elements are namespaced, and anything processing the XML has to either properly handle namespaces or explicitly ignore namespaces.

> A lot of XML is ad-hoc without a namespace defined anywhere

If the element is not namespaced xpath does not require a prefix, you just write

    //bookstore/book/title
reply
I don't recall ever needing to do that for unnamespaced tags. Are you sure the issue you're having isn't that the tags have a namespace?

my:book is a different thing from your:book and you generally don't want to accidentally match on both. Keeping them separate is the entire point of namespaces. Same as in any programming language.

reply
Newer versions of XPath and XSLT allow

    /*:bookstore/*:book/*:title
reply