Return-Path: Delivered-To: apmail-xml-cocoon-users-archive@xml.apache.org Received: (qmail 12747 invoked by uid 500); 17 Oct 2002 16:46:41 -0000 Mailing-List: contact cocoon-users-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-users@xml.apache.org Delivered-To: mailing list cocoon-users@xml.apache.org Received: (qmail 12722 invoked from network); 17 Oct 2002 16:46:41 -0000 Message-ID: <601F6322AD71D5118D6C0003472515290660D029@sjmemexc1.stjude.org> From: "Hunsberger, Peter" To: "'cocoon-users@xml.apache.org'" Subject: RE: ServerPageAction: XMLFragment reuse in XSL transformer Date: Thu, 17 Oct 2002 11:46:25 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C275FC.BB69B2B0" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C275FC.BB69B2B0 Content-Type: text/plain; charset="iso-8859-1" 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 = (Request)ObjectModelHelper.getRequest(objectModel); Session session = request.getSession(false); if (session != null) { // save a pointer to your session data for use in the generate method mySessionData = .... } } } Now in your generate method just pick up whatever data hangs off of "mySessionData" and away you go -----Original Message----- From: Christian Kurz [mailto:crkurz@gmx.de] Sent: Thursday, October 17, 2002 11:26 AM To: cocoon-users@xml.apache.org 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, Christian ------_=_NextPart_001_01C275FC.BB69B2B0 Content-Type: text/html; charset="iso-8859-1"
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 = (Request)ObjectModelHelper.getRequest(objectModel);
          Session session = request.getSession(false);
          if (session != null)  {
            // save a pointer to your session data for use in the generate method
            mySessionData = ....
         }
      }
   }  
 
Now in your generate method just pick up whatever data hangs off of "mySessionData" and away you go
 
-----Original Message-----
From: Christian Kurz [mailto:crkurz@gmx.de]
Sent: Thursday, October 17, 2002 11:26 AM
To: cocoon-users@xml.apache.org
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,
Christian
------_=_NextPart_001_01C275FC.BB69B2B0--