code: public static void evaluatePhrases(Node n, Grammar g, TaskRequest req, TaskResponse res) {
  
  		// Assertions...
  		if (n == null) {
  			String msg = "Argument 'n [Node]' cannot be null.";
  			throw new IllegalArgumentException(msg);
  		}
  		if (g == null) {
  			String msg = "Argument 'g [Grammar]' cannot be null.";
  			throw new IllegalArgumentException(msg);
  		}
  
  		if (n instanceof Branch) {
  			((Branch) n).normalize();
  		}
  
  		final XPath xpath = XPATH_LOCAL.get();
  		for (Iterator<?> it = xpath.selectNodes(n).iterator(); it.hasNext();) {
  			Node d =  (Node) it.next();
  			if (d.getText().trim().length() != 0) {
  				Phrase p = g.newPhrase(d);
  				Object o = p.evaluate(req, res);
  				String value = o != null ? o.toString() : "null";
  				d.setText(value);
  			}
  		}
  
  	}
docs: /*
  Public API.