Selecting an attribute value with XPath in Google Spreadsheet with multiple similar named attributes
<p>I'm trying to select the value of an attribute in Google Spreadsheets for a board game's rank.</p>

<p><a href="https://www.boardgamegeek.com/xmlapi/boardgame/127023?stats=1" rel="nofollow">https://www.boardgamegeek.com/xmlapi/boardgame/127023?stats=1</a></p>

<p>under //boardgames/boardgame/statistics/ratings/ranks/ there are two nodes called "rank"</p>

<p>The first one has type='subtype' and is the one I want to return the value in the 'value' attribute (which at the time of writing this was '67'.</p>

<p>I'm trying this:</p>

<pre><code>=IMPORTXML("https://www.boardgamegeek.com/xmlapi/boardgame/127023?stats=1", "//boardgames/boardgame/statistics/ratings/ranks/rank[@value]")
</code></pre>

<p>Which doesn't work. (Imported content is empty).</p>

<p>I can select the value in nodes fine, for example:</p>

<pre><code>=IMPORTXML("https://www.boardgamegeek.com/xmlapi/boardgame/127023?stats=1", "//boardgames/boardgame/statistics/ratings/average")
</code></pre>