You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Christian Geuer-Pollmann <ma...@nue.et-inf.uni-siegen.de> on 2001/08/01 10:38:54 UTC

How to transform a NodeList into an XPath node set?

Hi all,

How can I transform an org.w3c.dom.NodeList into an XPath node set on which 
I can use XPath expressions to select nodes?

Example: I use XPathAPI.selectNodeList to get a NodeList; anter that, I 
want to apply another XPath selection to it...

Christian

Re: How to transform a NodeList into an XPath node set?

Posted by Gary L Peskin <ga...@firstech.com>.
Hmmm...

The only way that comes to mind to do what you want is to write a little
routine that applies your second XPath to each node in the node-list and
then take the union of the results.

If you want to create an XPath node-set, this is represented in XalanJ
as an org.apache.xpath.objects.XNodeSet.  You could create one of these
with

  XPathContext xctxt = new XPathContext();
  XNodeSet xns = new XNodeSet(new NodeSetDTM(myNodeList, xctxt));

However, you can't feed these into XPath or XPathAPI so I'm not sure why
you want to create it.

Gary

Christian Geuer-Pollmann wrote:
> 
> Hi all,
> 
> How can I transform an org.w3c.dom.NodeList into an XPath node set on which
> I can use XPath expressions to select nodes?
> 
> Example: I use XPathAPI.selectNodeList to get a NodeList; anter that, I
> want to apply another XPath selection to it...
> 
> Christian