public static XPath getXPath(String path,
Map<String, String> namespaces,
Map<QName, Function> functions,
Map<QName, Object> variables) throws JaxenException {
DocumentNavigator nav = new DocumentNavigator();
XPath contextpath = new BaseXPath(path, nav);
if (namespaces != null) {
for (Map.Entry<String, String> entry : namespaces.entrySet()) {
contextpath.addNamespace(entry.getKey(), entry.getValue());
}