Hi Gary, Thanks for the quick response. Yes, it appears that I made an incorrect assumption. It looks like the problem doesn't have anything to do with xalan:evaluate(). I am passing a node-set consisting of multiple root nodes (a "database" of documents) as a global parameter to my stylesheet using XNodeSet. So instead of the original stylesheet I posted, consider the following modified stylesheet (which doesn't use xalan:evaluate(), a red herring): <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:foo="http://dummyNamespace.com"> <xsl:param name="input"/> <xsl:template match="/"> <xsl:copy-of select="$input/foo:bar"/> </xsl:template> </xsl:stylesheet> Below are some snippets from the code I am using to invoke this (some variables initialized elsewhere): private DocumentBuilderFactory bFactory; private Hashtable database = new Hashtable(); private XNodeSet nodeSet; private File databaseDir; . . . String[] fileNames = databaseDir.list(); for (int i = 0; i < fileNames.length; i++) { File file = new File(databaseDir, fileNames[i]); if (!file.isDirectory()) { DocumentBuilder builder = bFactory.newDocumentBuilder(); Document doc = builder.parse(file); database.put(fileNames[i], doc); } } NodeSet tempNodeSet = new NodeSet(); Enumeration enum = database.elements(); while (enum.hasMoreElements()) { tempNodeSet.addElement((Node)enum.nextElement()); } nodeSet = new XNodeSet(tempNodeSet); . . . transformer.setParameter("input", nodeSet); transformer.transform(source, new StreamResult(out)); I have two serious problems with the node-set that's being passed in: 1) namespaces don't work correctly, and 2) performance is horrible (worse than if I were to parse the documents repeatedly using the document() function). I posted a message to xalan-j-users earlier today about the performance problem, but it seems to have the same root as my problem with XPath queries using namespaces. My fundamental question is: What is the recommended way to construct an arbitrary XPath node-set in order to pass it in as the value of a global XSLT parameter? I have been using XNodeSet() with NodeSet() and a sequence of DOM trees. I suspect that DOM is losing the namespace information, although successful transformations still serialize the original namespace prefixes that were used. Any help would be greatly appreciated. Thanks, Evan Lenz XYZFind Corp. > -----Original Message----- > From: Gary L Peskin [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 30, 2001 6:06 PM > To: [EMAIL PROTECTED] > Subject: Re: BUG: xalan:evaluate() does not account for namespace > context > > > Hmmmm. I just tried this with XalanJ 2.1.0 and it worked fine. Here is > my input XML: > > <foo:bar xmlns:foo="http://dummyNamespace.com"> > <inner> > Text node > </inner> > </foo:bar> > > Can you please post your input XML and the results that you're receiving > that lead you to believe that this is not working. > > Thanks, > Gary > > Evan Lenz wrote: > > > > The website says this about xalan:evaluate(): > > > > "evaluate (xpath-expression) function returns the result of > evaluating the > > xpath-expression in the current XPath expression context (automatically > > passed in by the extension mechanism)."[1] > > > > It appears that namespace prefix-bindings are not being included in the > > evaluation context. > > > > For example: > > > > <xsl:stylesheet version="1.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > xmlns:foo="http://dummyNamespace.com" > > xmlns:xalan="http://xml.apache.org/xalan" > > extension-element-prefixes="xalan"> > > > > <xsl:param name="xpath" select="'/foo:bar'"/> > > > > <xsl:template match="/"> > > <xsl:copy-of select="xalan:evaluate($xpath)"/> > > </xsl:template> > > > > </xsl:stylesheet> > > > > This should select all top-level bar elements in the "foo" > namespace. But it > > selects nothing. It works fine when selecting elements not in a > namespace. > > > > I am using xalan-j_2_1_0. > > > > Thanks for your time, > > > > Evan Lenz > > XYZFind Corp. > > > > [1] http://xml.apache.org/xalan-j/extensionslib.html#evaluate
