title: Select elements based on condition LINQ TO XML C#
body: <p>I am querying XML using LINQ TO XML. I want to query records based on some conditional check here is my XML below: XML will have multiple Orders each order will be in  I want to select order which has  param node  attribute store value is not null and if exists should be 1 and also order with carton information...</p>
  
  <pre><code>    &lt;orders&gt;
          &lt;order&gt;
              &lt;criteria&gt;
                  &lt;param name="location"&gt;123&lt;/param&gt;
                  &lt;param name="name"&gt;Chicago&lt;/param&gt;
                  &lt;param name="Store"&gt;1&lt;/param&gt;
                  &lt;param name="Account Number"&gt;1212121212&lt;/param&gt;
              &lt;/criteria&gt;
              &lt;items&gt;
                  &lt;item&gt; &lt;/item&gt;
                  &lt;item&gt; &lt;/item&gt;           
              &lt;/items&gt;
              &lt;cartons&gt;
                  &lt;carton&gt;
                       &lt;size&gt; &lt;/size&gt;
                       &lt;weight&gt;&lt;/weight&gt;
                  &lt;/carton&gt;
              &lt;/cartons&gt;
          &lt;/order&gt;
      &lt;Order&gt;
      &lt;/Order&gt;
      &lt;/orders&gt;
  </code></pre>
  
  <p>I am able to do till this:</p>
  
  <pre><code>var result = from item in doc.Descendants("order")
                  where item.Element("criteria").Element("param").Attribute("name").Value.Contains("store") == true
                  &amp;&amp; item.Element("cartons") != null
                  select item;"
  </code></pre>
  
  <p>Above works fine if my store (param) attribute is first in the filter node but if I move the store(param) to other position than first it does not filter it</p>