Re: [xsl] XSLT functions in XPath

Subject: Re: [xsl] XSLT functions in XPath
From: Owen Rees <owen.rees@xxxxxx>
Date: Wed, 11 Oct 2006 13:04:52 +0100
--On 11 October 2006 02:26 +0200 Victor Toni wrote:

After further investigation I noticed that Saxon's XPath implementation
(over JAXP) had difficulties to deal with "random" XPath results as
context since "net.sf.saxon.dom.DOMNodeList" implements "NodeList" but
not "Node":

If you use the Java 5 XPath implementation (which is a version of Xerces) then you will find yourself getting "com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList" as the result of xpath.evaluate(path,context,XPathConstants.NODESET). This also implements "NodeList" but not "Node".


If you supply this as context to another call like that then if the path is "." it will work but if the path is "*" you get "javax.xml.transform.TransformerException: Unknown error in XPath." caused by a NullPointerException.

Although the JAXP 1.3 spec suggests that you can use a node list as the context in a call to 'evaluate' it does not explain what that means. The XPath specifications do not suggest any meaning for a context consisting of a list of nodes.

--
Owen Rees
Hewlett Packard Laboratories, Bristol, UK

Current Thread