cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: Static Params?
Date Tue, 15 Jan 2002 15:37:58 GMT

Vadim Gritsenko wrote:
>
> > From: Berin Loritsch [mailto:bloritsch@apache.org]
> >
> > In the sitemap, is it possible to create a series of parameters that
> > could be used globally?
> >
> > Basically, I am thinking something like this:
> >
> > <map:pipeline>
> >    <map:parameter name="host-uri" value="http://www.d-haven.org"/>
> >
> >    <map:match uri="paper-*/*.html">
> >      <map:generate src="docs/papers/{1}/{2}.html">
> >        <map:parameter name="static-uri" value="{host-uri}/paper-
> > {1}/{2}.html"/>
> >      </map:generate>
> >      <map:serialize/>
> >    </map:match>
> > </map:pipeline>
> >
> > Perhaps the {host-uri} might have to be like this: {../host-uri}.
>

If such a solution would be possible, it should be {../host-uri},
because with {host-uri} you would address something provided by the
matcher.

> Yes, perhaps. What are you asking reminds me of something there was
> discussion about
> (http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=100739814405987&w=2).
> That's the syntax to define sitemap variables, something like (how I
> imagine this):
>
> <map:pipeline>
>   <map:match uri="paper-*/*.html">
>     <map:variables>
>         <map:parameter name="host-uri" value="http://www.d-haven.org"/>
>
>         <map:generate src="docs/papers/{../1}/{../2}.html">
>           <map:parameter name="static-uri" value="{host-uri}/paper-
>  {1}/{2}.html"/>
>         </map:generate>
>         <map:serialize/>
>     </map: variables>
>   </map:match>
> </map:pipeline>
>
> (I moved declaration of variables inside matcher to show that it's
> possible to define map variables at any level)
>
> Unfortunately, this thread was ended with decision to add
> <map:parameter>s to <map:call>. So, there are two options now: resurrect
> this thread or to choose one of the matchers/actions to do this for you.
>

One simple solution is to write your own action which provides all
parameters
it gets to the inner elements:

<map:act type="parameter_provider">
  <map:parameter name="host-uri" value="http://www.d-haven.org"/>

  <map:match uri="paper-*/*.html">
      <map:generate src="docs/papers/{1}/{2}.html">
          <map:parameter name="static-uri"
value="{host-uri}/paper-{1}/{2}.html"/>
      </map:generate>
      <map:serialize/>
  </map:match>
</map:act>

You might call this nonsense, but the good news is: it is currently possible
and you only need to write a simple java class with 4 lines of code.

Carsten


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


Mime
View raw message