can Xpath work on non-xml file but having tree-structure in

Can you plz help me solving this confusion?. My question is that I know that Xpath works in conjunction with XSLT. But if I want to use XPath without using XSLT, can I use it on non-xml file i.e file having xml structure but saved as .txt extension? XQuery can take any file as input as long as it has tree structure in it.
Is it true for XPath also?
Thanks in Advance