You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stefan Lüttringhaus-Kappel <st...@informatik.uni-bonn.de> on 2001/02/08 16:39:28 UTC

[C2] Using Java after the generation phase

Hi,

in a Cocoon 2 pipeline similar to

   <map:match pattern="xsp/*">
    <map:generate type="serverpages" src="docs/samples/xsp/{1}.xsp"/>
    <map:transform src="stylesheets/dynamic-page2html.xsl"/>
    <!-- HERE -->
    <map:serialize/>
   </map:match>

I would like to apply some java methods at the point marked 'HERE' or
during the XSLT-Transform.

The idea is, for example, that the generator gives me some raw data, which
I format with a stylesheet. The various stylesheets (for different output
types) add some links to the document. The URLs must be passed through
response.encodeURL() for the session to work without cookies. Other uses of
Java in the transformation phase will certainly occur.

What is a good, or even the best way, to achieve this? Just a simple
example would be great.

Stefan Lüttringhaus-Kappel


Re: [C2] Using Java after the generation phase

Posted by Paul Russell <pa...@luminas.co.uk>.
* Stefan L?ttringhaus-Kappel (stefan@informatik.uni-bonn.de) wrote :
> The idea is, for example, that the generator gives me some raw data, which
> I format with a stylesheet. The various stylesheets (for different output
> types) add some links to the document. The URLs must be passed through
> response.encodeURL() for the session to work without cookies. Other uses of
> Java in the transformation phase will certainly occur.

I'm not 100% sure what you're trying to do, but it *sounds* like your
best bet might be to write a transformer. It's relatively simple,
particularly if you're not doing much in the way of tree manipulation,
as it seems here. Simply extend:

  org.apache.cocoon.transformation.AbstractTransformer

and implement the relevent sax methods (in your case probably
startElement, endElement and character).

Hope that helps,


Paul.

-- 
Paul Russell                                 Email:   paul@luminas.co.uk
Technical Director                             Tel:  +44 (0)20 8553 6622
Luminas Internet Applications                  Fax:  +44 (0)870 28 47489
This is not an official statement or order.    Web:    www.luminas.co.uk

Re: [C2] Using Java after the generation phase

Posted by Donald Ball <ba...@webslingerZ.com>.
On Thu, 8 Feb 2001, [ISO-8859-1] Stefan L�ttringhaus-Kappel wrote:

> Hi,
>
> in a Cocoon 2 pipeline similar to
>
>    <map:match pattern="xsp/*">
>     <map:generate type="serverpages" src="docs/samples/xsp/{1}.xsp"/>
>     <map:transform src="stylesheets/dynamic-page2html.xsl"/>
>     <!-- HERE -->
>     <map:serialize/>
>    </map:match>
>
> I would like to apply some java methods at the point marked 'HERE' or
> during the XSLT-Transform.
>
> The idea is, for example, that the generator gives me some raw data, which
> I format with a stylesheet. The various stylesheets (for different output
> types) add some links to the document. The URLs must be passed through
> response.encodeURL() for the session to work without cookies. Other uses of
> Java in the transformation phase will certainly occur.
>
> What is a good, or even the best way, to achieve this? Just a simple
> example would be great.

write your own transformer. the SQL transformer might be a simple example
from which to work. the linkencoder processor from c1 might be good
inspiration as well for this particular example.

- donald