Question: ```
<a id ="1">
...<c>
......<b/>
......<f/>
......<b/>
......<f/>
...</c>
</a>
<a id="2">
...<c>
......<b/>
......<f/>
......<f/>
...</c>
</a>

```

If any elem b is followed by two or more f elements in order, return node a. I prefer straight XPath 2.0 solution, if possible. What xpath will get me a2 but not a1? I have tried following siblings, position, and such, to no avail.

Answer: 
You could do:

```
//a[.//b/following-sibling::*[1][self::f]/following-sibling::*[1][self::f]]

```

This says to find the a element that contains a b element, which is immediately followed by a f element, which is immediately followed by a f element.
you can get a2 using this :

```
       //a[@id=2]

```

just by using the id attribute.