Enric Jaen wrote:
My question was rather if that kind of filter could be expressed with
XPath itself, just as Xpath uses @ to filter elements by attributes
(for example: //[EMAIL PROTECTED] selects those books elements that have a
lang attribute)
XPath doesn't use "@" to "filter elements by attributes." "@" is an
abbreviation for the attribute axis, and is used for more general purposes:
http://www.w3.org/TR/xpath#axes
"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
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