setParameter() method of XSLTProcessor don't work

RESOLVED WORKSFORME

Status

()

Core
XSLT
RESOLVED WORKSFORME
13 years ago
13 years ago

People

(Reporter: surkov, Assigned: peterv)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

298 bytes, text/xml
Details
749 bytes, text/xml
Details
1.37 KB, application/vnd.mozilla.xul+xml
Details
(Reporter)

Description

13 years ago
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:
(Reporter)

Comment 1

13 years ago
Created attachment 162832 [details]
xml file
(Reporter)

Comment 2

13 years ago
Created attachment 162833 [details]
xsl file
(Reporter)

Comment 3

13 years ago
Created attachment 162834 [details]
main
(Assignee)

Comment 4

13 years ago
(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.

Comment 5

13 years ago
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
Last Resolved: 13 years ago
Resolution: --- → WORKSFORME
(Reporter)

Comment 6

13 years ago
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.
(Reporter)

Comment 7

13 years ago
In other words I expect from setParameter() method for behaviour like:

var path="messages/message[@type='warning']";
xslDoc.getElementsByTagName("param")[0].setAttribute("select", path);

Comment 8

13 years ago
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.