You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Upayavira <uv...@upaya.co.uk> on 2004/03/29 16:29:51 UTC

What is an anchor?

I've just finished implementing my nested VariableResolver. No idea 
whether it works, though - that bit comes next.

Anyway, one thing in the existing PreparedVariableResolver is an Anchor 
variable. I've never come across these. Can someone give me an example 
of how they might work, so that I can make sure they still work with the 
new VariableResolver?

Thanks,

Upayavira



Re: What is an anchor?

Posted by Upayavira <uv...@upaya.co.uk>.
Sylvain Wallez wrote:

> Upayavira wrote:
>
>> I've just finished implementing my nested VariableResolver. No idea 
>> whether it works, though - that bit comes next.
>>
>> Anyway, one thing in the existing PreparedVariableResolver is an 
>> Anchor variable. I've never come across these. Can someone give me an 
>> example of how they might work, so that I can make sure they still 
>> work with the new VariableResolver?
>
>
>
> This is a little-know feature that allows to put a "name" attribute on 
> sitemap statements declaring variables (matchers & actions) and then 
> refer to the sitemap variables provided by these components using an 
> anchor-like notation instead of crawling up the variable stack using 
> "../../..".
>
> There was a lot of discussions about the good syntax for this feature, 
> and you may find more about it at [1] and the surrounding thread.
>
> Basically, this allows to write:
> <map:act type="locale" name="i18n">
>  <map:match pattern="*.html">
>    <!-- notice the use of "#i18n" below -->
>    <map:generate src="{1}-{#i18n:locale}.xml"/>
>    ... 

Ah, splendid. That's great. That looks simple enough to implement.

Regards, Upayavira



Re: What is an anchor?

Posted by Sylvain Wallez <sy...@apache.org>.
Upayavira wrote:

> I've just finished implementing my nested VariableResolver. No idea 
> whether it works, though - that bit comes next.
>
> Anyway, one thing in the existing PreparedVariableResolver is an 
> Anchor variable. I've never come across these. Can someone give me an 
> example of how they might work, so that I can make sure they still 
> work with the new VariableResolver?


This is a little-know feature that allows to put a "name" attribute on 
sitemap statements declaring variables (matchers & actions) and then 
refer to the sitemap variables provided by these components using an 
anchor-like notation instead of crawling up the variable stack using 
"../../..".

There was a lot of discussions about the good syntax for this feature, 
and you may find more about it at [1] and the surrounding thread.

Basically, this allows to write:
<map:act type="locale" name="i18n">
  <map:match pattern="*.html">
    <!-- notice the use of "#i18n" below -->
    <map:generate src="{1}-{#i18n:locale}.xml"/>
    ...
  </map:match>
</map:act>

Sylvain

[1] http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=103444203330586&w=2

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }