cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Tyler" <r...@tyler.org>
Subject Re: single xsp document which serves WML or HTML?
Date Mon, 10 Apr 2000 17:48:01 GMT
> > For example, I want to generate a completely
> >> different HTML based interface for a touch-screen kiosk based on the
> >> known static IP address of my kiosk.  How can I do that?
> Hmmm. not sure what you're doing but could you just provide a different
> URL??

OK, forget the kiosk example.  I have a site with say 100
different pages where the XML is pulled from a "legacy"
CGI application (modified to generate XML - no I can't
just rewrite it entirely in XSP/java - we're talking hundreds of
thousands of lines of working C++) and I want to have a SINGLE
generic XSP driver, instead of a having to make 100 essentially
identical copies of the XSP driver solely for the purpose of
specifying a different style style sheet for each page.  Moreover,
I also need to be able to "private label" the site for partners,
which means creating another N set of copies of the XSP driver.

So, to recap, my site must currently be driven by several hundred
XSP files, each of which is only about 20 lines long and differs from
all the other copies only in the XSL stylesheet specification line.
Ugly, no?  I would be so much happier if I could compress that
mess into a single XSP driver which allowed me to dynamically
specify the stylesheet.  The XSL processing layer generally
happens after the XSP logic is executed, so why shouldn't it
be possible to use XSP logic to specify the primary stylesheet?!

Is anyone seriously arguing that it would not be incredibly useful
and elegant to be able to determine the stylesheet at runtime based
on client characteristics, cookie settings, configuration data
stored in databases, etc?

In case you are interested, here is the XSP file I am now forced
to copy over and over and over again, only to  change the XSL
stylesheet line for each page:

<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="stylesheet1.xsl" type="text/xsl"?>
<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
        <xsp:structure>
                <!--my own class which pulls in XML generated by a CGI -->
                <xsp:include>XspUrlHandler</xsp:include>
        </xsp:structure>
        <page>
                <xsp:logic>
                        <!-- question: what single object can I pass to
avoid all these args? -->
                        XspUrlHandler xspUrlHandler = new XspUrlHandler(
                                request, document, xspNodeStack,
                                xspParentNode, xspCurrentNode );
                        <![CDATA[


                      xspUrlHandler.include( "http://localhost/legacycgi" );
                        ]]>
                </xsp:logic>
        </page>
</xsp:page>

My XspUrlHandler class automatically passes any arguments received
by the XSP to legacycgi, so legacycgi can dynamically determine what
content to generate based on the arguments received.

I just want to be able to use request.getParameter() to query an argument
(e.g. "?style=foo") to determine what stylesheet should be applied at
runtime.

I know this isn't what Cocoon was designed for, but that's part of the
beauty in my opinion - that it's flexible enough to give a five year old
web application new life.

- RT


Mime
View raw message