I think you're misunderstanding the point of t:container?
1) T5 templates have to be well-formed xml.
2) Well-formed xml documents have to have a single root node
3) Tapestry basically renders all of the markup in your template.

Suppose you have a component that should insert some content. Something like:
MyComponent.tml:
        <p>Here is some content to insert</p>
        <p>Here is some more content to insert</p>
That won't fly for T5, because it isn't well-formed xml.
So you have to wrap it in a root node... you pick div:
<div>
  <p>Here is some content to insert</p>
  <p>Here is some more content to insert</p>
</div>

Problem is, now when you use your component, you get that extra (potentially undesirable) div:

SomePage.tml:
<div id="somemeaningfulid">
  <MyComponent/>
</div>

The rendered output is going to be:

<div id="somemeaningfulid">
  <div>
    <p>Here is some content to insert</p>
   <p>Here is some more content to insert</p>
 </div>
</div>

(sans the whitespace. ;)

Enter t:container. It's purpose to provide the root node for a template which /won't/ be rendered.
We rewrite MyComponent.tml as:
<t:container>
  <p>Here is some content to insert</p>
  <p>Here is some more content to insert</p>
</t:container>

And now our output becomes:
<div id="somemeaningfulid">
    <p>Here is some content to insert</p>
    <p>Here is some more content to insert</p>
</div>

t:container is not, to my understanding, a replacement for T3 and T4's $content$.

Cheers,

Robert

On Mar 7, 2008, at 3/710:16 AM , Christian Köberl wrote:



Julian Wood wrote:

I tried your code verbatim and I here's what I get rendered:
...<body><h1>Test</h1><html> start Start </html></body></html>
This is with both 5.0.10 and 5.0.11-SNAPSHOT, so now I'm a little
flummoxed.

That's really weird!?

Can anybody else try this example? Has anybody else had the same issue with
t:container?

--
Chris
--
View this message in context: 
http://www.nabble.com/Writing-an-FAQ-for-Tapestry-5-tp15719185p15898855.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to