You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Hunsberger, Peter" <Pe...@stjude.org> on 2002/05/08 17:13:16 UTC

Using resources or other pipeline sources in parameters?

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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>