Title: XPath bug

I'm trying to use the following XPath:

descendant-or-self::*[string-length(normalize-space(text())) > 1]

This works as expected for most cases but encounters an error when it hits an element containing an entity (eg. < or  > or &).  When I look at the tree in memory under the debugger I see that an element with a textual representation like <foo>&amp;bar</foo> ends up having two text node children.  This causes the XPath evaluation to behave unexpectedly, because the XPath specification says that there should never be two adjacent text nodes (section 5.7).  In the above case the following XPath would behave as expected:

descendant-or-self::*[string-length(normalize-space(concat(text()[1], text()[2]))) > 1]

but that is a really horrible way to work around this problem.

Am I missing something or is this really a bug?


Reply via email to