> From: Leon Messerschmidt [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 29, 2001 12:54 PM
> To: [EMAIL PROTECTED]
> Subject: Re: XML entity replacement
>
>
> > > Are there any thoughts or comments on this? Jason, I believe you
> initially
> > > had an idea (Injectors if I remember correctly) that
> would have made
> this
> > > possible, but I don't really understand how that would've
> worked. Maybe
> you
> > > can shed some light...
> >
> > I think the idea was 'filters' rather than Injectors.
>
> Could be. I did not go into it at the time...
>
> > What about a filtering mechanism on the stream you are
> rendering into?
>
> I don't understand what you're trying to say. Could you
> maybe explain it to
> me.
>
> Only inserted values should be scanned for entities. A
> template like this:
>
> #set ($sometext=" < ")
> <text>$sometext</text>
>
> needs to be rendered like this:
>
> <text><</text>
>
> The only point where I can determine whether I need to
> replace entities is
> at "render time".
>
I asked for this same type of functionality from the first time I tried to
use and for my XML stuff. Writing $tools.escapeEntities($sometext) on every
substitution in the template makes the template unreadable.
It would be nice to have some form of pluggable filter/translation/encoding
infrastructure that works at the engine level, but it is provided by user
code.
You also need a way to turn it ON/OFF from the template. Below, the
directive uses the name to assess the filter installed in the context, "off"
is the null filter:
#filter(xml)
<text>$sometext<text>
#filter(off)<[CDATA[$sometext]]>#filter(xml)
Maybe a block directive is more appropriate. But it would really allow for
clearer code.
> ~ Leon
>