[Petal] Replace contents of tag only if value is set

Jean-Michel Hiver jhiver@mkdoc.com
Tue, 29 Oct 2002 22:26:19 +0400


> >   <p
> >     petal:if="true:foo"
> >     petal:content="foo"
> >   >foo goes here if foo is true</p>
> >
> >   <p
> >     petal:if="false:foo"
> >   >foo wan't true so bar is here</p>
> >
> Admittedly this would work, but apart from not tending to very tidy
> templates, it still doesn't address my problem that I need to pass the
> content's of a tag to a modifier.

At the moment I don't see how you'd do that with Petal without seriously
hacking Petal::Canonicalizer::* modules. However an option is that you could
use the 'or' modifier which William recenlty contributed to the list and do:

<p petal:set="default_value string:My default value"
     petal:content="some/petal/expression defaut_value">My default value</p>

That'd be the easiest way of doing it I think.
Cheers,

Jean-Michel.