title: Retrieve specific preceding sibling nodes attributes
body: <p>Is there an XPath way of recovering directly one specific attribute of preceding sibling nodes of an XML node using an XPath query?</p>
  
  <p>In the following example, I would like to retrieve the values of the <code>alt</code> attribute of each <code>img</code> nodes that precede the <code>div</code> element marked with the <code>id=marker</code>.</p>
  
  <pre><code>&lt;content&gt;
    &lt;img alt="1" src="file.gif" /&gt;
    &lt;img alt="2" src="file.gif" /&gt;
    &lt;img alt="3" src="file.gif" /&gt;
    &lt;img alt="4" src="file.gif" /&gt;
    &lt;div id='marker'&gt;&lt;/div&gt;
  &lt;/content&gt;
  </code></pre>
  
  <p>For this example, I want to retrieve the values <code>1 2 3 4</code>.<br>
  I use the following XPath query</p>
  
  <pre><code>//div[@id='marker']/preceding-sibling::img
  </code></pre>
  
  <p>in order to retrieve the node list I want</p>
  
  <pre><code>&lt;img alt="1" src="file.gif"/&gt;
  &lt;img alt="2" src="file.gif"/&gt;
  &lt;img alt="3" src="file.gif"/&gt;
  &lt;img alt="4" src="file.gif"/&gt;
  </code></pre>
  
  <p>As it is a node list I can then iterate on the nodes to retrieve the attribute value I am looking for, but is there an XPath way of doing it? 
  I would have expected to be able to write something like:</p>
  
  <pre><code>//div[@id='marker']/preceding-sibling::img@alt
  or //div[@id='marker']/preceding-sibling@alt::img
  </code></pre>
  
  <p>but I don't even know if it is possible once you have used an <code>XPath Axe</code> like preceding-sibling.</p>