title: Filter wrong Nodes
body: <p>i have the following code:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;A_Random&gt;
      &lt;A_RandomType&gt;
       &lt;RandomType&gt;T4fV&lt;/RandomType&gt;
          &lt;RandomOrganization&gt;1012&lt;/RandomOrganization&gt;
          &lt;RandomChannel&gt;12&lt;/RandomChannel&gt;
          &lt;RandomDivision&gt;00&lt;/RandomDivision&gt;
          &lt;RandomGroup&gt;112&lt;/RandomGroup&gt;
          &lt;to_Item&gt;
              &lt;A_RandomItemType&gt;
                  &lt;RandomChrgItemText&gt;null&lt;/RandomChrgItemText&gt;
                  &lt;Material/&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;STK&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1088&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
              &lt;A_RandomItemType&gt;
                  &lt;Material&gt;1111&lt;/Material&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1088&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
              &lt;A_RandomItemType&gt;
                  &lt;Material&gt;594172&lt;/Material&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1010&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
              &lt;A_RandomItemType&gt;
                  &lt;Material/&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1010&lt;/Plant&gt;
              &lt;/A_RandomTypeItemType&gt;
                  &lt;RandomChrgItemText&gt;null&lt;/RandomtChrgItemText&gt;
                  &lt;Material/&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1044&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
              &lt;A_RandomeItemType&gt;
                  &lt;Material&gt;482803&lt;/Material&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1788&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
              &lt;A_RandomItemType&gt;
                  &lt;Material&gt;594172&lt;/Material&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1788&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
          &lt;/to_Item&gt;
      &lt;/A_RandomType&gt;
  &lt;/A_Random&gt;
          
  </code></pre>
  <p>I want to accomplish the following output:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;A_Random&gt;
      &lt;A_RandomType&gt;
       &lt;RandomType&gt;T4fV&lt;/RandomType&gt;
          &lt;RandomOrganization&gt;1012&lt;/RandomOrganization&gt;
          &lt;RandomChannel&gt;12&lt;/RandomChannel&gt;
          &lt;RandomDivision&gt;00&lt;/RandomDivision&gt;
          &lt;RandomGroup&gt;112&lt;/RandomGroup&gt;
          &lt;to_Item&gt;
              &lt;A_RandomItemType&gt;
                  &lt;Material&gt;1111&lt;/Material&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1088&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
              &lt;A_RandomItemType&gt;
                  &lt;Material&gt;594172&lt;/Material&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1010&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
              &lt;A_RandomeItemType&gt;
                  &lt;Material&gt;482803&lt;/Material&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1788&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
              &lt;A_RandomItemType&gt;
                  &lt;Material&gt;594172&lt;/Material&gt;
                  &lt;RequestedQuantity&gt;1&lt;/RequestedQuantity&gt;
                  &lt;RequestedQuantityUnit&gt;PC&lt;/RequestedQuantityUnit&gt;
                  &lt;Plant&gt;1788&lt;/Plant&gt;
              &lt;/A_RandomItemType&gt;
          &lt;/to_Item&gt;
      &lt;/A_RandomType&gt;
  &lt;/A_Random&gt;
  </code></pre>
  <p>In short, I want to copy everything except nodes where Material is empty or A_RandomItemType is set to null. I have nothing working but one of my tries was the following.</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  
  &lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
  
  &lt;xsl:output omit-xml-declaration=&quot;yes&quot; indent=&quot;yes&quot; method=&quot;xml&quot;/&gt;
  
     &lt;xsl:template match=&quot;@* | node()&quot;&gt;
        &lt;xsl:copy&gt;
        &lt;xsl:apply-templates select=&quot;*[name(  ) != 'Material:null']&quot;/&gt;
        &lt;xsl:apply-templates select=&quot;*[name(  ) != 'SalesOrderWthoutChrgItemText:null']&quot;/&gt;
        &lt;/xsl:copy&gt;
  &lt;xsl:copy&gt;
  &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  <p>Tanks for your help. Can you pleas explein me why my code dont work?</p>