cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hunsberger, Peter" <>
Subject return nodeset from action?
Date Thu, 18 Jul 2002 17:53:27 GMT
Is it possible to return a parameter containing a NodeSet from a Cocoon
action?  If I was running an Xalan based servlet I could call a transform
with a parameter that was in fact an org.apache.xpath.NodeSet.  I'd like to
do the equivalent in Cocoon.  If I just do this directly Cocoon appears to
wrap the results as a String before passing it on to the transformer?

In my action I use code like:

	            map.put( "msgs", (NodeSet)myobject.getMsgs() );

where the getMsgs method returns a nodeset of 1 or more nodes that I'd then
like to reference inside an XSLT.  When I reference the parameter in my XSLT
(using xsl:copy-of select="$msgs") I get 
indicating that the Nodeset has been converted to a String at some point
before I'm referencing it. The site map looks like:

    <map:act set="test">
            <map:generate src="templates/test.xml"/>
            <map:transform src="stylesheets/resolve.xsl">
               <map:parameter name="msgs" value="{msgs}"/>
            <map:serialize type="xml"/>

I suspect the problem is passing the parameter back via the sitemap.
However, if I don't do this I don't see the parameter in the XSLT at all.
I'd guess there is some magic parameter that tells Cocoon to pass the
parameters from the action map back to the transform as parameters?  Testing
               <map:parameter name="parameters" value="true"/>
               <map:parameter name="use-request-parameters" value="true"/>
as parameters to the map:transform did not give the desired results...
Looking at the source doesn't reveal any particular magic to handle this.
My action just extends abstract action, but I don't see any other action
that would yield any other results?

Failing this capability, how else does one return structured data from an
action to a XSLT? (We do not want to use XSP's for this particular set of

I'm running Cocoon 2.0.3 (thanks for the many fixes and improvements :-)
with Tomcat 4.0.4 / JBoss 2.4.4 and JDK 1.4

Peter Hunsberger

Phone: 901-495-5252

Please check that your question  has not already been answered in the
FAQ before posting.     <>

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

View raw message