http://qs321.pair.com?node_id=785446

In section 5, Terence Parr defines a template as:
A template is an output document with embedded actions that the engine evaluates when rendering the template.

SSI

Server-side includes can be considered templating.

Print statement

How about this program:
out.println("<html>"); out.println("<body>"); out.println("<h1>Servlet test</h1>"); String name = request.getParameter("name"); out.println("Hello, "+name+"."); out.println("</body>"); out.println("</html>");
is this a template?
output document
I dont see an output document... maybe the subroutine can be considered an output document.
The embedded actions?
I guess string concatenation.
Engine?
The engine in this case is the Java programming language.

real templating

There's no question that HTML::Mason, etc are template engines

Seamstress?

I'm not so sure that HTML::Seamstress has templates. Let's look at the definition again:
output document
an HTML file... so far so good.
The embedded actions?
There really are none. An XHTML compliant file doesnt necessarily have embedded actions.
Engine?
The engine in this case is not-fixed. There is no fixed way of looking at an XHTML file that forces it to be dynamically produced in any particular way. Template engines have a fixed way of looking at embedded actions. Let's example a bit of SYNOPSIS code from the Petal distro:
<html xmlns:tal="http://purl.org/petal/1.0/"> <body tal:content="bar">Dummy_Content</body> </html>
Petal has one way of processing that body tag: it will do a replacement. Seamstress has no fixed protocol between Perl and HTML. It could do a replacement there. But it could also simulate the INCLUDE mechanism of another template system and locate a file named bar.html and inline it. Or it could locate a method named bar and call it. No fixed protocol.

Dynamic HTML production... without templating

Templating engines are designed to ease text production and may or may not have special support for HTML. HTML::Seamstress is designed solely for object-oriented HTML production. So there is some overlap between the functionality of templating systems and a dynamic HTML generation API, but they dont serve all the same purposes or have the same set of functional components.

Opinions encouraged

I am curious about whether you agree or disagree with my position and why.

Replies are listed 'Best First'.
Re: HTML::Seamstress is not a templating engine?
by pKai (Priest) on Aug 03, 2009 at 19:44 UTC

    Also in the same chapter Parr writes:

    Interestingly, by this definition of a template, XSL ... style sheets are not templates at all because style sheets specify a set of XSLT tree transformations whose emergent behavior is an XML or HTML document. XSL style sheets are programs like servlets, albeit declarative in nature rather than imperative.

    And I was never absolutely sure where the real dinstinction is drawn here.

    When your "traditional" templating system tends to become a Turing complete programming language, the distinction blurrs away anyway.

    I like in XSLT that it won't break the tree structure of the "template" I'm working in (XML, XHTML). So typically for my taste it's a better fit. Which might only be exactly that.. a matter of taste.

    The same might or might not apply to you and your HTML::Seamstress.

      The same might or might not apply to you and your HTML::Seamstress.
      Seamstress uses HTML::Tree, so well-formedness is guaranteed. it even does some auto-corrections. A colleague of mine was trying a browser hack where he tried to stick form tags inside a table and it kept rejecting his HTML.