[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Advanced Page Templates

webmaster@zope.org webmaster@zope.org
Wed, 25 Sep 2002 20:06:48 -0400


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/AdvZPT.stx#3-34

---------------

      When there is only one TAL statement per element, the order in
      which they are executed is simple. Starting with the root
      element, each element's statements are executed, then each of
      its child elements are visited, in order, and their statements
      are executed, and so on.

        % Anonymous User - Apr. 29, 2002 2:11 pm:
         Does element always mean a tag or are there other 'elements'?
         Can't this just say tag?

        % Anonymous User - May 3, 2002 8:18 am:
         <p> is a tag, while the entire <p>stuff</p> is an element.

         http://www.w3.org/TR/2000/REC-xhtml1-20000126/#defs

        % Anonymous User - June 25, 2002 3:47 pm:
         It's not clear to me if the parsing is depth-first or breadth-first. The use of 'element' is confusing -- as
         the other anonymous user said, 'tag' is probably better. Nevertheless, it remains hard to explain this well
         to people new to parsing. I came up with:
         "Parsing starts in the root tag. First, each of the root tag's ZPT statements are executed. Then, the subtags
         of the root element are parsed sequentially. This is done recursively: parsing only continues to the next
         direct subtag of the root tag, after all the subtags (and their subtags) of the previous subtag have been
         parsed.
         In other words, parsing of a template happens in a depth-first recursive way." 

         -- willemb, wondering if the log-in is broken in some way

        % Anonymous User - Sep. 25, 2002 8:06 pm:
         When there is only one TAL statement per element, the order in which they are executed is simple. 

         - /per/, /they/ ??? 
         it took me several seconds to realize that you are considereing a whole tree of HTML elements and the order
         of execution for the tree. So far, only single elements were discussed. And then suddenly /they/ makes sense,
         it relates to the nodes of HTML elements. /only one TAL staement per element/ is misleading.
         Explicit is better than implicit. Who said that?
         Better:
         When there is a tree of HTML elements, the order of processing is as follows: Starting with the root element,
         ...
         IOW, the processing tree walk is preorder, first the node, then children from left to right. blf