You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jochen Kuhnle <li...@kuhnle.net> on 2005/05/24 13:45:28 UTC

[RFE] Some enhancements to XSP

Hi, I know XSPs are supposed to go away, but I still like 'em... I would 
like to propose some enhancements, and if they're accepted also volunteer 
to implement them (including documentation and examples :).

1. A logicsheet for cache key control to have an easy way to override 
"getKey". Something like:

<key>
        <value><xsp:request-param name="userId"/></value>
        <value><xsp:request-param name="companyId"/></value>
</key>

2. A logicsheet to do the same for "getValidity", so you can do:

<validity>
        <file src="/etc/configfile"/>
        <expires seconds="3600"/>
</validity>

Tags would be available for all classes in the distribution that extend 
SourceValidity.

3. A mechanism for expression replacement as in XSLT or JXTG, replacing 
"{expression}" with a xsp:attribute element in attributes and with a 
xsp:expr element in character data. This could be implemented in the 
PreProcessFilter of XSPMarkupLanguage. The feature would be disabled by 
default and enabled on a per-XSP-basis, maybe through a processing 
instruction.

Example:

<!-- Hey, this looks almost like JXTG :) -->
<img src="{source}" width="{width}" height="{height}"/>
<h1>Hello {username}</h1>

is more readable and easier to use than

<img>
        <xsp:attribute 
name="src"><xsp:expr>source</xsp:expr></xsp:attribute>
        <xsp:attribute 
name="width"><xsp:expr>width</xsp:expr></xsp:attribute>
        <xsp:attribute 
name="height"><xsp:expr>height</xsp:expr></xsp:attribute>
</img>
<h1>Hello <xsp:expr>username</xsp:expr></h1>

Any comments? (I hope this hasn't been proposed already, but I didn't find 
anything about it)

Regards,
Jochen