Hi, Thanks for the update.
When we run the below Xpath query on an another application (XMLSpy), it ignores the first node (containing white spaces) and returns the count as 4. We would like to request if it is safe to assume that the mentioned application handles this scenario independently and not as part of implementation of neither of XML nor XPath specifications. Thanks and Regards, Anand -----Original Message----- From: David Bertoni [mailto:[EMAIL PROTECTED] Sent: 10 July 2007 18:01 To: xalan-c-users@xml.apache.org Subject: Re: Ignoring the whitespace in text nodes Bharadwaj, Anand (ELS-OXF) wrote: > Hi All, > > We are having an issue with XSLT parser sample (SimpleXPathAPI.exe). It's an XPath _processor_, not an XPath _parser_. > > When the XPath query (count(/*[1]/*[7]/*[5]/*[1]/*[3]/*[2]/node()))is > made on the document containing the XML node snippet: > > "<para id="para13"> > > <italic>Expand one's cultural knowledge</italic> > ... > > The parser is considering the leading 'whitespace' characters as one > node and the total node count as 5 which are, > > 1. *whitespace before <italic>*, > > 2. <italic> > > 3. text between <italic> and <anchor> > > 4. <anchor> > > 5. text after <anchor> till end. This is correct, since that's what the XML recommendation, the XPath data model, and XML Information Set recommendation require. > > As per our requirement the count should be 4 (excluding the (1) above). > > We request to kindly let us know how to ignore these 'whitespace' nodes > which are > > actually children of 'Text node' types, through Xpath queries since we > do not have the freedom to reload the document in any other configuration. The only thing you can do is to build the document and strip the whitespace-only text nodes before they get to the XPath processor. You would need to write your own code to do that, or you could write a stylesheet to remove them, transform the original document using the XSLT processor, then use the transformed document with SimpleXPathAPI.exe. Dave