cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ROSSEL Olivier <>
Subject RE: ServerPageAction: XMLFragment reuse in XSL transformer
Date Fri, 18 Oct 2002 06:49:25 GMT
May be you can try to import a XML fragment via the document() XSL function.
Calling a cocoon:/ URL, you will get the XML fragment in a variable inside
your XSL.
Neat and very efficient !!!

-----Message d'origine-----
De: Christian Kurz []
Date: vendredi 18 octobre 2002 08:42
Objet: Re: ServerPageAction: XMLFragment reuse in XSL transformer

Thank you very much for the quick feed-back! The idea sounds great and is a
lot cleaner, than fiddling something in some XSL extension.
I am not sure about the cachaebility: the XMLFragment specifying, which
nodes to filter from the big input document, changes everytime, so Cocoon
would need to parse the source file on every request (, if my understanding
is right).
If I'd slidely change your approach to implementing the same approach into a
transformer component. This transformer component will not be cacheable, but
at least the generator in front of it would be.
Thanks again,
BTW, thanks also for the code snippet. It helps a lot, as soon as it comes
to thinks like the ObjectModel, I start feeling uncomfortable.
----- Original Message ----- 

From: Hunsberger, Peter <>  
To: '' <mailto:''>  
Sent: Thursday, October 17, 2002 6:46 PM
Subject: RE: ServerPageAction: XMLFragment reuse in XSL transformer

There's probably about half a dozen ways to do this.  Perhaps one of the
simplest is just to create your own caching generator and use aggregation
(with any other XML you may need) in the pipeline.
In the generator you'll need to implement the setup method to see the
objectModel, something like the following:
private gunk mySessionData = null;
public void setup( SourceResolver resolver, Map objectModel, String src,
Parameters parms )
      throws ProcessingException,  SAXException,   IOException
     if (mySessionData == null ) {
          super.setup( resolver, objectModel, src, parms );
          Request request =
          Session session = request.getSession(false);
          if (session != null)  {
            // save a pointer to your session data for use in the generate
            mySessionData = ....
Now in your generate method just pick up whatever data hangs off of
"mySessionData" and away you go
-----Original Message-----
From: Christian Kurz []
Sent: Thursday, October 17, 2002 11:26 AM
Subject: ServerPageAction: XMLFragment reuse in XSL transformer

Hello cocoon-users,

I need to generate some tiny XML elements (XMLFragment) within a
ServerPageAction and I would like to use this XMLFragment later on in an XSL
transformer, that is fed by an xml generator. The XMLFragment captured in
the ServerPageAction is basically saying, which nodes are to be returned
from the big input document.
From some other message in this group I have understood, that passing
objects is only possible through session or request objects, but not through
sitemap variables. I don't like to use a request generator as the starting
point of the pipeline, as I'd loose cacheability at a very early step in the
pipeline. With a quite big xml input document, this does not seem a good
idea to me.
So I am currently struggling how to get a piece of XML, that is attached to
a session or request object, into the xsl transformer. Has anybody tried
this before e.g. using an XSL extension?
Any help or hints appreciated!
Thank you in advance,

This e-mail is intended only for the above addressee. It may contain
privileged information. If you are not the addressee you must not copy,
distribute, disclose or use any of the information in it. If you have
received it in error please delete it and immediately notify the sender.
Security Notice: all e-mail, sent to or from this address, may be
accessed by someone other than the recipient, for system management and
security reasons. This access is controlled under Regulation of
Investigatory Powers Act 2000, Lawful Business Practises.

Please check that your question  has not already been answered in the
FAQ before posting.     <>

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

View raw message