title: Linq to XML pulling back an attribute that exists on a different level
body: <p>I'm trying to write a Linq to XML query that pulls back keyword and includes an attribute (mediatype)</p>
  
  <p>Consider the following XML data...</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;media&gt;
      &lt;photos&gt;        
          &lt;photo mediatype="photo" photographer="Jag_cz" description="Colored splashes in abstract shape, isolated on white background" id="16" name="50623755_F.jpg" folder="HR Headset"&gt;
              &lt;keywords&gt;
                  &lt;keyword&gt;fish&lt;/keyword&gt;
                  &lt;keyword&gt;abstract&lt;/keyword&gt;         
              &lt;/keywords&gt;
          &lt;/photo&gt;
      &lt;/photos&gt;
      &lt;videos&gt;
          &lt;video mediatype="video" description="Bear by a stream" folder="streamfolder" name="stream.mp4"&gt;
              &lt;keywords&gt;
                  &lt;keyword&gt;stream&lt;/keyword&gt;
                  &lt;keyword&gt;river&lt;/keyword&gt;
                  &lt;keyword&gt;water&lt;/keyword&gt;
              &lt;/keywords&gt;
          &lt;/video&gt;
          &lt;video mediatype="video" description="Stream with a bear" folder="bearfolder" name="bear.mp4"&gt;
              &lt;keywords&gt;
                  &lt;keyword&gt;salmon&lt;/keyword&gt;
                  &lt;keyword&gt;fish&lt;/keyword&gt;
              &lt;/keywords&gt;
          &lt;/video&gt;
      &lt;/videos&gt;
  &lt;/media&gt;
  </code></pre>
  
  <p>There are photo elements and video elements. Each element has a mediattype attribute. </p>
  
  <p>I want pull back a query of each keyword with it's media type.</p>
  
  <p>Something like this..</p>
  
  <pre><code>mediatype   keyword
  ---------   -------              
  photo       fish
  photo       abstract
  video       stream
  video       river
  video       water
  video       salmon
  video       fish
  </code></pre>
  
  <p>I have been able to pull back the keywords with the following code...</p>
  
  <pre><code>using System;
  using System.Xml.Linq;
  using System.Linq;
  
  class Program
  {
      public static void Main(string[] args)
      {
          String strPath = @"C:\videodata\media.xml";
  
          XElement xEle = XElement.Load(strPath);
  
          var keywordquery = from k in xEle.Descendants("keyword")
                             select new
                                 {
                                     keyword = (string)k.Value
                                 };
  
          foreach (var k in keywordquery)
          {
              Console.WriteLine(k.keyword);
          }
  
          Console.WriteLine("Press &lt;enter&gt; to continue");
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>However, I'm stuck on pulling back the mediatype attribute. This attribute exists on a different level than keyword. </p>