cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Source Resolving in Virtual Pipeline Components (was Re: [RT] Virtual Sitemap Components)
Date Mon, 19 Jul 2004 20:51:35 GMT
Carsten Ziegeler wrote:

>I'll try to summarize what we've got so far (as far as I interpret this
>thread :) ):
>  
>

<snip cause="agree"/>

>> <>Example:
>>
>> Definition (syntax and exact location still has to be defined):
>> <map:virtual-generator type="foo">
>>   <map:generate src="{src}"/>
>>    <map:act type="lang-select">
>>      <map:transform type="i18n"/>
>>    </map:act>
>>    <map:transform type="xslt" src="stylesheets/{bar}.xsl/>
>> </map:virtual-generator>
>
>>Usage:
>><map:generate type="foo" src="blah">
>> <map:parameter name="bar" value="baz"/>
>></map:generate>
>>    
>>
>
>Apart from the syntax (which we could define last), I see only two open points:
>a) are VPCs inherited to sub sitemaps I guess, we all say: "Sure"
>  
>

Sure ;-)

>b) (my favorite topic) Source Resolving
>As long as the VPC is defined in the same sitemap as it is used, we don't have a problem,
but if we answer question a) with yes, then we have a problem.
>Look at the sample from Sylvain above, now imagine the Usage is in a subsitemap.
>So the src ("blah") should refer to a source that is relative to the sitemap of the Usage.

>The VPC from above resolves two sources (the src and the stylesheet).
>The stylesheet should imho be resolved relative to the sitemap where the VPC is defined.
>
>Now, a first approach would be: all resources of VPC are resolved relative to the sitemap
where the VPC is defined. And if a src information is passed (for virtural generators or transformers)
this src information is resolved relative to the usage sitemap and then passed as an absolut
>path to the VPC.
>
>This works nicely as long as only the "src" attribute defines a resource but not a parameter.
>  
>

Mmmh... I'm not sure about this behaviour. Not all @src are actual 
sources, and some parameters are sources also. So absolutizing @src and 
not other parameters can lead to strange behaviours, or at least 
difficult to understand (and even more to explain!).

IMO, we really need the "context:/" (single slash) we talked about some 
time ago, that resolves relatively to the currently executing sitemap 
(i.e. the one defining the VPC). Relative sources (with no protocol) 
must always be resolved relative to the sitemap where the VPC is called. 
However, the implementation of some VPCs, just as in my example above, 
needs some resources to be resolved relative to the sitemap in which the 
VPC is defined.

So my example could be rewritten as follows:

<><map:virtual-generator type="foo">
  <map:generate src="{src}"/>
  <map:act type="lang-select">
    <map:transform type="i18n"/>
  </map:act>
  <map:transform type="xslt" src="context:/stylesheets/{bar}.xsl/>
</map:virtual-generator>

That way, there is no magical absolutization applied.

Thoughts?

Sylvain

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



Mime
View raw message