You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tuomo L <tl...@cc.hut.fi> on 2004/02/04 13:47:48 UTC

Simple parameter substitution not working in sub-sitemap?

Hi,

Haven't done this for a while, but why doesn't it work?

<map:match pattern="*.*">
  <map:generate src="{1}.{2}"/>
  <map:serialize type="{2}"/>
</map:match>

When trying: test.html , I get:

Type '{2}' is not defined for 'serialize' at...

I'm working in a sub-sitemap.

-Tuomo

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


RE: Simple parameter substitution not working in sub-sitemap?

Posted by Reinhard Poetz <re...@apache.org>.
From: news [mailto:news@sea.gmane.org]

> > This had nothing to do with setting parameters but with 
> variables in 
> > @type attributes. AFAIK you can't set the type of a 
> pipeline component 
> > (generators, transformers, serializers) using a variable or 
> an input 
> > module.
> > 
> I see now. But it does make sense to have this functionality IMHO.
> 
> Imagine Tuomo's usecase a bit more extended
> 
> <map:match pattern="*.*">
>    <map:generate src="{1}.{2}"/>
>    <map:transform type="{2}"/>
>    <map:serialize type="{2}"/>
> </map:match>
> 
> Using the old syntax this becomes
> 
> <map:match pattern="*.*">
>     <map:select type="parameter">
>       <map:parameter name="parameter-selector-test" value="{2}"/>
> <!-- for each possible file extension you need to have this block -->
>       <map:when test="svg">
>         <map:generate src="{1}.{2}"/>
>         <map:transform type="svg"/>
>         <map:serialize type="svg"/>
>       </map:when>      	
>       <map:when test="video">
>         <map:generate src="{1}.{2}"/>
>         <map:transform type="video"/>
>         <map:serialize type="video"/>
>       </map:when>
>       ......
>     </map:select>
> </map:match>
> 
> Or is there a better way to translate above usecase to sitemap syntax?

Not that I know.
But also don't forget that you can't set default values. 

If it is important for anyone check the archives for the reasons. I
guess this issue hasn't come up the first time. 
If you don't find anything or you're not satisfied with the explanations
you can ask on dev@ for the reasons why  variable substituion is not
allowed in @type attributes.

Best,
Reinhard


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


Re: Simple parameter substitution not working in sub-sitemap?

Posted by Jorg Heymans <jh...@domek.be>.
> 
> 
> This had nothing to do with setting parameters but with variables in
> @type attributes. AFAIK you can't set the type of a pipeline component
> (generators, transformers, serializers) using a variable or an input
> module.
> 
I see now. But it does make sense to have this functionality IMHO.

Imagine Tuomo's usecase a bit more extended

<map:match pattern="*.*">
   <map:generate src="{1}.{2}"/>
   <map:transform type="{2}"/>
   <map:serialize type="{2}"/>
</map:match>

Using the old syntax this becomes

<map:match pattern="*.*">
    <map:select type="parameter">
      <map:parameter name="parameter-selector-test" value="{2}"/>
<!-- for each possible file extension you need to have this block -->
      <map:when test="svg">
        <map:generate src="{1}.{2}"/>
        <map:transform type="svg"/>
        <map:serialize type="svg"/>
      </map:when>      	
      <map:when test="video">
        <map:generate src="{1}.{2}"/>
        <map:transform type="video"/>
        <map:serialize type="video"/>
      </map:when>
      ......
    </map:select>
</map:match>

Or is there a better way to translate above usecase to sitemap syntax?

rgds
Jorg


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


RE: Simple parameter substitution not working in sub-sitemap?

Posted by Reinhard Poetz <re...@apache.org>.
From: news [mailto:news@sea.gmane.org]

> parameter substitution does not work for serializers for some reason.
> 
> Recently the serializers have been changed to be able to 
> receive sitemap 
> parameters - @developers: is there a reason why the serializer is 
> excluded from sitemap parameter substitution?

This had nothing to do with setting parameters but with variables in
@type attributes. AFAIK you can't set the type of a pipeline component
(generators, transformers, serializers) using a variable or an input
module.

--
Reinhard

> 
> Tuomo L wrote:
> 
> > Hi,
> > 
> > Haven't done this for a while, but why doesn't it work?
> > 
> > <map:match pattern="*.*">
> >   <map:generate src="{1}.{2}"/>
> >   <map:serialize type="{2}"/>
> > </map:match>
> > 
> > When trying: test.html , I get:
> > 
> > Type '{2}' is not defined for 'serialize' at...
> > 
> > I'm working in a sub-sitemap.
> > 
> > -Tuomo
> 
> 
> ---------------------------------------------------------------------
> 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


Re: Simple parameter substitution not working in sub-sitemap?

Posted by Jorg Heymans <jh...@domek.be>.
parameter substitution does not work for serializers for some reason.

Recently the serializers have been changed to be able to receive sitemap 
parameters - @developers: is there a reason why the serializer is 
excluded from sitemap parameter substitution?

Tuomo L wrote:

> Hi,
> 
> Haven't done this for a while, but why doesn't it work?
> 
> <map:match pattern="*.*">
>   <map:generate src="{1}.{2}"/>
>   <map:serialize type="{2}"/>
> </map:match>
> 
> When trying: test.html , I get:
> 
> Type '{2}' is not defined for 'serialize' at...
> 
> I'm working in a sub-sitemap.
> 
> -Tuomo


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


RE: Simple parameter substitution not working in sub-sitemap?

Posted by Tuomo L <tl...@cc.hut.fi>.

On Wed, 4 Feb 2004, Reinhard Poetz wrote:

>
> From: Tuomo L
>
> > Haven't done this for a while, but why doesn't it work?
> >
> > <map:match pattern="*.*">
> >   <map:generate src="{1}.{2}"/>
> >   <map:serialize type="{2}"/>
> > </map:match>
> >
> > When trying: test.html , I get:
> >
> > Type '{2}' is not defined for 'serialize' at...
> >
> > I'm working in a sub-sitemap.
>
> Tuomo,
>
> replacing the type attribute is not supported. Use a selector instead.
>

Well, my application has dozens of sub-sitemaps, and I wouldn't like to
write this map:select section in each of them. I thought of calling a
resource located at the parent sitemap, but it's not supported either!
Maybe I have to generate my sitemaps dynamically by using cinclude. What
do you think? Does it slow down the whole app?

-Tuomo

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


RE: Simple parameter substitution not working in sub-sitemap?

Posted by Reinhard Poetz <re...@apache.org>.
From: Tuomo L

> Haven't done this for a while, but why doesn't it work?
> 
> <map:match pattern="*.*">
>   <map:generate src="{1}.{2}"/>
>   <map:serialize type="{2}"/>
> </map:match>
> 
> When trying: test.html , I get:
> 
> Type '{2}' is not defined for 'serialize' at...
> 
> I'm working in a sub-sitemap.

Tuomo,

replacing the type attribute is not supported. Use a selector instead.

--
Reinhard


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