cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael French <mfre...@zycor.lgc.com>
Subject RE: single xsp document which serves WML or HTML?
Date Tue, 11 Apr 2000 16:56:10 GMT


> -----Original Message-----
> From: Mike Engelhart [mailto:mengelhart@earthtrip.com]
> Sent: Monday, April 10, 2000 1:53 PM
> To: cocoon-users@xml.apache.org; Cocoon Dev
> Subject: Re: single xsp document which serves WML or HTML?
> 
> Rick Tyler wrote:
> 
> > 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?

> I believe that a patch was put in to allow <xsp:expr/> tags 
> inside of PI's about a week ago but I'm not sure.  

Yes, Robin's fix works for me. 
(don't know if it's gone into CVS).
You can build a PI that contain <xsp:expr> to select 
the whole stylesheet based on a request parameter. 

> Can stylesheet attributes be dynamically
> generated in XSP with the latest CVS of Cocoon?

No, as far as I can tell. 
The parameters can now be passed from an XSP document,
but the XSL stylesheet itself cannot be an XSP page,
because XSP does not pass through the namespace declaration
on the root element of the document. So if the XSP contains,

<xsp:page ...> 

  <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
  ...
     <xsl:variable name="foo">
       <xsp:expr>request.getParameter("foo")</xsp:expr>
     </xsl:variable>

the output will be:

<xsl:stylesheet version="1.0">
...

I had a quick look at the namespace issues,
but quickly got lost in the technicalities. 
If you read XSLT 7.1.1:

	http://www.w3.org/TR/xslt#literal-result-element

You see that the stylesheet rules never see elements 
with the XSLT namespace URI, and to make a stylesheet 
that generates a stylesheet requires a little extra work, 
using the <xsl:namespace-alias> (which works fine on its own).
The problem is what to do with XSP, which uses XSL to write
Java that builds a DOM ? It seems easy to hack, 
but hard to do right, and remain efficient for 
the 99% of cases for which XSP is not writing XSL. 

As a workaround, you can trivially get the request
parameters in a JSP-XSL page.

Mike





Mime
View raw message