cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: Request Parameter based Stylesheet selection
Date Fri, 08 Aug 2003 12:01:49 GMT
Hello Raman,

I don't know the RequestParameterMatcher, but from your code I wonder 
how it should work. At 
there is an example and from it I think it should be something like the 

<!-- only a better name to make it obvious -->
<map:matcher name="requestparam-id" 

<map:match pattern="xsp/invoice-control">
   <map:generate src="docs/xsp/invoice-control.xsp" type="serverpages"/>
   <!-- refering to the matcher above: @type -->
   <map:match type="requestparam-id" pattern="**">
     <map:transform src="invoicepresentation/xsl/report-{1}.xsl"/>

Another possibility is the RequestParamAction:

<map:action name="request" 

<map:match pattern="xsp/invoice-control">
   <map:generate src="docs/xsp/invoice-control.xsp" type="serverpages"/>
   <map:act type="request">
     <map:parameter name="parameters" value="true"/>
     <map:transform src="invoicepresentation/xsl/report-{id}.xsl"/>


But bear in mind that there is a certain risk using a request param 
directly for a URI to the file system. Imagine a parameter 
id=common/../../path/to/an/XSLT/the/user/should/not/see.xsl and having a 
directory report-common. Of course it's only theoretical, but ...



Raman Jankiram wrote:

> I have been struggling with this problem for the the past few days with 
> Cocoon2.
> I have a XSP which generates XML (typical generator). I want to pick 
> style sheet based on the request parameters.
> I have the sitemap like this
> <map:matchers>
> .
> .
>  <map:matcher  name="id" 
> src="org.apache.cocoon.matching.RequestParameterMatcher"/>
> .
> </map:matchers>
> .
> .
> .
> <map:match pattern="xsp/invoice-control">
>    <map:generate src="docs/xsp/invoice-control.xsp" type="serverpages"/>
>      <map:match name="id" pattern="**" >
>        <map:transform src="invoicepresentation/xsl/report-{1}.xsl">
>         </map:transform>
>        <map:serialize/>
>       </map:match>
> </map:match>
> the http request will be something like this
> XSP generates the required XML from id=25 and we want the style sheet to 
> be applied.
> For some reason this does not work.
> Please help.
> -Raman

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message