Passing an XPath Expression to an parameter

"PackerBronco" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
I'm trying to create a cross-browser solution for passing an XPath
expression to a XSLT global parameter. The XSLT global parameter is:

<xsl:param name="group" select="//person" />

What I would like to do is have users enter in a predicate expression on a
Web form such as:

name='Jones'

and then have JavaScript dynamically change the value of the group parameter
so that XSLT treats it as:

<xsl:param name="group" select="//person[name='Jones']" />

I can do this in IE using the following code:
=============
   fstring=document.webform.filter.value;
   if (fstring=="") filter="//person"
   else filter="//person["+fstring+"]";
   XMLProcessor.addParameter("group", XMLDoc.selectNodes(filter));
=============

so that the node-set is specified using the value of the filter variable and
then treated as a node-set by the group parameter.

My question is what is the equivalent approach for Mozilla?

I've tried the following approach using the XPathEvaluator class:
============
   fstring=document.webform.filter.value;
   if (fstring=="") filter="//person"
   else filter="//person["+fstring+"]";

   xEval = new XPathEvaluator();
   xNodes =
xEval.evaluate(filter,XMLDoc.documentElement,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);

   XMLProcessor.setParameter(null,"group",xNodes);
============

but that doesn't work I assume that the XPathResult object, xNodes, is not
being treated as a node-set in the setParameter() method. I've also tried to
send the filter variable to the setParameter() method, but that doesn't work
either (I assume that the group parameter treats the filter variable as a
text string rather than as an XPath expression.)

Any help would be GREATLY appreciated! Thanks.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.