You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jörn Heid <he...@agentsinaction.de> on 2001/09/09 16:07:55 UTC

Confused about Actions

The following pipeline does not work as the parameter {1} isn't visible
after the email-action:

			<map:match pattern="**.xml">
			   <map:act type="email">
				<map:generate src="{1}.xml"/>
				<map:transform type="xinclude">
                              <!-- The parameter 1 is not visible
anymore -->
					<map:parameter name="src" value="{1}.xml"/>
				</map:transform>
				<map:transform src="xsl/page.xsl"/>
				<map:transform type="ses">
					<map:parameter name="src" value="{1}.xml"/>
				</map:transform>
				<map:serialize type="html"/>
			  </map:act>

The following version works

			<map:match pattern="**.xml">
			   <map:act type="email">
                        <!-- Look here -->
			      <map:parameter name="1" value="{1}"/>
				<map:generate src="{1}.xml"/>
				<map:transform type="xinclude">
					<map:parameter name="src" value="{1}.xml"/>
				</map:transform>
				<map:transform src="xsl/page.xsl"/>
				<map:transform type="ses">
					<map:parameter name="src" value="{1}.xml"/>
				</map:transform>
				<map:serialize type="html"/>
			  </map:act>

as the action return a map which duplicates the params:

    Map sitemapParams = new HashMap ();
    for (int i = 0; i < params.getNames ().length; i++)
        try {
            sitemapParams.put (params.getNames ()[i], params.getParameter
(params.getNames ()[i]));
            } catch (Exception ex) { ex.printStackTrace (); }


Is this the right way?
Why do actions act like that? Why doesn't the pipeline union the different
parameter maps?

JOERN_HEID


---------------------------------------------------------------------
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>


RE: Confused about Actions

Posted by Vadim Gritsenko <vg...@hns.com>.
It soon will become FAQ...

Try this:
> 			<map:match pattern="**.xml">
> 			   <map:act type="email">
> 				<map:generate src="{../1}.xml"/>

Action also can return parameters, and you need parameters from previous (one level up) component.

Vadim

> -----Original Message-----
> From: Jörn Heid [mailto:heid@agentsinaction.de]
> Sent: Sunday, September 09, 2001 10:08 AM
> To: Cocoon-Users
> Subject: Confused about Actions
>
>
> The following pipeline does not work as the parameter {1} isn't visible
> after the email-action:
>
> 			<map:match pattern="**.xml">
> 			   <map:act type="email">
> 				<map:generate src="{1}.xml"/>
> 				<map:transform type="xinclude">
>                               <!-- The parameter 1 is not visible
> anymore -->
> 					<map:parameter name="src" value="{1}.xml"/>
> 				</map:transform>
> 				<map:transform src="xsl/page.xsl"/>
> 				<map:transform type="ses">
> 					<map:parameter name="src" value="{1}.xml"/>
> 				</map:transform>
> 				<map:serialize type="html"/>
> 			  </map:act>
>
> The following version works
>
> 			<map:match pattern="**.xml">
> 			   <map:act type="email">
>                         <!-- Look here -->
> 			      <map:parameter name="1" value="{1}"/>
> 				<map:generate src="{1}.xml"/>
> 				<map:transform type="xinclude">
> 					<map:parameter name="src" value="{1}.xml"/>
> 				</map:transform>
> 				<map:transform src="xsl/page.xsl"/>
> 				<map:transform type="ses">
> 					<map:parameter name="src" value="{1}.xml"/>
> 				</map:transform>
> 				<map:serialize type="html"/>
> 			  </map:act>
>
> as the action return a map which duplicates the params:
>
>     Map sitemapParams = new HashMap ();
>     for (int i = 0; i < params.getNames ().length; i++)
>         try {
>             sitemapParams.put (params.getNames ()[i], params.getParameter
> (params.getNames ()[i]));
>             } catch (Exception ex) { ex.printStackTrace (); }
>
>
> Is this the right way?
> Why do actions act like that? Why doesn't the pipeline union the different
> parameter maps?
>
> JOERN_HEID
>
>
> ---------------------------------------------------------------------
> 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>
>
>


---------------------------------------------------------------------
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>