title: Alternative ways for setting variable value in XSLT?
body: <p>I have a basic XSLT filter on a SharePoint 2007 DataFormWebPart:</p>
  
  <pre><code>&lt;xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$MyParameter)]"/&gt;
  </code></pre>
  
  <p>The <em>$MyParameter</em> comes from an ASP.NET control. But trying to set the variable value in any other ways results in an error:</p>
  
  <pre><code>&lt;xsl:variable name="Rows"&gt;
  &lt;xsl:value-of select="/dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$MyParameter)]"/&gt;
  &lt;/xsl:variable&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;xsl:variable name="Rows"&gt;
  /dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$MyParameter)]
  &lt;/xsl:variable&gt;
  </code></pre>
  
  <p>The error I get is:  <strong>Argument 1 must return a node-set. -->count($Rows)&lt;--</strong></p>
  
  <p>Ultimately, I am trying to achieve something similar:</p>
  
  <pre><code>&lt;xsl:variable name="Rows"&gt;
  &lt;xsl:choose&gt;
    &lt;xsl:when test="($MyParameter2 = '1')"&gt;
      &lt;xsl:value-of select="/dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$MyParameter)]"/&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;
      &lt;xsl:value-of select="/dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$otherParameter)]"/&gt;
    &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  &lt;/xsl:variable&gt;
  </code></pre>
  
  <p>Is anything like this possible with XSLT or should I look for other possibilities within SharePoint Designer?</p>