Presumably, then, your context node wasn't the document element when you executed that element. You used a relative XPath expression there, which is relative to your context node. If you can't fix it to be relative to the actual context node at execution time, you could always use an absolute XPath expression.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: how do i check for the presence of a node through XML