You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Björn Voigt <bv...@hs-harz.de> on 2004/03/22 08:38:25 UTC

Using sitemap parameters in a cinclude transformation

Moin Cocooners,

I want aggregate some internal pipelines. The generated file
should have a more complex structure instead of only one root element,
which the simple sitemap aggregation is providing.

I want use the cinclude mechanism, but it seems to be not able to
handle parameters from the sitemap. Is this not possible with cinclude?

I will replace this:

       <map:match pattern="*.html">
         <map:aggregate element="site">
           <map:part src="cocoon:/menu-{0}"/>
           <map:part src="cocoon:/body-{0}"/>
         </map:aggregate>
    	<map:transform type="encodeURL"/>
	[...]
       </map:match>

with something like this:

<map:match pattern="pattern="*.html"">
   <map:generate src="aggregation.xml"/>
   <map:transform type="cinclude">
	<map:parameter name="value" value="{1}"/>
   </map:transform>
   [...]
</map:match>

<site xmlns:cinclude="http://apache.org/cocoon/include/1.0">
     <cinclude:include src="cocoon:/menu-{value}"/>
     <cinclude:include src="cocoon:/menu-{value}"/>
</site>

Thank you for helpfull ideas,

Björn Voigt



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


Re: Using sitemap parameters in a cinclude transformation

Posted by Jan Hoskens <jh...@schaubroeck.be>.
The cinclude transformer itself does not have the capability to pass and
fill in parameters. You should combine the cinclude with another technique
such as:

   1)  JXTemplateGenerator:(preferred way)  this uses Jexl and JXPath to
access variables, you got some standard objects you can use here such as
request/parameters and session, look for the docs in your cocoon under flow
    <map:generate type="jx" ....>
        <map:parameter name="url" value=""/>
    </map:generate>

        ->sourcefile: something like <cinclude:include
src="#{$cocoon/parameters/url}"/>

 2)   XSP: (old way) in XSP you can create your cinclude tags and use logic
to get your sitemapparameter (parameters.getParameter(..))
    <map:generate type="serverpages"...>
        <map:parameter name="" value=""/>
    </map:generator>

    ->sourcefile
    <xsp:logic>
        String url = paramters.getParameter("...");
    </xsp:logic>
        create your element and add an attribute
    <cinclude:include>
        <xsp:attribute name="src"><xsp:expr>url</xsp:expr></xsp:attribute>
    </cinclude:include>

thus replace your normal xml generator with one of the previous generators
and adjust your source file.

Kind Regards,
Jan

----- Original Message ----- 
From: "Björn Voigt" <bv...@hs-harz.de>
To: <us...@cocoon.apache.org>
Sent: Monday, March 22, 2004 8:38 AM
Subject: Using sitemap parameters in a cinclude transformation


> Moin Cocooners,
>
> I want aggregate some internal pipelines. The generated file
> should have a more complex structure instead of only one root element,
> which the simple sitemap aggregation is providing.
>
> I want use the cinclude mechanism, but it seems to be not able to
> handle parameters from the sitemap. Is this not possible with cinclude?
>
> I will replace this:
>
>        <map:match pattern="*.html">
>          <map:aggregate element="site">
>            <map:part src="cocoon:/menu-{0}"/>
>            <map:part src="cocoon:/body-{0}"/>
>          </map:aggregate>
>     <map:transform type="encodeURL"/>
> [...]
>        </map:match>
>
> with something like this:
>
> <map:match pattern="pattern="*.html"">
>    <map:generate src="aggregation.xml"/>
>    <map:transform type="cinclude">
> <map:parameter name="value" value="{1}"/>
>    </map:transform>
>    [...]
> </map:match>
>
> <site xmlns:cinclude="http://apache.org/cocoon/include/1.0">
>      <cinclude:include src="cocoon:/menu-{value}"/>
>      <cinclude:include src="cocoon:/menu-{value}"/>
> </site>
>
> Thank you for helpfull ideas,
>
> Björn Voigt
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


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