cache in xslt processor

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

cache in xslt processor

James Gu
I use an external function in unsafe-xslt processor. It works well on the first time xpl is called. But the second time, I found the fucntion is not called. It seems the framework will call the function on the first time, then cache the xslt template.
After I added a debug on output data, the function is called every time. It seems it is not cached.

Is this normal in Orbeon framework?

            <p:processor name="oxf:unsafe-xslt">
                <p:input name="data">
                    <null/>
                </p:input>
                <p:input name="config">
                    <config xsl:version="2.0">
                        <base>
                            <xsl:value-of select="appctx:getNavagationFilePath('BASE')"/>
                        </base>
                    </config>
                </p:input>
                <p:output name="data" id="navigation-file-path"/>
            </p:processor>

Thanks,
James
Reply | Threaded
Open this post in threaded view
|

Re: cache in xslt processor

Erik Bruchez
Administrator
Yes, this is the expected behavior given the caching mechanisms in  
place.

In fact the cause is not that the template is cached, but that the  
input of the transformation is cached (here your <null/> document).

-Erik

On Apr 21, 2009, at 2:46 AM, JamesGu wrote:

>
> I use an external function in unsafe-xslt processor. It works well  
> on the
> first time xpl is called. But the second time, I found the fucntion  
> is not
> called. It seems the framework will call the function on the first  
> time,
> then cache the xslt template.
> After I added a debug on output data, the function is called every  
> time. It
> seems it is not cached.
>
> Is this normal in Orbeon framework?
>
>            <p:processor name="oxf:unsafe-xslt">
>                <p:input name="data">
>                    <null/>
>                </p:input>
>                <p:input name="config">
>                    <config xsl:version="2.0">
>                        <base>
>                            <xsl:value-of
> select="appctx:getNavagationFilePath('BASE')"/>
>                        </base>
>                    </config>
>                </p:input>
>                <p:output name="data" id="navigation-file-path"/>
>            </p:processor>
>
> Thanks,
> James
> --
> View this message in context: http://www.nabble.com/cache-in-xslt-processor-tp23152518p23152518.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: cache in xslt processor

James Gu
Erik,

Thank you for your information!

I removed the <null/> document and use href to refer to a instance (it is stored in session when user logins and won't be changed) but same thing happens. The function is called only on the first time.

Do you know why it is still cached?

Thanks,
James
Reply | Threaded
Open this post in threaded view
|

Re: Re: cache in xslt processor

Erik Bruchez
Administrator
> Thank you for your information!
>
> I removed the <null/> document and use href to refer to a instance  
> (it is
> stored in session when user logins and won't be changed) but same  
> thing
> happens. The function is called only on the first time.
>
> Do you know why it is still cached?

The oxf:scope-generator processor is also able to handle caching,  
that's why. I think this uses a digest of the document and/or caching  
information provided by oxf:scope-generator.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: cache in xslt processor

Alessandro Vernet
Administrator
In reply to this post by James Gu
James,

On Thu, Apr 23, 2009 at 4:48 AM, JamesGu <[hidden email]> wrote:
> Thank you for your information!
>
> I removed the <null/> document and use href to refer to a instance (it is
> stored in session when user logins and won't be changed) but same thing
> happens. The function is called only on the first time.
>
> Do you know why it is still cached?

The caching engine assumes that functions you use in XSLT (other than
doc()/document()) don't have a side-effect. It takes an optimistic
approach. When you use functions that do have a side effect, the
caching can be too aggressive. Using the contributed Cache Processor
(not shipped by default with Orbeon Forms) can help with those cases.
See in particular the paragraph "Prevent Caching" on:

http://wiki.orbeon.com/forms/contributions/cache-processor

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: cache in xslt processor

James Gu
Alex,

Thank you for your help!
I added cache processor in my application and it works well. It is not cached now.

Thanks,
James
Reply | Threaded
Open this post in threaded view
|

Re: Re: cache in xslt processor

James Gu
In reply to this post by Erik Bruchez
Erik,

Thank you very much for your help!

With Alex's help, I added a cache processor and it works well.

James
Reply | Threaded
Open this post in threaded view
|

Re: Re: cache in xslt processor

Alessandro Vernet
Administrator
In reply to this post by James Gu
James,

JamesGu wrote
Thank you for your help!
I added cache processor in my application and it works well. It is not cached now.
I a glad this helped! This is a case where you need to use the Cache processor to... well not cache. I guess it isn't worse than using the Start menu on Windows to shut down your computer :).

Alex