Hi Terrence,

* Terrence Brannon <[EMAIL PROTECTED]> [2006-02-26 04:25]:
>Can you give some usage examples of your approach to XML
>templating? I'm curious to see what you need that XML::DOM,
>XML::LibXML, XML::LibXSLT, and PeTaL and XML::Twig cannot do for
>you.

errm… you’re not seriously suggesting I use the DOM API to build
documents, are you? I can imagine a lot of things more fun than
that, like stabbing my eyeball with a fork f.ex. Twig is much
better, but still they’re not *templates*. I want to write
*templates*, not code that builds the document programmatically,
however easy the API for that might be. Is there any reason you
are proposing both modules in the same breath anyway? XML::LibXML
can do all of what XML::DOM can and is superior in every way.

Using XSLT is well and fine if you have an XML document to begin
with, but when you have data structure to start with, it’s no
help at all.

Now Petal… is very, very very close. The basic idea is virtually
identical, which is no wonder, because what I’m doing is a port
of Kid[1], which is inspired by TAL. (Not a straight port; this
is supposed to be as perlish as Kid is pythonic.)

The most visible difference in terms of syntax is that TAL/Petal
has this hackneyed minilanguage; I want Perl. But there are a lot
more differences. The code-side API is very different from that
of Petal, with templates mapping directly to classes and all the
voodoo in place so that you just `use` or `require` them as if
they were Perl modules. Template expansion is streaming. The
template compiler is also much simpler than the one in Petal
because all I’m doing is mapping from SAX events to code snippets
during parsing.

[1] http://kid.lesscode.org/

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to