You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Gary L Peskin <ga...@firstech.com> on 2001/03/09 23:29:36 UTC

Re: Extension Functions & Transformation Thread in J2EE. Passing Context to Extenuation Functions explicitly via Transformer

> "Roytman, Alex" wrote:
> 
> Garry,
> 
> In J2EE and similar system many things are sensitive to where (in what
> context, thread) it got instantiated or on which thread they are
> running. In some cases you cant even pass them from
> one thread to another because when queried by the other thread they
> will yield different result
> Consider ThreadLocal for instance
> Good example is a creation of javax.naming.InitialContext() which
> represents EJB environment - it does not take any parameters but the
> resulting instance will be bean specific etc.
> 
> I you fix only the part of the bug which allows <xsl:.....> to access
> undeclared parameter
> and still let an extension to access a top level parameter which was
> not declared in stylesheet but was set with transformer.setParameter()
> then it will make it an easy way to pass information to an extension
> 
> So a bug will become a nice feature.
> 
> !!!! I hope there will be no change in setParameter() behavior - now
> it does not rise any exception when we set undeclared parameter on
> transformer. Changing it to rise an exception will be a disaster
> 
> Alex

Alex --

I haven't changed setParameter() at all.  But I think that getVariable()
is changed in that it will now work correctly.  In other words, it will
return an error message if your parameter set with setParameter() has
not be "received" by your stylesheet.  This is in keeping with the XSLT
Spec section 11.6:  "It is not an error to pass a parameter x to a
template that does not have an xsl:param element for x; the parameter is
simply ignored."

To rememdy this, you should include an xsl:param at the top level of
your stylesheets to receive the parameter you are passing with
setParameter.  Otherwise, it is "simply ignored.".

You should, however, be able to get to it with
Transformer.getParameter().  This is just a standard part of TRaX.

Gary