cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wojciech Gdela <elteh...@poczta.onet.pl>
Subject [Fwd: Incorect xsl stylesheets caching with xsl:include and cocoon: protocol]
Date Tue, 15 Feb 2005 11:31:25 GMT
Hello,

I've asked this question on users list, but no one answered. I've also 
tried to check in source code if it is a bug, but the caching stuff is 
to complex for me. Maybe you can help me.

-------- Wiadomość oryginalna --------

Hello

I have problem with caching of xsl stylesheets. Here is a simplified
example, I have layout.xsl pipeline:

<map:match pattern="layout.xsl">
   <map:select type="host">
     <map:when test="foo">
       <map:generate src="layout_foo.xsl"/>
     </map:when>
     <map:otherwise>
       <map:generate src="layout_bla.xsl"/>
     </map:otherwise>
   </map:select>
   <map:serialize type="xml"/>
</map:match>

When I try it on browser it works correctly, and depending on host name
I see different layout_*.xsl files. This pipeline I include in a
stylesheet named test.xsl:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="cocoon:/layout.xsl"/>
</xsl:stylesheet>

Ant test.xsl is used in another pipeline:

<map:match pattern="test">
   <map:generate src="test.xml"/>
   <map:transform type="xslt" src="test.xsl"/>
   <map:serialize type="xml"/>
</map:match>

This time, when I try it in browser the request is cached and output
does not vary on host name. For example i try:
http://foo.localhost/test -> Foo layout (ok)
http://bla.localhost/test -> Foo layout (but should be Bla layout)

When i restart server and first try:
http://bla.localhost/test -> Bla layout (ok)
http://foo.localhost/test -> Bla layout (but should be Foo layout)

Simply speaking first request is cached. I've tried setting pipeline to
"noncaching" and transformer to "use-request-parameters" but with no
success (sitemap included at the end of this mail). The only way I can
solve this is turning off "use-store" for transformers in cocoon.xconf,
but I think this would reduce performance.

The question is: Am I doing something wrong? Or is it a bug in
stylesheets caching?

My sitemap is:

<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   <map:components>
	<map:transformers>
	    <map:transformer logger="sitemap.transformer.xslt" name="xslt"
pool-grow="2" pool-max="32" pool-min="8"
src="org.apache.cocoon.transformation.TraxTransformer">
	      <use-request-parameters>false</use-request-parameters>
	      <use-session-parameters>false</use-session-parameters>
	      <use-cookie-parameters>false</use-cookie-parameters>
	      <xslt-processor-role>xalan</xslt-processor-role>
	      <check-includes>true</check-includes>
	    </map:transformer>
	</map:transformers>
     <map:selectors>
       <map:selector logger="sitemap.selector.host" name="host"
         src="org.apache.cocoon.selection.HostSelector">
         <host name="foo" value="foo.rastapla"/>
         <host name="bla" value="bla.rastapla"/>
       </map:selector>
     </map:selectors>
   </map:components>
   <map:pipelines>
     <map:pipeline type="noncaching">
       <map:match pattern="layout.xsl">
         <map:select type="host">
           <map:when test="foo">
             <map:generate src="layout_foo.xsl"/>
           </map:when>
           <map:otherwise>
             <map:generate src="layout_bla.xsl"/>
           </map:otherwise>
         </map:select>
         <map:serialize type="xml"/>
       </map:match>
       <map:match pattern="test">
         <map:generate src="test.xml"/>
         <map:transform type="xslt" src="test.xsl"/>
         <map:serialize type="xml"/>
       </map:match>
     </map:pipeline>
   </map:pipelines>
</map:sitemap>

-- 
Pozdrawiam,
Wojciech Gdela.

-- 
Pozdrawiam,
Wojciech Gdela.


Mime
View raw message