title: How to select the first preceding-sibling which has a particular node as child?
body: <p>I have been trying to write a XPath statement which will select the first preceding-sibling of a node. That sibling should have a particular node as its child.</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;a&gt;
      &lt;c&gt;&lt;/c&gt;
      ....
      &lt;b&gt;&lt;/b&gt;
  &lt;/a&gt;
  
  &lt;a&gt;&lt;/a&gt;
  ....
  ....
  &lt;a&gt;&lt;/a&gt;
  
  &lt;a&gt;
     &lt;b&gt; start &lt;/b&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>In the above XML, if my context is at the node <code>a</code> which has <code>start</code> text inside its child <code>b</code>. How can I select the preceding node <code>a</code> whose child is <code>b</code>?</p>
  
  <p>I tried <code>preceding-sibling::*[b][1]</code> but it only selects the node <code>a</code> if <code>b</code> is its first child. I also tried <code>preceding-sibling::*[1][b]</code> but it only checks the first preceding <code>a</code> node and if it doesn't contains <code>b</code>, the test fails.</p>
  
  <p><strong>Note:</strong> I am using XSLT 1.0</p>
  
  <p>Can anyone suggest me a solution?</p>
  
  <p>Thnx in advance!!</p>