I have a basic XSLT filter in a SharePoint DataFormWebPart:
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$MyParameter)]"/>
$ MyParameter comes from an ASP.NET control. But an attempt to set the value of the variable by any other means leads to an error:
<xsl:variable name="Rows">
<xsl:value-of select="/dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$MyParameter)]"/>
</xsl:variable>
or
<xsl:variable name="Rows">
/dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$MyParameter)]
</xsl:variable>
The error I get: Argument 1 should return node -set. → count ($ Rows) <-
Ultimately, I try to achieve something similar:
<xsl:variable name="Rows">
<xsl:choose>
<xsl:when test="($MyParameter2 = '1')">
<xsl:value-of select="/dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$MyParameter)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/dsQueryResponse/Rows/Row[((ddwrt:FormatDateTime(string(@MyDate) ,1061 ,'MM'))=$otherParameter)]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Is this possible with XSLT, or should I look for other features in SharePoint Designer?
source
share