title: Add Attribute based on its Parent tag using linq to xml
body: <p>i have a problem where i need to Add attribute to the element based on its Parent element</p>
  
  <p>here is my input:</p>
  
  <pre><code>&lt;p&gt;
      &lt;InlineEquation ID="IEq4"&gt;
          &lt;math xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
              &lt;mi&gt;n&lt;/mi&gt;
              &lt;mo&gt;!&lt;/mo&gt;
          &lt;/math&gt;
      &lt;/InlineEquation&gt;
  
      &lt;MoreTag&gt;
          &lt;Equation ID="Equ1"&gt;
              &lt;math xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
                  &lt;mi&gt;n&lt;/mi&gt;
                  &lt;mo&gt;!&lt;/mo&gt;
              &lt;/math&gt;
          &lt;/Equation&gt;
      &lt;/MoreTag&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>and here is my output</p>
  
  <pre><code>&lt;p&gt;
      &lt;math xmlns="http://www.w3.org/1998/Math/MathML" display="block"&gt;
          &lt;mi&gt;n&lt;/mi&gt;
          &lt;mo&gt;!&lt;/mo&gt;
      &lt;/math&gt;
      &lt;MoreTag&gt;
          &lt;math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"&gt;
              &lt;mi&gt;n&lt;/mi&gt;
              &lt;mo&gt;!&lt;/mo&gt;
          &lt;/math&gt;
      &lt;/MoreTag&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>if the parent tag name is <code>InlineEquation</code> its tag name and attribute will be changed to <code>&lt;math xmlns="http://www.w3.org/1998/Math/MathML" display="block"&gt;</code></p>
  
  <p>if the parent tag name is <code>Equation</code> its tag name and attribute will be changed to <code>&lt;math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"&gt;</code></p>
  
  <p>here is my code</p>
  
  <pre><code>XElement rootEquation = XElement.load("myfile.xml")
  IEnumerable&lt;XElement&gt; equationFormat =
      from el in rootEquation.Descendants("InlineEquation ").ToList()
  
      select el;
  foreach (XElement el in equationFormat)
  {
      Console.WriteLine(el);
      //what code do i need here?
  }
  </code></pre>