You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Fergus Gallagher <Fe...@OrbisUK.com> on 2000/11/06 18:27:06 UTC
Problems setting xsl:param from processor
I have a stylesheet with
<xsl:param name="foo" select="'bar'"/>
and later
<xsl:value-of select="$foo"/>
which does the job. However, when I try to set the parameter in the
calling Java
processor.setStylesheetParam("foo","newVal");
processor.process(
new XSLTInputSource(....),
new XSLTInputSource(....),
new XSLTResultTarget(....));
The value is always the empty string "".
Can anyone help?
Thanks
Fergus
--
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717
Re: Problems setting xsl:param from processor
Posted by "Chris P. McCabe" <ch...@choicehotels.com>.
Try this instead:
processor.setStylesheetParam("foo", new XString("newVal"));
Or this:
processor.setStylesheetParam("foo", "'newVal'");
(note the extra set of quotes)
The setStylesheetParam method that takes a string as a second argument
is expecting an expression, so in your case it will look for a node
called 'newVal'.
Hope this helps,
Chris
Fergus Gallagher wrote:
> I have a stylesheet with
>
> <xsl:param name="foo" select="'bar'"/>
>
> and later
>
> <xsl:value-of select="$foo"/>
>
> which does the job. However, when I try to set the parameter in the
> calling Java
>
> processor.setStylesheetParam("foo","newVal");
> processor.process(
> new XSLTInputSource(....),
> new XSLTInputSource(....),
> new XSLTResultTarget(....));
>
> The value is always the empty string "".
>
> Can anyone help?
>
> Thanks
>
> Fergus
>
> --
> Fergus Gallagher
> Orbis
> http://www.orbisuk.com/
> +44-(0)20-8987 0717
--
Chris P. McCabe - Senior Software Systems Architect
Choice Hotels International - Information Technology
chris_mccabe@choicehotels.com 602-953-4416
Re: Problems setting xsl:param from processor
Posted by Gary L Peskin <ga...@firstech.com>.
Fergus Gallagher wrote:
>
> I have a stylesheet with
>
> <xsl:param name="foo" select="'bar'"/>
>
> and later
>
> <xsl:value-of select="$foo"/>
>
> which does the job. However, when I try to set the parameter in the
> calling Java
>
> processor.setStylesheetParam("foo","newVal");
> processor.process(
> new XSLTInputSource(....),
> new XSLTInputSource(....),
> new XSLTResultTarget(....));
>
> The value is always the empty string "".
setStyleSheetParam is expecting a string representing an XPath. You're
trying to select all newVal nodes. Try
processor.setStylesheetParam("foo", "'newVal'");
Notice the apostrophes inside the quotes, just like your xsl:param
expression.
HTH,
Gary