> I am using xalan 1.9 with xerces 2.6.0. Using the sample code provided > (SimpleXPathAPI) I get unexpected results when I use an XML document > that contains a default namespace. > > I expected this xpath rule to return true but it returns false as I > believe
It's an "expression," not a rule. > that the default name space is ignored. > > ./SimpleXPathAPI ./example.xml /FpML:FpML /FpML:FpML/IrML/irTrade/party/ > FpML:partyTradeIdentifier/FpML:tradeId=55007835 > The string value of the result is: > false This is a FAQ: http://www.dpawson.co.uk/xsl/sect2/N5536.html#d6472e1012 http://xml.apache.org/xalan-j/faq.html#faq-N101DA Note that implementing this with the XPathEvaluator class almost always involves a programmatic solution. You search the archives of the list, as this has been asked many times, so there should be some good source code snippets. > The above xpath evaluates to TRUE with and without the default namespace > using another processor. Is this a xalan bug or my misunderstanding of > XML namespaces? I don't know what processor you're using that returns true, but Xalan-C is correct, and the XPath standard is explicit about this: http://www.w3.org/TR/xpath#node-tests "A QName in the node test is expanded into an expanded-name using the namespace declarations from the expression context. This is the same way expansion is done for element type names in start and end-tags except that the default namespace declared with xmlns is not used: if the QName does not have a prefix, then the namespace URI is null (this is the same way attribute names are expanded). It is an error if the QName has a prefix for which there is no namespace declaration in the expression context." Dave
