I managed to crunch some stuff out this morning. Stitch now has the ability to identify and replace content by tag name. so, and html file:
<html>
<body>
<p class=”user”>John Doe</p>
</body>
</html>
and a stitch rule file:
p{
content:$userName;
}
Running the template like so:
Template t = new Template(html, rules);
Map data = new HashMap();
data.put(”userName”, “Snoopy”);
String out = t.render(data);
“out” would be:
<html>
<body>
<p class=”user”>Snoopy</p>
</body>
</html>
It can traverse mult-level hash maps in the model as well as bean properties (so…basically like jsp expression language references). Not terribly useful yet…need class selectors to really become more useful. For now though, there are some refactorings to be done.