cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: Passing parameters to XSL processor
Date Fri, 17 Dec 1999 00:04:08 GMT
Michael French wrote:
> 
> Is there any way to pass request parameters to an XSL processor ?

Not yet, but this is in the todo list.
 
> The kinds of things I have in mind are mappings to
> xsl:variable, xsl:import and xsl:include, so that filtering,
> matching and styling can be dynamic.

Yes, I agree this would be a nice feature.
 
> Looking at the code (for the first time) I see the params are
> passed down to the process() and getStylesheet() methods,
> so it should be possible to add top-level nodes to the stylesheet
> in a generic (DOM) way, perhaps in AbstractXSLTProcessor.
> (or perhaps there are processor-specific init calls which bypass
> XSL DOM and write straight to the internal data structures).

No, those are not the parameters you want.

> There are caching issues, but the cache could be left unchanged,
> with init happening on-the-fly somewhere between getStylesheet()
> and process().

A better way would be to have a standard way to pass a parameter
container to the xslt processor so that it can use it. Instead of a
bunch of setParameters(), just one setParametersContainer(Dictionary)
that saves much time in case we have a lots of parameters and the xslt
is using just a few of them. (which is normally the case with servlets +
sessions + cookies)

> A more general and elegant approach would be to copy the pattern
> from SQLQueryCreator, and have a class which gets called with the
> XSL document and the parameters, and it can add any top-level nodes
> (or do anything else for that matter).

This was already proposed, but has the drawback that you have to crawl
all the request parameters (+ sessions + cookies) in order to do
something significant, it could be a serious overhead.
 
> Another interesting approach is to make the stylesheet dynamically
> generated (through a custom producer), but in that case there's no
> obvious way to chain the orginal request parameters into the nested
> stylesheet linking request.

Nah, even worse processing time...

Scott, what's the best/fastest way to pass Xalan parameters on the fly?

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche



Mime
View raw message