xml-xsp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fo...@neonics.com
Subject Re: Modularizing XSP
Date Fri, 05 Apr 2002 12:20:48 GMT

> Ulrich,
> 
> The more things we break out...the better our code will be!!! So you
> have my +1 to go break out the stuff. we can later integrate it back
> into the mainstream. If we can do a "interpreted" version similar (in
> concept) to the new Sitemap TreeProcessor it will be even better.

I've created a Cocoon clone with XSP and fairly regularly use XML/XSP
to produce Java code, which is very easy to do.

ALso, i've created a Sitemap which is interpreted, which might be
nice to use in the Cocoon project. I use regular expressions as URL
matchers, and have almost the same layout as the cocoon sitemap..
But I think you Apache people could have done this yourself
a long time ago.. The compile-sitemap solution is much faster runtime
than an interpreted version.. 

If you want to use interpreted sitemap's, here's an idea:


      <pipeline match="^projects/([^/]+)/(.*?).html">
        <producer type="xsp">
          <content src="content/projects/$1/$2.xml"/>
          <logic src="logic/www.xsl"/>
        </producer>
        <style src="style/style.xsl"/>
        <serialize type="html" mime="text/html"/>
      </pipeline>


The idea is that the $1, $2 etc which represent the parenthesis in the
regular expression can be used in the src attributes of logic,
style, and serialize and also be used as values for parameters..

Here's a code snippet:

	Vector v=config.getStringList("neoserv.sitemap.pipeline.@match");

        // now loop through them and match
        int idx=0;
        boolean matched=false;
        for (Enumeration en=v.elements(); en.hasMoreElements();)
        {
        	idx++;
                String m=(String)en.nextElement();
                RE r=new RE(m);
                log.debug(5000, "matching against '"+m+"'");

                if (r.match(path))
                {
                    log.debug(5000, "match!");

			....
                }
        }

something like that.. you might want to use a scheme like this as an
alternative to a precompiled sitemap (for instance: only use precompiled
sitemap on live sites and use the interpreted version on development
sites...


Anyway.. thought you might like my input on this :)


Greetings and happy coding! :)


> 
> Thanks,
> dims
> 
> --- Ulrich Mayring <ulrich@mayring.de> wrote:
> > Hi folks,
> > 
> > a while ago I asked whether it would be feasible to seperate XSP from
> > Cocoon and the consensus was that it is possible, but requires some
> > work. Now, suppose I were to tackle this, is there any interest in
> > getting this code back into Cocoon or would you rather I do my thing and
> > XSP remains as it is?
> > 
> > If there is interest in a contribution, do you have any preferences as
> > to the interfaces to the "outside world", i.e. Cocoon?
> > 
> > I don't know how "embedded" XSP currently is and if it uses any Cocoon
> > features or whether Cocoon itself would have to be changed, but I'll
> > probably take a look soon. My idea is to use XSP for a non-Cocoon
> > project, but if the community feels uneasy about that I can also invent
> > my own thing and design a "inspired by XSP" button :)
> > 
> > cheers,
> > 
> > Ulrich
> 
> 
> =====
> Davanum Srinivas - http://xml.apache.org/~dims/
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
> 


Mime
View raw message