2008年(17)
分类: C/C++
2008-03-10 17:46:53
Expression | Refers to |
---|---|
book[last()] |
The last element of the current context node. |
book/author[last()] |
The last child of each element of the current context node. |
(book/author)[last()] |
The last element from the entire set of children of elements of the current context node. |
book[excerpt] |
All elements that contain at least one element child. |
book[excerpt]/title |
All elements that are children of elements that also contain at least one element child. |
book[excerpt]/author[degree] |
All elements that contain at least one element child, and that are children of elements that also contain at least one element. |
book[author/degree] |
All elements that contain children that in turn contain at least one child. |
author[degree][award] |
All elements that contain at least one element child and at least one . |
author[degree and award] |
All elements that contain at least one element child and at least one element child. |
author[(degree or award) and publication] |
All elements that contain at least one or and at least one as the children |
author[degree and not(publication)] |
All elements that contain at least one element child and that contain no element children. |
author[not(degree or award) and publication] |
All elements that contain at least one element child and contain neither nor element children. |
author[last-name = "Bob"] |
All elements that contain at least one element child with the value Bob . |
author[last-name[1] = "Bob"] |
All elements where the first child element has the value Bob . Note that this is equivalent to the expression in the next row. |
author[last-name [position()=1]= "Bob"] |
All elements where the first child element has the value Bob . |
degree[@from != "Harvard"] |
All elements where the from attribute is not equal to "Harvard" . |
author[. = "Matthew Bob"] |
All elements whose value is Matthew Bob . |
author[last-name = "Bob" and ../price > 50] |
All elements that contain a child element whose value is Bob , and a sibling element whose value is greater than 50. |
book[position() <= 3] |
The first three books (1, 2, 3). |
author[not(last-name = "Bob")] |
All elements that do no contain child elements with the value Bob . |
author[first-name = "Bob"] |
All elements that have at least one child with the value Bob . |
author[* = "Bob"] |
all author elements containing any child element whose value is Bob . |
author[last-name = "Bob" and first-name = "Joe"] |
All elements that has a child element with the value Bob and a child element with the value Joe . |
price[@intl = "Canada"] |
All elements in the context node which have an intl attribute equal to "Canada" . |
degree[position() < 3] |
The first two elements that are children of the context node. |
p/text()[2] |
The second text node in each element in the context node. |
ancestor::book[1] |
The nearest ancestor of the context node. |
ancestor::book[author][1] |
The nearest ancestor of the context node and this element has an element as its child. |
ancestor::author[parent::book][1] |
The nearest ancestor in the current context and this element is a child of a element. |