cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hunsberger, Peter" <Peter.Hunsber...@stjude.org>
Subject Using resources or other pipeline sources in parameters?
Date Wed, 08 May 2002 15:13:16 GMT
Is it possible to map the contents of a cocoon resource or other sitemap
component to a parameter that is to be passed to a stylesheet?

Currently, I have a pipeline where I wrap the contents of the request along
with the original source xml and pass that all into my style sheet as
follows:

         <map:match pattern="*/*">
            <map:aggregate element="wrapper">
               <map:part src="cocoon:/run/requestdata"/>
               <map:part src="cocoon:/{1}/{2}.xml"/>
            </map:aggregate>
            <map:transform src="generic/stylesheets/main.xsl"/>
            <map:serialize/>
         </map:match>

Where run/requestdata just picks up the request generator.  However, it
would be nice to be able to do something like:

         <map:match pattern="*/*">
            <map:generate src="cocoon:/{1}/{2}.xml"/>
            <map:transform src="generic/stylesheets/main.xsl">
               <map:parameter name="requestdata"
value="cocoon:/run/requestdata"/>
            </map:transform>
            <map:serialize/>
         </map:match>

This simplifies the stylesheet considerably since the I can now refer to the
request data as a global parameter and not have to take special steps to
parse it and pass it around as a variable (which implies making sure the
variable passes through all templates unscathed until it gets to it's final
consumer, which in my case is about 8 templates deep in the whole process).

I suspect that this might be achieved fairly simply with XSP's but  I'd sort
of like to not use XSP since there is a bit of a strategic reason to keep
the templates as close to pure XSLT as possible. If I was to use XSP's what
would the approach be? Just rename the template as an XSP (and change the
pipeline of course) and then pick up the request object directly?  

I'm running Cocoon 2.0.2 under JBoss2.4.4/Tomcat4.0.4b with JRE1.4 if it
makes any difference....

Peter Hunsberger

Phone: 901-495-5252
E-mail: Peter.Hunsberger@stjude.org


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message