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 2001/06/21 19:21:03 UTC

Re: [RT] Alternative Solution to XSP

On Thu, 21 Jun 2001, Berin Loritsch wrote:

> I am throwing out some random ideas to eliminate the need for
> code in XSP.  XSP's major failing is the <xsp:logic/> construct,
> and it's minor failing is the absence of loops and conditionals.
> The need for <xsp:logic/> is created by the fact that you cannot
> easily loop (unless you made a taglib that lets you perform that).
> XSP was a relatively simple solution to what started as a simple
> problem.  However, the simple solution caused people's minds to
> solve new problems with the tool.  This is good, but the backlash
> is that we now have lost the principle separation of Model and
> Controller.
> 
> How do we come back and reclaim our right to separate MVC+Mgmt?
> One solution is that we implement SLL (does everyone remember
> that?) and use SLL for tag libraries.  This will allow us to
> remove code from our model.  What do we do when the logicsheet
> is too low level like ESQL?  Don't get me wrong, Donald Ball
> did a tremendous job with ESQL, but it is still mixing concerns.
> To come to a full solution we have to understand the problem
> domain.  Below is a poll that I would like you to participate
> in because it will help solve the answer:

I'll throw in the solution we came up with for AxKit, which makes
authoring taglibs (we don't call them logicsheets, because there's no
point if they're not implemented as stylesheets) a joy.

You simply author a perl class, as you would normally, add some
boilerplate code for including the XSP stuff, and then add a
tag-to-function mapping, which specifies how the tag works, what
parameters it takes, and so on. Here's an example of the mapping (I'll
leave off the perl code, because I know it makes it hard for you guys to
sleep at night :-)

@EXPORT_TAGLIB = (
  'authenticate()',
  'super_authenticate()',
  'get_preview($item_id):as_xml=1',
  'list_users():itemtag=user',
  'get_announce(;$id):itemtag=announcement',
);

That defines tags <x:authenticate/>, <x:super-authenticate/> (the mapping
allows you to use underscore or hyphen in the tag), <x:get_preview
item-id="1"/>, <x:list-users/> and <x:get-announce/>. The parameters can
be passed as either an attribute, or as a child tag (in the same
namespace), and the options after the function name tell how the results
are generated.

This makes it *so* easy to develop taglib based projects that XSP on AxKit
is truly separation of concerns realised.

Hope maybe you can borrow something from it.

-- 
<Matt/>

    /||    ** Founder and CTO  **  **   http://axkit.com/     **
   //||    **  AxKit.com Ltd   **  ** XML Application Serving **
  // ||    ** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
     \\//
     //\\
    //  \\


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org