Question: I have the following document:

```
<a>
  <bb>abc</bb>
  <cc>ccc</cc>
  <dd>ddd</dd>
</a>
<a>
  <bb>zz</bb>
  <cc>1</cc>
  <dd>2</dd>
</a>

```

How can I get the value of `<cc>` using XPath if `<bb>` is `zz`?

Answer: 
What you need is `following-sibling` XPath axis

```
//a/bb[text()="zz"]/following-sibling::cc[1]/text()

```

Test the Xpath here: <http://www.xpathtester.com/obj/b55ec3ac-dfa4-4f44-81e8-f963ea4a0625>
Another solution for this problem is 

`//bb[contains(.,'zz')]/../cc/text()`

**Explanation**: Any `bb` that contains `'zz'` string in all the child nodes of `bb` then going to parent node of that `bb` using `..`, now that we can access the `cc` so returning text.

I hope that explanation isn't complex.