"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 &quot;{$header/name}&quot;
      has value &quot;{$header/value}&quot;
    </paragraph>
  #end
</document>

Given the current headers:

X-Test-Header: testvalue
Content-Length: 100

Would produce:

<document>
  <paragraph bold="true">
    The header called &quot;X-Test-Header&quot;
    has value &quot;testvalue&quot;
  </paragraph>
  <paragraph>
    The header called &quot;Content-Length&quot;
    has value &quot;100&quot;
  </paragraph>
</document>

        Pier


Reply via email to