cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sergeant <>
Subject Proposal: Attribute value interpolation (fwd)
Date Thu, 10 Jul 2003 10:30:19 GMT
Forwarding to cocoon-dev in case people here aren't reading xsp-dev.

This has now been applied in AxKit CVS.

---------- Forwarded message ----------
Date: Wed, 9 Jul 2003 23:16:59 +0100
From: Matt Sergeant <>
To: "" <>
Subject: Proposal: Attribute value interpolation

Hi core XSP developers...

This is a proposal to support attribute value interpolation (called
"attribute value templates" in XSLT) in XSP. We have an implementation
of this in AxKit now, and it really makes a huge difference in code
size in place of using <xsp:attribute> all over the place in order to
get dynamic attribute values.

Basically it works like this:

       my $tomorrow = localtime(time + 86400);
     <foo bar="{$tomorrow}"/>

Here the output is something like:

     <foo bar="Thu Jul 10 23:11:35 2003"/>

If you need a curly bracket inside you have to escape it. This is a bit
of a pain for Java and Perl - being curly bracket based languages, but
it's that way to be similar to XSLT:

   <foo bar="{$a->{{dir}}}/{$a->{{file}}}"/>

Which is equivalent to the regular XSP:

     <xsp:attribute name="bar">

(there you can really see the verbosity in play!)

Finally, this is so useful we're going to make this the default
behaviour in the next release of AxKit, but you can turn it off on a
page-by-page basis with the top level <xsp:page> attribute:

   <xsp:page attribute-value-interpolation="no">

We'd like to consider making this a part of the spec, as if not, it'll
be an AxKit-only extension.


View raw message