Question: I need to find links on a page consisting of two words.How can this be done with Xpath?

```
<div class="navbar">
  <p>
    <a href="/navigate/names/a">Aaa aaa</a>
    <a href="/navigate/names/b">Bbb</a>
    <a href="/navigate/names/c">Ccc ccc</a>
    <a href="/navigate/names/d">Ddd</a>
    <a href="/navigate/names/e">Eee</a>
    <a href="/navigate/names/f">Fff fff ff</a>
  </p>
</div>

```

Answer: 
If you can differentiate the strings by the count of spaces, you could use this XPath-1.0 expression:

```
/div/p/a[string-length(normalize-space(.))-string-length(translate(normalize-space(.),' ',''))=1]

```

This matches all two-word-strings.
My 2cts by removing not space characters and also counting spaces

XPath 1: `//a[count(translate(normalize-space(.),"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ","")) = 1]`

```
echo -e 'cat //a[translate(normalize-space(.),"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ","") = " "] \n bye' | xmllint --shell test.html
/ > cat //a[translate(normalize-space(.),"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ","") = " "] 
 -------
<a href="/navigate/names/a">Aaa  aaa</a>
 -------
<a href="/navigate/names/c">Ccc ccc</a>
/ >  bye

```

Using length of remaining spaces

Xpath 2: `//a[string-length(translate(normalize-space(.),"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ","")) = 1]`

```
echo -e 'cat //a[string-length(translate(normalize-space(.),"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ","")) = 1] \n bye' | xmllint --shell test.html
/ > cat //a[string-length(translate(normalize-space(.),"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ","")) = 1] 
 -------
<a href="/navigate/names/a">Aaa  aaa</a>
 -------
<a href="/navigate/names/c">Ccc ccc</a>
/ >  bye

```