cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <gree...@hotmail.com>
Subject Re: caching woes
Date Wed, 13 Sep 2000 00:06:43 GMT
Miloslaw Smyk <thorgal@amiga.com.pl> wrote:
>Robin Green wrote:
>
> > >Same here, everything (editor/jserv/db) is on one machine. And I 
>_always_
> > >have to touch the *.xml to force recreation of the producer.
>

[snip]
> > Or are you saying that when you change something that the .xml file 
>depends
> > on, you have to touch the .xml file? That's quite different - XSP has no
> > support for dependency tracking. What are you changing?
>
>My processing path looks like this:
>
>acp.xml --> acp-xsp.xsl --> acp-html.xsl

Ah! Of course! I forgot about that way of doing things - I used to do that 
but not any more.


>When I modify acp.xml, everythings works like expected -- classes are
>recreated. Changing any of .xsl files isn't noticed however and I have to
>touch acp.xml to force the recompilation. From earlier discussion I 
>inferred
>that it's not the correct behaviour, but obviously I could be wrong.

Ideally that should work, but it doesn't. Sorry but this is a complex issue 
and I don't have time to give a good response right now, now that a new 
Cocoon release seems to be imminent.

This is basically a Cocoon design issue. XSPProcessor is really a Producer 
in disguise. It should recompile when page.hasChanged is true (excluding the 
XSP stage itself and later stages from the calculation!), but it doesn't.

I have looked at the code and I think it requires an approx. 10-line hack to 
fix. I think. Maybe I will have time to write and test this before the 
imminent next release, but don't hold your breath.

I have a workaround but it's non-trivial, so you may not be able/willing to 
do this to all your xml and xsl files. But I'm posting it just in case it's 
useful. To illustrate the workaround I've attached a modified version of 
clean-page.xml and its stylesheet from the Cocoon XSP samples. As you can 
see it's a pain - you lose total content-logic separation.

One advantage is, however, this technique is in a sense more 
"forward-compatible" with Cocoon 2, where preprocessing before XSP (except 
by logicsheets specified _at_ the XSP stage) is not permitted (or so I have 
heard) because XSP is a Generator. However C2 is not yet stable and maybe 
this design decision will be changed if there are sound reasons to do so. I 
personally am not sure about the issue.

(That last paragraph should be taken with a pinch of salt since I haven't 
even looked at Cocoon 2 yet, so I'm relying on what I've heard.)

Here are the steps I took:

1. Comment out

<!--<?cocoon-process type="xslt"?>-->
<!--<?xml-stylesheet href="page-xsp.xsl" type="text/xsl"?>-->

2. Replace them with

<?xml-logicsheet href="page-xsp.xsl"?>
<?cocoon-process type="xsp"?>

3. Wrap <page> in <xsp:page ...>

4. Change the template

  <xsl:template match="page">

to

<xsl:template match="xsp:page">

5. You MUST remove the <?cocoon-process type="xsp"?> from the logicsheet or 
you will get in an infinite loop.

6. Add a new template for matching page (just to copy it, perhaps) to 
replace the old template matching page.

I think that's everything. Okay, it sucks big time, but it works.

--
Robin



_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.

Mime
View raw message