stl and yaws

Vladimir Sekissov <>
Tue Jan 14 11:24:00 CET 2003


Good day,

I'm now working on Yaws extension for STL. It is finished on 90% and
already contains:

1. Continuation-passing style sessions based on modified Ulf Wiger's
`mdisp' module. Idea was borrowed from PLT Web-server.

2. Support for Yaws ehtml syntax, so you can use ehtml, html, content, ...
yaws expressions directly in templates. Two following expressions
produce the same results:

...
,*)
<table>
 <tr><td>(*, MyVar ,*)</td></tr>
</table>
(*,
...

...
,*)
{ehtml,
  {table, [],
    {tr, [], {td,  [], MyVar}}
  }
}
(*,
...

3. Exml (xml like ehtml) processor. Not as complex as XSLT but enough
for easy transformation things like

{user, [{id, 1}, {name, undefined}]}

to

{ehtml,
  {form [{action, "myaction"}],
    [{input, [{type, text}, {name, "id"}, {value, "1"}]},
     {input, [{type, text}, {name, "name"}, {value, ""}]}
  ]}
}

4. Utilities - forms validator, phrase dictionary, odbc connection pool.

Best Regards,
Vladimir Sekissov

mickael.remond> * Mikael Karlsson <> [2003-01-13 23:31:19 +0100]:
mickael.remond> 
mickael.remond> > I recalled that Mickael Remond mentioned the public contribution
mickael.remond> > STL (Simple Template Language) 
mickael.remond> > - http://www.erlang.org/user.html#stl-1.0 
mickael.remond> > by Vladimir Sekissov at his talk EUC2002.
mickael.remond> > STL is described as:
mickael.remond> > >>
mickael.remond> > STL as `Simple Template Language' is a clone of Bruce R. Lewis's BRL 
mickael.remond> > (http://brl.sourceforge.net) implemented in Erlang. It deals with template 
mickael.remond> > processing and has most capabilities which user expects from web template 
mickael.remond> > engines.
mickael.remond> > <<
mickael.remond> > I looked at it and thought of using it for Yaws, but at first sight I can not 
mickael.remond> > see what the gain would be compared to using Yaws own  tags.
mickael.remond> > <erl></erl> instead of the (* *) and *) (*  delimiters? 
mickael.remond> > 
mickael.remond> > Greatful for any explanation. Thanks
mickael.remond> 
mickael.remond> In fact, the STL thing allows easy integration of variables (That is to
mickael.remond> say insertion of dynamic content) easily in different part of the
mickael.remond> template.
mickael.remond> In yaws to insert data in the HTML, you have to declare an out/1 function.
mickael.remond> Moreover, each insertion of dynamic content implies an erl set of tag,
mickael.remond> with a out function declaration. Each erl zone ends up being compiled as
mickael.remond> a separate Erlang module.
mickael.remond> 
mickael.remond> Finally, with Yaws system, I often end up with one erl zone covering the
mickael.remond> all .yaws file. The main out/1 function is then calling other functions
mickael.remond> (from the same yaws file or from an Erlang module) to insert HTML
mickael.remond> templating element (Header/ Footer).
mickael.remond> 
mickael.remond> BRL is not the perfect templating system, but it avoid this problem. I
mickael.remond> still think the way to go would be to code a Zope like (ZPT) templating
mickael.remond> system, each template ending up compile as one module. ZPT allows to
mickael.remond> define the rendering logic in the template (Variables area, iterations)
mickael.remond> and refers to core "business application" code for getting the data or
mickael.remond> triggering the processing writing as Erlang module.
mickael.remond> 
mickael.remond> I hope this is more clear for you, now.
mickael.remond> 
mickael.remond> Happy new Erlang year !
mickael.remond> 
mickael.remond> -- 
mickael.remond> Mickaël Rémond



More information about the erlang-questions mailing list