[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Advanced Page Templates
Fri, 20 Sep 2002 14:31:05 -0400
A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/AdvZPT.stx#4-15
Here are a couple practical tips that you may find
useful. Some times you'd like to repeat a tag, but not have an
enclosing tag. For example, you might want to repeat a number
of paragraph tags, but there is no need to enclose them in
another tag. You can do this with the 'tal:omit-tag'
<div tal:repeat="quote here/getQuotes"
% Anonymous User - Apr. 12, 2002 6:26 pm:
...Some times you'd...
% Anonymous User - Apr. 29, 2002 1:21 pm:
Instead of making references to describing this later in the chapter, why not move the entire omit=tag
discussion to that later point. There is no advantage to starting the "repetition tips" with a lesser-used
feature that is not buing built upon in the intervening examples. Also, please explain why there is advantage
to omitting a span tag other than eliminating 13 characters of html overhead and a moment of browser time to
ignore the tag. Doesn't a <span tal:replace=... accomplish the same thing?
% Anonymous User - Sep. 20, 2002 2:31 pm:
There is indeed a reason for this! omit-tag is really useful in certain situations. For example, in the
recursive use of ZPT/TAL as a stylesheet for an XML DOM. As you are walking DOM nodes in element.childNodes
in an XML via tal:repeat structure, it can get quite excessive to have half-a-dozen span tags ouptut in the
resulting HTML within a single paragraph tag, but this is what happens if you have <em> and <b> tags output
from related XML tags in the DOM. The browser is fine, but start doing the math: one document with 20-40
paragraphs times 5 instance of span tags times 13 bytes. Could be a few kilobytes of bloat!