title: How to compare two dates in Xsl?
body: <p>How to check if date in the xml file is over two years from today in xsl 1.0?
  here is my code, thank you</p>
  <p>xml file:</p>
  <pre><code>   &lt;forms&gt;
        &lt;form&gt;
           &lt;date&gt;20140105&lt;/date&gt;
        &lt;/form&gt;
      &lt;/forms&gt;
  </code></pre>
  <p>xsl file:</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;html&gt;
              &lt;script language=&quot;JScript&quot; implements-prefix=&quot;myJavaScript&quot;&gt;
                 &lt;![CDATA[
                    function GetCurrentDateTime(){
                      var dateObj = new Date();
                      var month = ('0' + (dateObj.getMonth() + 1)).slice(-2);
                      var date = ('0' + dateObj.getDate()).slice(-2);
                      var year = dateObj.getFullYear()-2;
                      var newDate = year  + month  + date;
                      return newDate
                    }
                 ]]&gt;
              &lt;/script&gt;
      &lt;xsl:for-each select=&quot;forms/form&quot;&gt;
          &lt;xsl:if test=&quot;date &amp;lt;= GetCurrentDateTime &quot;&gt;
              &lt;!-- in progress --&gt;
          &lt;/xsl:if&gt;
      &lt;/xsl:for-each&gt;
  &lt;/html&gt;
  </code></pre>