title: Sitecore - patch node with the same attributes as the others
body: <p>how can I patch specified node if there are several other nodes with the same attributes?</p>
  
  <p>I need to patch analyzer for czech language in ContentSearch section, but all nodes start with</p>
  
  <p>&lt;mapEntry type="<strong>Sitecore.ContentSearch.LuceneProvider.Analyzers.PerExecutionContextAnalyzerMapEntry, Sitecore.ContentSearch.LuceneProvider</strong>"&gt;</p>
  
  <p>Part of that configuration looks like this</p>
  
  <pre><code>...&lt;/maEntry&gt;
  &lt;mapEntry type="Sitecore.ContentSearch.LuceneProvider.Analyzers.PerExecutionContextAnalyzerMapEntry, Sitecore.ContentSearch.LuceneProvider"&gt;
    &lt;param hint="executionContext" type="Sitecore.ContentSearch.CultureExecutionContext, Sitecore.ContentSearch"&gt;
      &lt;param hint="cultureInfo" type="System.Globalization.CultureInfo, mscorlib"&gt;
        &lt;param hint="name"&gt;ar-AE&lt;/param&gt;
      &lt;/param&gt;
    &lt;/param&gt;
    &lt;param desc="analyzer" type="Sitecore.ContentSearch.LuceneProvider.Analyzers.DefaultPerFieldAnalyzer, Sitecore.ContentSearch.LuceneProvider"&gt;
      &lt;param desc="defaultAnalyzer" type="Lucene.Net.Analysis.AR.ArabicAnalyzer, Lucene.Net.Contrib.Analyzers"&gt;
        &lt;param hint="version"&gt;Lucene_30&lt;/param&gt;
      &lt;/param&gt;
    &lt;/param&gt;
  &lt;/mapEntry&gt;
  &lt;mapEntry type="Sitecore.ContentSearch.LuceneProvider.Analyzers.PerExecutionContextAnalyzerMapEntry, Sitecore.ContentSearch.LuceneProvider"&gt;
    &lt;param hint="executionContext" type="Sitecore.ContentSearch.CultureExecutionContext, Sitecore.ContentSearch"&gt;
      &lt;param hint="cultureInfo" type="System.Globalization.CultureInfo, mscorlib"&gt;
        &lt;param hint="name"&gt;pt-BR&lt;/param&gt;
      &lt;/param&gt;
    &lt;/param&gt;
    &lt;param desc="analyzer" type="Sitecore.ContentSearch.LuceneProvider.Analyzers.DefaultPerFieldAnalyzer, Sitecore.ContentSearch.LuceneProvider"&gt;
      &lt;param desc="defaultAnalyzer" type="Sitecore.ContentSearch.LuceneProvider.Analyzers.Contrib.BrazilianAnalyzer, Sitecore.ContentSearch.LuceneProvider"&gt;
        &lt;param hint="version"&gt;Lucene_30&lt;/param&gt;
      &lt;/param&gt;
    &lt;/param&gt;
  &lt;/mapEntry&gt;
  &lt;mapEntry type="Sitecore.ContentSearch.LuceneProvider.Analyzers.PerExecutionContextAnalyzerMapEntry, Sitecore.ContentSearch.LuceneProvider"&gt;
    &lt;param hint="executionContext" type="Sitecore.ContentSearch.CultureExecutionContext, Sitecore.ContentSearch"&gt;
      &lt;param hint="cultureInfo" type="System.Globalization.CultureInfo, mscorlib"&gt;
        &lt;param hint="name"&gt;cs-CZ&lt;/param&gt;
      &lt;/param&gt;
    &lt;/param&gt;
    &lt;param desc="analyzer" type="Sitecore.ContentSearch.LuceneProvider.Analyzers.DefaultPerFieldAnalyzer, Sitecore.ContentSearch.LuceneProvider"&gt;
      &lt;param desc="defaultAnalyzer" type="Lucene.Net.Analysis.Cz.CzechAnalyzer, Lucene.Net.Contrib.Analyzers"&gt;
        &lt;param hint="version"&gt;Lucene_30&lt;/param&gt;
      &lt;/param&gt;
    &lt;/param&gt;
  &lt;/mapEntry&gt;
  &lt;mapEntry&gt;...
  </code></pre>
  
  <p>And I need to patch (in our example) <b>defaultAnalyzer in second node</b>. BUT second node is not in real life SECOND, but it could be third, seventh etc... I guess I need to find "mapEntry" node by specified inner node.</p>
  
  <p>If I use this</p>
  
  <pre><code>&lt;map hint="list:Add"&gt;
      &lt;!-- Patch analyzer for Czech language --&gt;
      &lt;mapEntry type="Sitecore.ContentSearch.LuceneProvider.Analyzers.PerExecutionContextAnalyzerMapEntry, Sitecore.ContentSearch.LuceneProvider"&gt;
          &lt;param desc="analyzer" type="Sitecore.ContentSearch.LuceneProvider.Analyzers.DefaultPerFieldAnalyzer, Sitecore.ContentSearch.LuceneProvider"&gt;
              &lt;param desc="defaultAnalyzer" type="Lucene.Net.Analysis.Cz.CzechAnalyzer, Lucene.Net.Contrib.Analyzers"&gt;
                  &lt;patch:attribute name="type"&gt;MySolution.MetroAsciiFoldingAnalyzer, MySolution&lt;/patch:attribute&gt;
              &lt;/param&gt;
          &lt;/param&gt;
      &lt;/mapEntry&gt;
  &lt;/map&gt;
  </code></pre>
  
  <p>It will patch first node.</p>
  
  <p>I found something similar in this issue <a href="https://stackoverflow.com/questions/14719214/select-node-based-on-child-node-value-in-web-config-transform">Select node based on child node value in Web.config Transform</a>, but as I understand I would replace whole one node with my custom one, but .... it is necessary?</p>