You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Robinson Simon <Si...@newton.co.uk> on 2002/12/18 14:00:22 UTC
How to pass parameters from JSP into a transformation
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
Re: How to pass parameters from JSP into a transformation
Posted by Simon Kitching <si...@ecnetwork.co.nz>.
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 <si...@ecnetwork.co.nz>