You may find
A Brief Introduction to XPath 2.0 helpful as a starting point for working with XPath expressions in mashups. You can also create your own custom XPath functions to use in expressions. See
Defining Custom XPath Functions for information.
In addition, expressions can be dynamic in mashups. You can use
Dynamic Mashup Expressions directly in XPath. Or, use
Dynamic XPath or Other Syntax in Mashups to pass dynamic portions of XPath as parameters. Finally, see
Using XQuery Expressions in Construction Statements for information on dynamic expressions that you use to help construct the mashup result or intermediate variables.