Simon,

I had xsl:param in the stylesheet already and that worked a treat. The solution 
to my problem was as you said - to use setParameter on the transform method. I 
just didn't know where or how to do it.

Thanks a lot for your help.

Regards

Simon

-----Original Message-----
From: Simon Kitching [mailto:[EMAIL PROTECTED]
Sent: 18 December 2002 20:52
To: Robinson Simon
Cc: [EMAIL PROTECTED]
Subject: Re: How to pass parameters from JSP into a transformation


G'day..

On Thu, 2002-12-19 at 02:00, Robinson Simon wrote:
> Hi All,
> 
> I have a HTML form from which I want to enable the users to select from a 
> drop down list. I then want to pass the values into a JSP page. The JSP will 
> call a bean to do the transformation of some XML using a stylesheet to select 
> the required information.
> 
> I can call the required classes using JSP tags and that returns information 
> requested. The parameters in the XSL are currently hard coded. I want to know 
> is it possible to pass the values into the transformation from the Java code 
> calling the XSL/XML.
> 
> 
> Regards
> 
> Simon

You can declare "global parameters" in your stylesheet by defining
xsl:param tags at the "top level", ie as direct children of the
xsl:stylesheet tag:

<xsl:param name="foo" select="default-value-for-foo"/>

You can then invoke method
 setParameter("foo", "special-value-for-foo");
on your Transformer object before starting the transformation.

Your stylesheet will then see the special value.

I hope this is what you were looking for.

Regards,
-- 
Simon Kitching <[EMAIL PROTECTED]>

Reply via email to