The widespread adoption of XML has motivated the development of new languages and tools geared toward XML processing. XPath, the most ubiquitous of XML-related languages, is used as a sub-language for tasks like XML querying, transformation, constraint specification, web service composition, etc.

The use of XPath expressions in a large variety of computer languages (such as XSLT, XQuery, BPEL, Schema, XJ, SQL extensions, etc.) motivates the interest of a large population of developers in learning how to use the language. To make matters more interesting, in most cases (XQuery being the obvious exception) XPath is not the "native language" of these developers. Providing explanations of why XPath expressions return specific answers is a compelling approach to facilitate understanding (and debugging) XPath applications.

In this project we introduce the concept of explanation queries to address the developer needs described above. Given an XPath expression, we define a new language, XPlainer, that relies on visual explanations to describe why the given XPath expression returns a sequence of selected nodes from an input XML document. The explanation provided displays all the intermediate nodes that contribute to the result of the XPath expression. While this is an intuitive notion, we show how providing explanations for arbitrarily complex expressions while supporting all the constructs in the XPath language is a non trivial task.