The Building sample has a vacancy child with sqft 2000, so Vacancy/sqft > 1000 succeeds. He has a child with a square mark of 1000 (both 900 and 500), so Vacancy/sqft < 1100 succeeds. Thus, xpath selects Building.
Comparison expressions (for example, Vacancy/sqft <= 1000 ) implicitly qualify as " exists " in "there is a Vacancy child that has a sqft child with a value> 1000" because Vacancy/sqft is a collection of nodes , not one node . Moreover, each comparison has its own qualification, so the sqft in Vacancy/sqft > 1000 does not have to be the same sqft as in Vacancy/sqft < 1100 . Note that //results/Buildings is a collection of node; the predicate [...] is applied separately to each element in the set, so there are no problems with qualifiers. Translating the original xpath into English, we get:
Select buildings (in the results) such that 1 = 1, and there is a square vacancy label> 1000, and there is a square vacancy length <1100.
Let's take the English wording of the desired query and make it a little closer to the logic that comes to one of:
Select the buildings (in the results) so that there is a vacancy with a square mark, so that it> 1000, 1100
Select the buildings (in the results) so that there is a vacancy, so that square meters> 1000 and square meters 1100
The first leads to the solution of yasso, the latter to:
//results/Building[ Vacancy[1000 < sqft and sqft < 1100] ]
Original solution
(Note: this answered the original question when it was not clear what the OP wanted. The technique may be useful to others with a similar problem, but with different requirements, so I leave it.)
Try the logical double negation of the condition:
//results/Building[ Vacancy and not (Vacancy/sqft <= 1000 or Vacancy/sqft >= 1100) ]
This predicate includes a test for Vacancy children to filter out cases that are otherwise trivially true, i.e. buildings without vacancies. The English equivalent of this solution:
Select the buildings (in the results) so that there is a vacancy in the building, and this is not the case when there is a square vacancy label <= 1000 or there is a vacant area in square feet> = 1100
Less words:
Select all buildings with vacancies where the vacancy does not have <= 1000 square feet or> = 1100 square feet.
Even fewer words:
Select all buildings with vacancies where all vacancies range from 1,000 to 1,100 square feet.