Re: XSLT functions in XPath
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format