title: MVC Razor view: XML node parsing issue
body: <p>I have an MVC application which is querying a Lucene/Solr index. In a partial view, I am displaying metadata on a series of XML documents returned from the query. The metadata is extracted from the XML documents using XPath queries and is paged, listing 10 documents at a time. The view cshtml is as follows...</p>
  
  <pre><code>@model SolrMVCTest2.Models.Facet
  
  &lt;section&gt;
  
  
  @foreach (System.Xml.XmlNode doc in Model.SearchResult.SelectNodes("/response/result/doc"))
  {
   &lt;article&gt;
      &lt;b&gt;Document type:  @doc.SelectSingleNode("//str[@name='docType']").InnerText  &lt;/b&gt;  &lt;br /&gt;
      &lt;b&gt;NHS Number:  @doc.SelectSingleNode("//str[@name='crn']").InnerText  &lt;/b&gt;  &lt;br /&gt;
      @doc.OuterXml.ToString()
  &lt;/article&gt;
  &lt;p&gt;&lt;/p&gt;
  
  }
  &lt;/section&gt;
  </code></pre>
  
  <p>I have included a display of the OuterXML for debugging purposes and a partial listing of the results highlights a serious issue. FOr each group of 10 documents, the innertext of the selected nodes is not updated for each successive document, but always displays the values from the first document of the set of 10 as shown in this partial result....</p>
  
  <pre><code>Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;mh00k2jr001002&lt;/str&gt;&lt;str name="crn"&gt;7024326654&lt;/str&gt;&lt;str     name="docType"&gt;MedicalHistory&lt;/str&gt;&lt;/doc&gt; 
  
  
  Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;mh00k2ju001002&lt;/str&gt;&lt;str name="crn"&gt;0437861414&lt;/str&gt;&lt;str name="docType"&gt;MedicalHistory&lt;/str&gt;&lt;/doc&gt; 
  
  
  Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;mh00k2k1001002&lt;/str&gt;&lt;str name="crn"&gt;7626346416&lt;/str&gt;&lt;str name="docType"&gt;MedicalHistory&lt;/str&gt;&lt;/doc&gt; 
  
  
  Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;mh00k2mp001002&lt;/str&gt;&lt;str name="crn"&gt;2637403616&lt;/str&gt;&lt;str name="docType"&gt;MedicalHistory&lt;/str&gt;&lt;/doc&gt; 
  
  
  Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;mh00k2nm001001&lt;/str&gt;&lt;str name="crn"&gt;0874706416&lt;/str&gt;&lt;str name="docType"&gt;MedicalHistory&lt;/str&gt;&lt;/doc&gt; 
  
  
  Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;mh00k2qq001002&lt;/str&gt;&lt;str name="crn"&gt;1867082616&lt;/str&gt;&lt;str name="docType"&gt;MedicalHistory&lt;/str&gt;&lt;/doc&gt; 
  
  
  Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;mh00k2ss001001&lt;/str&gt;&lt;str name="crn"&gt;5436985416&lt;/str&gt;&lt;str name="docType"&gt;MedicalHistory&lt;/str&gt;&lt;/doc&gt; 
  
  
  Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;mh00k2yi002003&lt;/str&gt;&lt;str name="crn"&gt;8731654606&lt;/str&gt;&lt;str name="docType"&gt;MedicalHistory&lt;/str&gt;&lt;/doc&gt; 
  
  
  Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;mh00k2yr001001&lt;/str&gt;&lt;str name="crn"&gt;0906133416&lt;/str&gt;&lt;str name="docType"&gt;MedicalHistory&lt;/str&gt;&lt;/doc&gt; 
  
  
  Document type: MedicalHistory  
  Patient Number: 7024326654  
   &lt;doc&gt;&lt;str name="id"&gt;op00k23e001001&lt;/str&gt;&lt;str name="crn"&gt;6335192616&lt;/str&gt;&lt;str name="docType"&gt;OutpatientAnnotation&lt;/str&gt;&lt;/doc&gt; 
  </code></pre>
  
  <p>The Patient Number display (extracted from the str element named "crn" is not updated obn the second and successive documents, and the Document Type (fromt he docType element) is not updated on the 10th.</p>
  
  <p>Does anyone have any ideas which may explain this behaviour?</p>