You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Marcus Crafter <cr...@dresdnerbank.de> on 2000/11/03 19:18:44 UTC
[C2] RequestParamMatcherFactory
Hi All,
Hope everything is going well.
Sometimes one would like to select a stylesheet in Cocoon 2
dynamically specified in a parameter given at request time.
Attached is a new file to do exactly this.
For example, consider the following sitemap pipeline:
<map:match pattern="someuri.xml">
<map:generate type="serverpages" src="source.xml"/>
<map:transform src="intermediate.xsl"/>
<map:match type="reqparam" pattern="final">
<map:transform type="xslt" src="{1}"/>
</map:match>
<map:serialize/>
</map:match>
The attached 'matcher' examines the request object for a cgi parameter
named 'final'. If there is one there, then the {1} specification in
the child transform element is replaced with the value of this
parameter.
This allows you to specify a stylesheet to be used on the request
line, which itself can be generated dynamically based on some other
properties. (eg: http://somehost/someuri.xml?final=style2.xsl)
To use this matcher, add the following line to your sitemap
configuration in the 'map:matchers' section (with the attached file
added to your cocoon distribution in the 'matching' directory, or
elsewhere):
<map:matcher name="reqparam" factory="org.apache.cocoon.matching.RequestParamMatcherFactory"/>
Well, I hope this is of use to others apart from me. Any suggestions,
improvements or more ideas are welcomed.
Hope everyone has a good weekend.
Cheers,
Marcus
--
.....
,,$$$$$$$$$, Marcus Crafter
;$' '$$$$: Computer Systems Engineer
$: $$$$: Open Software Associates GmbH
$ o_)$$$: 82-84 Mainzer Landstrasse
;$, _/\ &&:' 60327 Frankfurt Germany
' /( &&&
\_&&&&' Email : Marcus.Crafter@osa.de
&&&&. Business Hours : +49 69 9757 200
&&&&&&&: After Hours : +49 69 49086750