View Single Post
  #4 (permalink)  
Old July 28th, 2009, 03:49 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,438, Level: 59
Points: 18,438, Level: 59 Points: 18,438, Level: 59 Points: 18,438, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,954
Thanks: 0
Thanked 290 Times in 285 Posts
Default

Your XPath is working fine; it's what you do with the result that's the problem. Your XPath result doesn't include the D node, but it does include its parent, and when you Append the parent to the new tree, it will bring its children with it.

Why not write this whole thing in XSLT or XQuery - it's so much easier than low-level procedural DOM coding!
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote