cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <ovi...@cup.hp.com>
Subject Re: AW: Support for URL rewriting
Date Wed, 22 Nov 2000 21:50:10 GMT
On Wed, 22 Nov 2000 14:49:38 +0100, "Matthew Langham" <mlangham@sundn.de> 
wrote:

> >>
> I am already using encodeURL methode which does
> exactly what you need ... rewrite URL with session
> info in case the browser (eg. your WAP handy) does not
> support the cookies.
> <<
> 
> Yes - we know encodeURL does the job - our question is whether we can get
> Cocoon to do this - instead of doing it ourselves - which I guess is what
> you are doing. Ideal would be some parameter which can be set to choose
> either cookies or encodeURL.
> 
> The solution would need to be inside the serializer component(s).

Where is this serializer component? Are you talking about C1 or C2?

The solution I proposed is to have the code that invokes encodeURL in your
stylesheet. Something like this:

<xsl:stylesheet xmlns:xsl="..."
                xmlns:lxsl="http://xml.apache.org/xslt"
                xmlns:utils="Utils"
                extension-element-prefixes="utils"
                version="1.0">

 <xsl:param name="response"/>

 <xsl:template match="link">
  <a href="utils:encodeURL($response, {@href})"><xsl:value-of select="."></a>
 </xsl:template>

</xsl:stylesheet>

You could then use in your XML/XSP pages the <link> element to specify URLs and
have them encoded automatically.

utils:encodeURL() is an extension function, a method of the Utils class, that
invokes the encodeURL() method on the response object. We need the response
object to be passed as argument to the XSLT stylesheet, otherwise there's no
way to invoke the encodeURL method. This requires a little modification in the
XSLTProcessor.java to pass the response object as argument to the stylesheets,
but its easy to do.

Regards,
-- 
Ovidiu Predescu <ovidiu@cup.hp.com>
http://orion.nsr.hp.com/ (inside HP's firewall only)
http://www.geocities.com/SiliconValley/Monitor/7464/



Mime
View raw message