cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Cocoon 2.1 environment objects from a Java XSLT extension
Date Wed, 10 Oct 2007 22:47:27 GMT
Yes.  There is a better method.

XSLT Extensions assist formatting.  Data collection belongs in the XML
generation phase.  Using XSLT Extensions to generate data is a very
bad practice.

What are the requirements?  You want some information for use in
creating the output.  The information is in the Request.  What
information?  How much information?  How many places will it appear?
Will different information be needed at different places?  Possible
methods include:

- Use the standard variables:

- Aggregate the RequestGenerator:
Very easy.  Most work handled with XSL.

- Custom Generator
To aggregate non-standard information.

- Custom InputModule:
To pass just a parameter.

Custom components are not difficult for your third one.  The first one
or two can be difficult due to lack of documentation and that most
environment variables are deliberately hidden to frustrate new
developers.  Cocoon blocks access to some critical parameters and
hides others in maps without access to the names of those parameters.
This may promote elitism, but may result from poor design.


On 10/10/07, Tobia Conforto <> wrote:
> I'm rewriting some functionality into Java XSLT extensions, for
> performance reasons.
> For now I'm just writing a Java class, copying it to WEB-INF/classes and
> calling its static methods from XSLT as such:
>         <xsl:value-of select="myclass:myMethod($whatever)"
>                 xmlns:myclass=""/>
> This works, but I need to access the standard Cocoon environment objects
> (Request would suffice) from my Java class.
> Should I pass the whole request object to the stylesheet as a parameter
> and then pass it on to every invocation of my methods?
> How do I pass the request object to the stylesheet?  I couldn't do it.
> Is there a better way?
> Tobia

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

View raw message