private String processXPathValue(Document document, String v, boolean namespaceAware, final List<Variable> contextVariables) {
		if(v.contains(XPATH_EXPR)) {
			String xpathExpr = v.substring(v.indexOf(XPATH_EXPR) + XPATH_EXPR.length(), v.lastIndexOf("}"));
			xpathExpr = VariableHelper.substituteVariables(xpathExpr, contextVariables);
			try {
				final XPath xpath = XFACTORY.newXPath();
				if (namespaceAware) {
					xpath.setNamespaceContext(new UniversalNamespaceCache(document, false));	
				}
				
				final XPathExpression expr = xpath.compile(xpathExpr);

				final Object result = expr.evaluate(document, XPathConstants.NODESET);
				final NodeList nodes = (NodeList) result;
				v = "";
				for (int i = 0; i < nodes.getLength(); i++) {
					if(i != 0) {
						v += " ";
					}
					v += nodes.item(i).getNodeValue();
				}

			} catch (XPathExpressionException e) {
				e.printStackTrace();
			}

		}
		else if(v.contains(XPATH_EVAL)) {
			String xpathEval = v.substring(v.indexOf(XPATH_EVAL) + XPATH_EVAL.length(), v.lastIndexOf("}"));
			xpathEval = VariableHelper.substituteVariables(xpathEval, contextVariables);
			
			try {
				final XPath xpath = XFACTORY.newXPath();
				if (namespaceAware) {
					xpath.setNamespaceContext(new UniversalNamespaceCache(document, false));	
				}
				
				final XPathExpression expr = xpath.compile(xpathEval);

				final Object result = expr.evaluate(document, XPathConstants.STRING);
				v = result.toString();

			} catch (XPathExpressionException e) {
				e.printStackTrace();
			}
		}
		return v;
	}