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 [Proposal]: Advanced Value Substitution
Date Tue, 08 Oct 2002 08:35:50 GMT
Hi,

here is a simple proposal for an easier value substitution algorithm
in the sitemap.

Currently, if you nest actions and matchers you have to aware of
the paths to get your information:
<match pattern="**">
  <act type="anything">
      <read src="{directory}/{../1}"/>
  </act>
</match>

This can get very complicated. When I first got contact with value
substitution more than two years ago, I thought I could write:
<read src="{directory}/{1}"/>

The two components use different keys, so there is no conflict and
the values can be resolved.
This is in accordence to usual programming languages where a
variable is not only searched in the current scope but also
in the parent scope:
{
   int i;
   {
      int x;
      i = 5;
   }
}
Only if you have conflicts, which means you define a variable with
the same name in the inner block and want to use a variable with
the same name of an outer block you have to define the complete
path.

So, keeping this short, I propose to change the search algorithm
for value substitution:
If a key is not found in the inner block, the search is continued
up the chain. 
So in the above example {1} is first searched in the values
delivered by the action - not found there - and then searched
in the values by the matcher. 
The old path syntax is untouched - so no compatibility problems
but easier handling.

What do you think?

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