Question: On a page there are more than one node that contains the same information. My xpath is getting both and I dont want that. I only want it take one

here is my xpath

```
//em[contains(text(), "Telefon:")]/following-sibling::span

```

I did try the

```
//em[contains(text(), "Telefon:")]/following-sibling::span[1]

```

, but with no luck

Answer: 
You can use the [`at_xpath` method](http://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/Node#at_xpath-instance_method) instead of `xpath` to only return the first match for an expression:

```
doc.at_xpath('//em[contains(text(), "Telefon:")]/following-sibling::span')

```

You could also just use `first` on the nodeset returned by `xpath`:

```
doc.xpath('//em[contains(text(), "Telefon:")]/following-sibling::span').first

```
I have solved it with ruby like this

```
docEachLinks.xpath('//em[contains(text(), "Telefon:")]/following-sibling::span').text.split(" ").first

```

What I have done here is spliting the two with a space and then I choose the first one. This did the trick.