cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Deprecation of CInclude transformer
Date Fri, 23 Nov 2007 09:03:51 GMT


> Vadim Gritsenko wrote: 
> 
> Have you seen this part?
> 
>   return key == null? "I": "I" + key;
>      }
> 

I never realized this specifically, but used to solve it similar (see
below) 

> 
> All you need to do is to pass in extra key:
> 
>   <map:match pattern="main">
>     <map:generate src="someXML.xml"/>
>     <map:transform type="include">
>       <map:parameter name="key" value="{request-param:strange}"/>
>     </map:transform>
>     <map:serialize/>
>   </map:match>

True, and as a matter of fact, you can put the key in *any* of the
generators (if they put the parameters in the cachekey) *or* any of the
transformers (which i used to do, but in the include transformer makes
more sense) (again if the honour the parameters in the cachekey
ofcourse). All that matters is that the parameter gets accounted for.
But still, there are other cases where you might not get away with this
'adding a key parameter'. Think about the usecase that instead of some
selector with a query-param, you use a resource-exist-selector. You
cannot account for this in the include transformer with a parameter (or
i think you have to add this input module...though it may be around
already. I can't remember from the top of my head) 

> 
> Hopefully information above helps you to keep them caching :)
> 

I would certainly recommend so :-) The thing I wanted to point out, is
that when using the IncludeTransformer, you might need to really
understand how cocoon's caching work, and how cachekeys are being
created. It is in fact really simple, but I have just seen to many times
pipelines like these:

 <map:pipeline type="caching">
	<map:match pattern="common-used-part">
		<map:generate src="foo.xml"/>
		<map:transform src="bar.xsl>
			<map:parameter name="{date:yyyyMMddHHddmmss}"/>
		</map:transform/>
	</map:match/>
 </map:pipeline> 

total useless cache....or my favorite:

 <map:pipeline type="caching">
	<map:match pattern="common-used-part">
		<map:generate src="foo.xml"/>
		<map:transform src="bar.xsl>
			<map:parameter name="{header:Referer}"/>
		</map:transform/>
	</map:match/>
 </map:pipeline> 

Anyway, bottomline is that the InludeTransformer is IMO definitely the
one to use. 

Regards Ard

Mime
View raw message