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: 
Q: *How to select a node using XPath if sibling node has a specific value?*  

Because there are only "XPath Axes" for following-siblings and preceding-siblings, you can use one of them if the position is fixed. 

**But better:**
Look for `cc` were the parent has child `bb` with value `'zz'`:

```
//cc[../bb='zz']

```
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.