Re: Passing an XPath Expression to an parameter

"PackerBronco" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
Jonas,

First, thank you very much for taking the time to respond.

I tried your test document and that failed on my version of Firefox. The error message in the JavaScript console was:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXSLTProcessor.transformToDocument]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: etc.  :: runTest :: line 24"  data: no]

and there was no alert box because of the failure. However this was on Firefox 1.07. Taking your hint I tried it on Firefox 1.5 and it worked.

So you made my day. Thank you!!!

/ Patrick
  "Jonas Sicking" <[email protected]> wrote in message news:[email protected]...
  PackerBronco wrote:
  > 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.

  That should work just fine. What version of Firefox are you using? Make 
  sure that you use the right name for the parameter and that your 
  expression evaluates correctly.

  > 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.)

  Yep, if you set the parameter to a string we'll use that as the value. 
  You can use numbers booleans and nodes too. I've attached a small 
  testcase that works fine.

  / Jonas



------------------------------------------------------------------------------


  myDoc

_______________________________________________
dev-tech-xml mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xml
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.