How to select all nodes using xmllint where node on same level has certain value? <p>Consider the following <code>example.xml</code> file</p> <pre><code>&lt;all&gt; &lt;item&gt; &lt;name&gt;foo&lt;/name&gt; &lt;value&gt;5&lt;/value&gt; &lt;readonly&gt;true&lt;/readonly&gt; &lt;/item&gt; &lt;item&gt; &lt;name&gt;boo&lt;/name&gt; &lt;value&gt;2&lt;/value&gt; &lt;readonly&gt;false&lt;/readonly&gt; &lt;/item&gt; &lt;item&gt; &lt;name&gt;bar&lt;/name&gt; &lt;value&gt;9&lt;/value&gt; &lt;readonly&gt;true&lt;/readonly&gt; &lt;/item&gt; &lt;/all&gt; </code></pre> <p>I would like to list <code>foo</code> and <code>bar</code> because they are <code>readonly</code> items. This didn't work out for me:</p> <pre><code>cat example.xml | xmllint --xpath "all/item[readonly/text() = "true"]/name" - </code></pre> <p>I received:</p> <pre><code>XPath set is empty </code></pre>