You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Matt Sergeant <ma...@sergeant.org> on 2003/07/10 12:30:19 UTC

Proposal: Attribute value interpolation (fwd)

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 <ma...@sergeant.org>
To: "xsp-dev@xml.apache.org" <xs...@xml.apache.org>
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:

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

Here the output is something like:

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

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:

   <foo>
     <xsp:attribute name="bar">
     <xsp:expr>$a->{dir}</xsp:expr>/<xsp:expr>$a->{file}</xsp:expr>
     </xsp:attribute>
   </foo>

(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.

Matt.

Re: Proposal: Attribute value interpolation (fwd)

Posted by Vadim Gritsenko <va...@verizon.net>.
Ricardo Rocha wrote:

>Matt Segeant wrote:
>  
>
>>This is a proposal to support attribute value interpolation 
>>(called "attribute value templates" in XSLT) in XSP.
>>    
>>
>
>+1,
>
>I'd already voted this one on the XSP list, but it's important to
>re-state support for a most useful feature
>

+0 from me too on a basis that I won't be able to provide a patch real 
time soon :)

Vadim



RE: Proposal: Attribute value interpolation (fwd)

Posted by Ricardo Rocha <ri...@apache.org>.
Matt Segeant wrote:
> This is a proposal to support attribute value interpolation 
> (called "attribute value templates" in XSLT) in XSP.

+1,

I'd already voted this one on the XSP list, but it's important to
re-state support for a most useful feature

Ricardo


RE: Proposal: Attribute value interpolation (fwd)

Posted by Ricardo Rocha <ri...@apache.org>.
Matt Segeant wrote:
> This is a proposal to support attribute value interpolation 
> (called "attribute value templates" in XSLT) in XSP.

+1,

I'd already voted this one on the XSP list, but it's important to
re-state support for a most useful feature

Ricardo