> "Filtering" in XPath is done using predicates, which are enclosed in > "[]". For example, I could filter "book" elements, selecting only those > "book" elements with a "title" child element that has a particular value: > > //book[title = 'The book I'm looking for'] > > > For example, if I wanted to select all the books , but I am only > interested in its title and price, I could write something like (invented): > > //book(title,price) > > > But if that's what you want, you're not selecting all the "book" > elements. Rather, you are selecting the "title" and "price" children of > all "book" elements: > > //book/title | //book/price This would return <title>.. <price>.. <title>.. <price>.. ..
But what I mean is to select the books, but only returning the title and price: <book> <title>.. <price>.. </book> <book> <title>.. <price>.. </book> But as you say this is a new tree.. Thank you. -Enric > > > But according your replies seems that XSLT should be used instead.. > > > > XPath 1.0 cannot construct nodes, so you can only use it to select nodes > in the source tree. If you need to construct a new tree, then you need > XSLT. > > Dave > >