title: XPATH: Node with text or any attribute with specific value
body: <p>I am writing a code in C# where I need to find a child node based on a criteria and replace its value.</p>
  
  <p><strong>What is available :</strong></p>
  
  <ol>
  <li>XML Node</li>
  <li>placeholder = string indicating placeholder</li>
  <li>replacementString = placeholder string needs to be replaced with this string</li>
  </ol>
  
  <p><strong>What is to be done :</strong></p>
  
  <ol>
  <li><p>Find a child in the xml node with text = placeholder 
  or a node with any attribute havingvalue = placeholder string</p></li>
  <li><p>if node, assign inner text = replacementString. 
  if attribute, replace attribute value with replacementString</p></li>
  </ol>
  
  <p><strong>Progress so far :</strong></p>
  
  <p>I am able to find a node with placeholder as text with xpath</p>
  
  <pre><code>descendant::*[text()='placeHolder']
  </code></pre>
  
  <p>But now I am stuck with addition of rule where placeholder can be present as attribute values too.</p>
  
  <p><strong>Restriction:</strong></p>
  
  <p>It needs to be accomplished in XPath that can be used in SelectSingleNode. It is assured that there can be one and only node/attribute with given placeholder</p>
  
  <p><strong>Alternative:</strong></p>
  
  <p>I know I can get string of the xmlnode, perform string replacement, load it in DOM and get the document element. But I do not want to create another DOM in memory just for the string replacement.</p>
  
  <p>Thanks already</p>