Re: XPath for parent nodes, but excluding their childr
When you use an expression like //div, XPath selects the div elements only, it does not select their children or other descendants. It returns to the caller, in effect, pointers to these div elements. What happens next is up to the caller. It's quite common for the caller to process (e.g. display or copy) the whole subtree rooted at a selected element. Such behaviour can't be controlled using the XPath expression, because the XPath engine doesn't determine what the client does with the selected nodes.
If you want to return to the client a node that doesn't have these children attached, you can't do this using XPath, because XPath can only select nodes as they exist in the input tree, it can't transform them into a different tree. That's XSLT territory.
Michael Kay Saxonica
On 30/06/2011 22:23, Joel Dubien wrote:
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format