Remember that XPath just selects a set of nodes. If you want to construct a
new tree based on those nodes, you need something like XPath -- or some
hand-coded equivalent -- to do that construction.

Selecting only the book and its title and price is easy:
      book | book/title | book/price
is one of several ways to express that. But that shows you the individual
nodes; it doesn't display the relationships between them.

If what you're looking for is a filtered view of an in-memory document
without recopying, you might want to investigate the DOM Level 2 Traversal
chapter. TreeWalker's intended to give you exactly that, though you have to
learn how to work with it.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk

Reply via email to