Closed Bug 265410 Opened 20 years ago Closed 20 years ago

setParameter() method of XSLTProcessor don't work

Categories

(Core :: XSLT, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: surkov, Assigned: peterv)

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616

1) I try setParameter() and pass null as a first argument. I get exception
("Component returned failure code: 0x80600008
[nsIXSLTProcessor.transformToFragment]") when trasformTo...() method is called.
2) If I call setParameter() and pass namespace
"http://www.w3.org/1999/XSL/Transform" as a first argument then parameter will
not be setted.

It is independent of importStylesheet() method call point.

Reproducible: Always
Steps to Reproduce:
Attached file xml file
Attached file xsl file
Attached file main
(In reply to comment #0)
> 2) If I call setParameter() and pass namespace
> "http://www.w3.org/1999/XSL/Transform" as a first argument then parameter will
> not be setted.

Are you sure it is not set? Can you try with xsl:copy-of? It seems like you set
it as a stringvalue but you use it as a nodeset.
In the stylesheet, you reference 
<xsl:for-each select="$path">
which expects the non-namespaced parameter "path" to hold a nodeset. That is
not supported for external parameters just yet, that's bug 248025.

xslProcessor.setParameter("http://www.w3.org/1999/XSL/Transform", "path",
"messages/message[@type='error']");

actually sets xsl:path (DONT, please) to a string value. Not a nodeset.

Everything works as expected, besides the fact that we can't pass nodes :-/
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
I can't understand. Why does <xsl:for-each select="$path"> expect nodeset not
string? I guess it is not evident. I expect when I set string parameter then all
parameters entries in xslt is replaced by value of passed string. In this case
we get xslt document in witch value of passed string is located on place of
parameter.
In other words I expect from setParameter() method for behaviour like:

var path="messages/message[@type='warning']";
xslDoc.getElementsByTagName("param")[0].setAttribute("select", path);
http://www.w3.org/TR/xslt#element-for-each says

<xsl:for-each
  select = node-set-expression>

The variable references are not replaced, but they are expressions in their own
sense.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: