"Peter Royal" <[EMAIL PROTECTED]> wrote:
> On Tuesday, June 17, 2003, at 08:07 PM, Pier Fumagalli wrote:
>
>> The most peculiar one is that I always _hated_ the fact that Velocity
>> output
>> need to be passed through a parser _every_time_ the content is
>> generated
>> (Velocity is stream-based, not SAX-based), so what my little template
>> does
>> is that it actually parses the original template generating a set of
>> "SAX
>> like" events (yeah, elements, CDATA, characters and comments are
>> parsed and
>> identified as such) so, once a "template" is parsed, it will be stored
>> (and
>> "replayed") as a sequence of SAX events.
>>
>> I didn't invent anything, I just took the Velocity syntax, and wrote a
>> parser that follows the Cocoon contracts (SAX) and put them together,
>> and
>> added some spice and salt...
>
> Compare and contrast to Jelly? <http://jakarta.apache.org/commons/jelly>
Concise question, concise answer:
Forget the XML syntax, use JXPath instead of JEXL for expressions... Like:
<document>
#foreach $header in {request/headers}
#if {starts-with($header/name, 'X-'}
<paragraph bold="true">
#else
<paragraph>
#end
The header called "{$header/name}"
has value "{$header/value}"
</paragraph>
#end
</document>
Given the current headers:
X-Test-Header: testvalue
Content-Length: 100
Would produce:
<document>
<paragraph bold="true">
The header called "X-Test-Header"
has value "testvalue"
</paragraph>
<paragraph>
The header called "Content-Length"
has value "100"
</paragraph>
</document>
Pier