Possibly nothing is more annoying to write and debug than complex XPath statements. There are some good editors out there, but it is tricky at best. One of my favorite aids in my XPath struggles is a little tool called XPath Visualizer from TopXML. It lets one write ad-hoc XSL queries against a sample document and then visually highlights the results. Which is a very handy trick when one is staring 1500 lines of XSL and wondering why some query is failing miserably. Now, this tool does have its annoyances—mainly a dependence on Internet Explorer and a rather primitive interface. I would much rather play with my XPath in nice, clean, Visual Studio 2005.
Enter the Mvp.Xml project—a group of Microsoft Xml MVPs helping to supplement Xml support in the .NET framework. And possibly the coolest thing they have cooked up to date is XPathmania. Authored by Don Demsak, aka DonXML, This is a Visual Studio 2005 extension which lets a user write ad-hoc XPath queries and highlights the selected nodes, much like the above tool. But it lives within Visual Studio 2005—making it much more convenient and leaving lots of room for growth.
You can get Release Candidate 1.1 of the tool (or the source code) from the MvpXml workspace on CodePlex. Note that it is a Visual Studio add-in, and as such will not work with the Express Editions. Enjoy and happy visual XPathing.