You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Klaasen Tom <To...@the-ecorp.com> on 2001/02/26 15:40:53 UTC

[C2] Parameters for generators

Hi,

I'm trying to setup a pipeline in the sitemap that allows to get different
XML documents depending on the language. Each document exists in several
languages, and I want to get the one specified by the language entry in e.g.
a cookie.

My idea to proceed was something like this:

   <map:match pattern="mydoc.html">
 	<map:act type="lang_select">
		<map:generate type="slide" src="mydoc.xml">
			<language map:value="{lang}"/>
		</map:generate>
	</map:act>
 
   	<map:transform type="xslt" src="stylesheets/simple.xsl"/>
   	<map:serialize type="html"/>
   </map:match>

The generator of type "slide" is a generator written by us to get content
from an api we built on top of the slide repository.

Unfortunately, I don't seem to be able to get a hold on the "language"
parameter I specify. Also setting it as an attribute doesn't seem to be a
solution, since a Generator can only take the "src" attribute in account.

Is there
(a) a reason for the hard-coding of only one available parameter;
(b) a workaround for this;
(c) another solution that will work under C2?

Thanks for your comments,

tomK

Re: [C2] Parameters for generators

Posted by Giacomo Pati <gi...@apache.org>.
Klaasen Tom wrote:
> Hi,
>
> I'm trying to setup a pipeline in the sitemap that allows to get different
> XML documents depending on the language. Each document exists in several
> languages, and I want to get the one specified by the language entry in
> e.g. a cookie.
>
> My idea to proceed was something like this:
>
>    <map:match pattern="mydoc.html">
>  	<map:act type="lang_select">
> 		<map:generate type="slide" src="mydoc.xml">
> 			<language map:value="{lang}"/>

Have you tried using

  <parameter name="language" value="{lang}"/>

I'm quite sure the sitemap engine will replaces value attribute of parameters 
with variables. I'm not sure if the syntax you are using (<language 
map:value="{lang}"/> is still valid (it will be parsed but no replacement 
takes place) because it had a FIXME from myself noting that it might be old 
syntax. 

I've committed a patch that fixes that but want to hear if the syntax Tom has 
used is still somthing you all would like to further support.

Giacomo

> 		</map:generate>
> 	</map:act>
>
>    	<map:transform type="xslt" src="stylesheets/simple.xsl"/>
>    	<map:serialize type="html"/>
>    </map:match>
>
> The generator of type "slide" is a generator written by us to get content
> from an api we built on top of the slide repository.
>
> Unfortunately, I don't seem to be able to get a hold on the "language"
> parameter I specify. Also setting it as an attribute doesn't seem to be a
> solution, since a Generator can only take the "src" attribute in account.
>
> Is there
> (a) a reason for the hard-coding of only one available parameter;
> (b) a workaround for this;
> (c) another solution that will work under C2?
>
> Thanks for your comments,
>
> tomK
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

Re: [C2] Parameters for generators

Posted by Davanum Srinivas <di...@yahoo.com>.
Tom,

Did you try the following?

  	<map:act type="lang_select">
 		<map:generate type="slide" src="mydoc.{lang}.xml">
 		</map:generate>
 	</map:act>
  
Thanks,
dims

--- Klaasen Tom <To...@the-ecorp.com> wrote:
> Hi,
> 
> I'm trying to setup a pipeline in the sitemap that allows to get different
> XML documents depending on the language. Each document exists in several
> languages, and I want to get the one specified by the language entry in e.g.
> a cookie.
> 
> My idea to proceed was something like this:
> 
>    <map:match pattern="mydoc.html">
>  	<map:act type="lang_select">
> 		<map:generate type="slide" src="mydoc.xml">
> 			<language map:value="{lang}"/>
> 		</map:generate>
> 	</map:act>
>  
>    	<map:transform type="xslt" src="stylesheets/simple.xsl"/>
>    	<map:serialize type="html"/>
>    </map:match>
> 
> The generator of type "slide" is a generator written by us to get content
> from an api we built on top of the slide repository.
> 
> Unfortunately, I don't seem to be able to get a hold on the "language"
> parameter I specify. Also setting it as an attribute doesn't seem to be a
> solution, since a Generator can only take the "src" attribute in account.
> 
> Is there
> (a) a reason for the hard-coding of only one available parameter;
> (b) a workaround for this;
> (c) another solution that will work under C2?
> 
> Thanks for your comments,
> 
> tomK
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/