title: Check if the node set contains any value in XSLT
body: <p>I need some help with XSLT syntax. Here is my scenario, I have an XML file that needs to be transformed in to a different look and feel of XML file, I have several sections where if particular node set don't contain any value the whole section shouldn't be processed.</p>
  
  <p>Here is an example of XML:</p>
  
  <pre><code>&lt;Dates&gt;
      &lt;Date&gt;
          &lt;VALUE1&gt;&lt;/VALUE1&gt;
          &lt;VALUE2&gt;&lt;/VALUE2&gt;
          &lt;VALUE3&gt;&lt;/VALUE3&gt;
          &lt;VALUE4&gt;&lt;/VALUE4&gt;
          &lt;VALUE5&gt;3333&lt;/VALUE5&gt;
      &lt;/Date&gt;
      &lt;Date&gt;
          &lt;VALUE1&gt;AAAA&lt;/VALUE1&gt;
          &lt;VALUE2&gt;&lt;/VALUE2&gt;
          &lt;VALUE3&gt;JJJJ&lt;/VALUE3&gt;
          &lt;VALUE4&gt;&lt;/VALUE4&gt;
          &lt;VALUE5&gt;12345&lt;/VALUE5&gt;
      &lt;/Date&gt;
  &lt;/Dates&gt;
  </code></pre>
  
  <p><a href="http://img162.imageshack.us/my.php?image=xmlscreenshotgk7.gif" rel="noreferrer">screenshot of xml</a></p>
  
  <p>Here is my XSLT with the if statement that don't work right</p>
  
  <pre><code>&lt;xsl:for-each select="Level1/Level2/Level3"&gt;
      &lt;xsl:if test="@VALUE1!=''"&gt;                    
      &lt;MyDates&gt;               
              &lt;value_1&gt;
                  &lt;xsl:value-of select="VALUE1"/&gt; 
              &lt;/value_1&gt;
              &lt;value_2&gt;
                  &lt;xsl:value-of select="VALUE2"/&gt; 
              &lt;/value_2&gt;
              &lt;value_3&gt;
                  &lt;xsl:value-of select="VALUE3"/&gt; 
              &lt;/value_3&gt;
              &lt;value_4&gt;
                  &lt;xsl:value-of select="VALUE4"/&gt; 
              &lt;/value_4&gt;       
      &lt;/MyDates&gt;
      &lt;/xsl:if&gt;   
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>So as you can see I basically want all nodes (VALUE1, VALUE2, VALUE3, etc) to have values or else don't process and move on to the next  section</p>
  
  <p>(If you cannot see the XML come thought, I also made a screen shot)</p>