title: forcing xslt to use version 2 with xslCompiledTransform
body: <p>I have following xslt , I need to use xslt version 2.0 functions like 'format-date'. How do I declare the Xsl sheet to use version 2.0 using XsltCompiledTransform class (c#, .net 4.5).</p>
  
  <pre><code> &lt;xsl:stylesheet version="2.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns="http://www.w3.org/TR/xhtml1/strict"
                 xmlns:msxsl='urn:schemas-microsoft-com:xslt' 
                 xmlns:var='urn:var' 
                 xmlns:JS='urn:JS'
                  &gt;
    &lt;xsl:output method="html"/&gt;
    &lt;xsl:variable name="n" select="1"/&gt;
    &lt;xsl:template match="/NewDataSet"&gt;
      &lt;html&gt;
        &lt;head&gt;
          &lt;style&gt;
            table{border-collapse:collapse;font-family:"Verdana";}
            table,td{border:1px solid black;color:black; background-color:white;font-family:"Verdana";}
            table,th{border:1px solid balck;background-color:black;color:white;font-family:"Verdana"; }
            .rt{color:red;font-family:"Verdana";}
            .nt{color:black;font-family:"Verdana";}
            .redb{color:yellow; background-color:red;font-family:"Verdana";}
            .greenb{color:white;background-color:green;font-family:"Verdana";}
            .blackb{color:white;background-color:black;font-family:"Verdana";}
          &lt;/style&gt;
          &lt;title&gt;EDI validation Result &lt;/title&gt;
        &lt;/head&gt;
        &lt;body&gt;
          &lt;p class="nt"&gt;
            EDI validation result  of the PO &lt;span class="rt"&gt;&lt;xsl:value-of select="info/pono"/&gt;&lt;/span&gt;
            received from &lt;xsl:value-of select="info/CustomerName"/&gt;.
          &lt;/p&gt;
  
          &lt;table&gt;
             &lt;th class="blackb" &gt;Position&lt;/th&gt;
            &lt;th class="blackb"&gt; Item Code &lt;/th&gt;
            &lt;th class="blackb"&gt;UoM&lt;/th&gt;
            &lt;th class="blackb"&gt; Ordered Qty .&lt;/th&gt;
            &lt;th class="blackb"&gt;Ship Request&lt;/th&gt;
            &lt;th class="blackb"&gt; Net-Quoted &lt;/th&gt;
            &lt;th class="blackb"&gt; Net-Catalog &lt;/th&gt;
            &lt;th class="blackb"&gt;Status&lt;/th&gt;
            &lt;xsl:for-each select="Table"&gt;
              &lt;tr&gt;
                &lt;xsl:choose&gt;
                  &lt;xsl:when test="Status !=''"&gt;
                    &lt;xsl:value-of disable-output-escaping="yes" select="JS:IncBlines()"/&gt;
                    &lt;td class="redb"&gt;&lt;xsl:value-of select="Position"/&gt;&lt;/td&gt;
                    &lt;td class="redb"&gt;&lt;xsl:value-of select="ItemCode "/&gt;&lt;/td&gt;
                    &lt;td class="redb"&gt;&lt;xsl:value-of select="UoM"/&gt;&lt;/td&gt;
                    &lt;td class="redb"&gt;&lt;xsl:value-of select="QtyOrdered"/&gt;&lt;/td&gt;
                    &lt;td class="redb"&gt;&lt;xsl:value-of select="format-date(RequiredBy,'D1o [MNn] [Y0001]')"/&gt;&lt;/td&gt;
                    &lt;td class="redb"&gt;&lt;xsl:value-of select="PriceQuoted"/&gt;&lt;/td&gt;
                    &lt;td class="redb"&gt;&lt;xsl:value-of select="Net"/&gt;&lt;/td&gt;
                    &lt;td class="redb"&gt;&lt;xsl:value-of select="Status"/&gt;&lt;/td&gt;
                  &lt;/xsl:when&gt;
                  &lt;xsl:otherwise&gt;
                    &lt;xsl:value-of select="JS:IncGlines()"/&gt;
  
                    &lt;td class="greenb"&gt;&lt;xsl:value-of select="Position"/&gt;&lt;/td&gt;
                    &lt;td class="greenb"&gt;&lt;xsl:value-of select="ItemCode"/&gt;&lt;/td&gt;
                    &lt;td class="greenb"&gt;&lt;xsl:value-of select="UoM"/&gt;&lt;/td&gt;
                    &lt;td class="greenb"&gt;&lt;xsl:value-of select="QtyOrdered"/&gt;&lt;/td&gt;
                    &lt;td class="greenb"&gt;&lt;xsl:value-of select="format-date(RequiredBy,'D1o [MNn] [Y0001]')"/&gt;&lt;/td&gt;
  
  
                    &lt;td class="greenb"&gt;&lt;xsl:value-of select="PriceQuoted"/&gt;&lt;/td&gt;
                    &lt;td class="greenb"&gt;&lt;xsl:value-of select="Net"/&gt;&lt;/td&gt;
                    &lt;td class="greenb"&gt;&lt;xsl:value-of select="Status"/&gt;OK&lt;/td&gt;
  
                   &lt;/xsl:otherwise&gt;
                  &lt;/xsl:choose&gt;
              &lt;/tr&gt;
            &lt;/xsl:for-each&gt;
          &lt;/table&gt;
  
          &lt;xsl:if test="JS:GetBlines() &amp;gt; 0"    &gt;
  
            &lt;p class="nt"&gt;
  
                The order validation has failed,
  
                The order will not be processesed as there are &lt;xsl:value-of select ="JS:GetBlines()"/&gt; lines in error.
                &lt;p class="rt"&gt;
  
                  The P.O is rejected as per agreed processing rules.
  
  
            &lt;/p&gt;
            &lt;/p&gt;
  
          &lt;/xsl:if&gt;
  
          &lt;xsl:if test="JS:GetBlines() &amp;lt; 1"&gt;
            &lt;p class="nt"&gt;
            The Order validated succesfully.
            Will e-mail Order Acknoledgement (non-edi) shortly.
            &lt;/p&gt;
          &lt;/xsl:if&gt;
  
        &lt;/body&gt;
      &lt;/html&gt;
    &lt;/xsl:template&gt;
    &lt;msxsl:script language='JScript' implements-prefix='JS'&gt;
  
      &lt;![CDATA[
      var j :int=0;
      var blines:int =0;
      var glines:int=0;
      function Inc(current)
      {j=j+current;
  
    return  j+current;
      }
      function IncBlines()
      {
       blines++;
      }
      function IncGlines()
      {
      glines++;
      }
  
      function GetBlines()
      {
      return blines;
      }
      function GetGlines()
      {
      return glines;
      }
  ]]&gt;
    &lt;/msxsl:script&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>