问题描述:

I want to expand a webservice written in java and javascript with a XSL 2.0 stylesheet. The stylesheet is based on this(XSLT 2.0: Transform notation in plain text to svg) XSL sheet and transforms plain text into svg. At the moment it is possible to transform the text from a variable or a file, but it should be possible that the user does his input into the webservice and this input is passed to the xsl sheet and then will be transformed. How would this be possible?

To give you a better understanding the desired workflow is something like this: I already have a button. When the user clicks the button a window with a textarea appears. The user inputs his plain text and after a click on a button this data should be passed to the xsl sheet from the textarea. Then the transformation should be performed and the result should be returned.

How is it possible to pass user input to the XSL sheet? Any help would be appreciated. Thanks!

网友答案:

Use transformer.setParameter("key", "value");

and within the stylesheet use <xsl:param name="key" /> at the beginning of your stylesheet.

Then you refer to it like to any other xsl variable: e.g.

<xsl:value-of select="$key"/>
相关阅读:
Top