You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sanket Pattekar <sa...@gmail.com> on 2006/05/15 13:13:39 UTC

Using jx template generator

Hi,

I am using jx template generator.

I am passing a parameter called language from cocoon sitemap. The
values to this could be en, nl or some thing different.

<map:generate type="jx" src="test/test.xml">					<map:parameter
name="lang" value="en"/>
</map:generate>

Based on the lang value I need to create a tag, for example if value
is en, then I need to create a xml element called

<h:title-en/>

and if the lang value is nl, then I need to create a xml element called

<h:title-nl/>

I know this is possible to do in the jx file, but doesnot know how to
do the same

Sanket.

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


Re: Using jx template generator

Posted by "John L. Webber" <jo...@jentro.com>.
One way of doing this would be using jx:set and jx:if in your template:

<jx:set var="lang" value="${cocoon.parameters.lang}"/>

Then at the point where you need the special tags:

<jx:if test="${lang == 'en'}">
 <h:title-en/>
</jx:if

and so on for the other custom tags. Using jx:choose and jx:when would
of course work too.

I imagine there must be a more elegant way of solving the problem...

Hope that helps,

John

Sanket Pattekar wrote:
> I am using jx template generator.
> 
> I am passing a parameter called language from cocoon sitemap. The
> values to this could be en, nl or some thing different.
> 
> <map:generate type="jx" src="test/test.xml">                   
> <map:parameter
> name="lang" value="en"/>
> </map:generate>
> 
> Based on the lang value I need to create a tag, for example if value
> is en, then I need to create a xml element called
> 
> <h:title-en/>
> 
> and if the lang value is nl, then I need to create a xml element called
> 
> <h:title-nl/>
> 

-- 
---------------------------------------------------------
 Jentro Technologies GmbH
 John L. Webber, Software Development
---------------------------------------------------------
 Rosenheimer Str. 145e	    81671 München
 Tel. +49 89 189 169 80     mailto:John.Webber@jentro.com
 Fax  +49 89 189 169 99     http://www.jentro.com
---------------------------------------------------------
NOTICE: The information contained in this e-mail is confidential or may
otherwise be legally privileged. It is intended for the named recipient
only. If you have received it in error, please notify us immediately by
reply or by calling the telephone number above and delete this message
and all its attachments without any use or further distribution of its
contents. Please note that any unauthorised review, copying, disclosing
or otherwise making use of the information is strictly prohibited. Thank
you.
---------------------------------------------------------

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