title: Using XPath to add elements to mutiple elements doesn't work as intended
body: <p>My logic goes as follows: I want to find the first element that misses a given attribute, add the attribute and then find the next element which misses the element, add it and so fourth. </p>
  
  <p>I find the first element missing the amount attribute in the following way:</p>
  
  <pre><code>    private XmlNode GetFirstElementWithoutAmount()
              {
                  string productXPathQuery = "//XML/Products";
                  XmlNodeList productList = ParentXmlDocument.SelectNodes(productXPathQuery);
                  foreach (XmlNode element in productList)
                  {
                      string passengerXPathQuery = "//XML/Products[ID=" + element.FirstChild.InnerText + "]/Amount";
                      var amount = element.SelectSingleNode(passengerXPathQuery);
                      if (amount == null)
                      {
                          return element;
                      }
                  }
  
                  return null;
       }
  </code></pre>
  
  <p>When I've found the first element missing the attribute, the amount is added in the following way:</p>
  
  <pre><code>private XmlNode GetOrCreateChildXMLNode(string NewNodeName, XmlNode ParentXMLNode)
          {
  
              if (ParentXMLNode == null)
              {
                  return null;
              }
  
              XmlNode NewXMLNode = ParentXMLNode.SelectSingleNode("//" + NewNodeName);
              if (NewXMLNode == null)
              {
                  NewXMLNode = ParentXmlDocument.CreateNode(XmlNodeType.Element, NewNodeName, string.Empty);
                  ParentXMLNode.AppendChild(NewXMLNode);
              }
  
              return NewXMLNode;
          }
  </code></pre>
  
  <p>The problems is, that it only adds to the first element, and then the first function always returns the second element, even though there's more elements to come? Any ideas why this is?</p>