[TransWarp] More PWT Ideas (usage, not terminology!)

Phillip J. Eby pje at telecommunity.com
Fri Jul 25 17:51:16 EDT 2003


At 10:06 PM 7/25/03 +0200, Roché Compaan wrote:
>* Phillip J. Eby <pje at telecommunity.com> [2003-07-25 15:47]:
> > Is that all a bit clearer now?
>
>I think I got my terms mixed up because I understand how domlets are
>defined in a template and was incorrectly thinking of the
>ContentReplacer classes Text and List as DOMlets.

They are.  Look at the IDOMletNode and IDOMletElement interfaces.  Anything 
that implements either is a DOMlet.  It's just that the default 
implementations -- Literal and Element -- are *static* DOMlets, coded to do 
nothing but output the XML that created them.  List and Text are *dynamic* 
DOMlets, that do something besides render static text.

Ironically, I think the trouble you're having with understanding PWT is 
that it's a lot *simpler* than you think.  :)  DOMlets are the only thing 
there *is*, it's just that the domlet="" attribute lets you override the 
default choice of what *kind* of DOMlet is used for that element.


>Just to be clear: a
>DOMLet is the xml node that defines the 'pattern' for data substitution.

No.  A DOMlet represents some portion of an input document, and is 
responsible for generating a portion of the output document.  Input 
elements marked with a define="" attribute are passed to the nearest 
containing explicit DOMlet as a parameter - like supplying a function as a 
parameter to another function, or filling a ZPT macro slot.

Once again, all that exists is DOMlets, some are just children and/or 
parameters of others.


>The ContentReplacer uses this pattern to write data to the content of
>the elements in this pattern. Does this sound right?

ContentReplacer is just an abstract base for a DOMlet that doesn't care 
about its contents in the source document, except as a possible source of 
parameter definitions.  Text doesn't care about the text it's replacing, 
and List replaces its contents with repetitions of its 'listItem' parameter(s).




More information about the PEAK mailing list