 <p>SWI-Prolog <a href="http://www.swi-prolog.org/pldoc/doc_for?object=section%283,%273.16%27,swi%28%27/doc/packages/http.html%27%29%29" rel="nofollow">library(http/html_write)</a> library builds on DCG a DSL for page layout.</p> <p>It shows a well tought model for integrating Prolog and HTML, but doesn't attempt to cover the entire problem. The 'residual logic' on the client side remains underspecified, but this is reasonable, being oriented on practical issues 'reporting' from RDF.</p> <p>Thus the 'small detail' client interaction logic is handled in a 'black box' fashion, and such demanded to YUI components in the published application (the award winner <a href="http://e-culture.multimedian.nl/software/ClioPatria.shtml" rel="nofollow">Cliopatria</a>).</p> <p>The library it's extensible, but being very detailed, I guess for your task you should eventually reuse just the ideas behind.</p>