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: 
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.
```
//a/cc[../bb='zz']/text()

```

//a : Selects all 'a' elements no matter where it is.

//a/cc : Selects 'cc' elements that are children of the 'a' element (no matter where a is).

.. : Selects the parent of the current node.

[../bb='zz'] : where value of sibling 'bb' element is zz.

Reference: <http://www.w3schools.com/xsl/xpath_syntax.asp>