SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ive created some custom xsl for a view in a project i am working on. One of the columns shows a custom message depending on some date comparisons i am performing against other columns in the xsl. Ive noticed that the custom messages are not present when using the column header to filter. How can i make these values available in the header filter for this column. Is it possible?

Heres my code

<xsl:variable name="ExpiryDate" select="number(concat(substring(string($thisNode/@ExpiryDate),7,4),substring(string($thisNode/@ExpiryDate),4,2),substring-before(string($thisNode/@ExpiryDate),'/')))"/>
      <xsl:variable name="TodaysDate" select="number(ddwrt:FormatDateTime(ddwrt:Today(),2057,'yyyyMMdd'))" />

      <xsl:variable name="DateDelta">
        <xsl:call-template name="getDayDelta">
          <xsl:with-param name="paramDateA" select="concat(substring(string($thisNode/@ExpiryDate),7,4),'-', substring(string($thisNode/@ExpiryDate),4,2),'-', substring-before(string($thisNode/@ExpiryDate),'/'))"/>
          <xsl:with-param name="paramDateB" select="ddwrt:FormatDateTime(ddwrt:Today(),1033,'yyyy-MM-dd')"/>

        <xsl:when test="$ExpiryDate &lt;= $TodaysDate">
          <xsl:attribute name="style">color:red;</xsl:attribute>
          DO NOT USE
            <xsl:when test="$ExpiryDate &gt; $TodaysDate and $DateDelta &lt;= 30">
              <xsl:attribute name="style">color:orange;</xsl:attribute>
              EXPIRES IN 30 DAYS OR LESS
              <xsl:attribute name="style">color:green;</xsl:attribute>
              GOOD TO USE

Heres the column populated

enter image description here

Heres the header filter which is missing the values

enter image description here

share|improve this question
Can you show your xsl code or at least the parts that are not working? – Ryan Erickson May 9 '13 at 14:49
@RyanErickson its all working. I see the values and they are correct. The problem is the values are not in the header drop down so i cant filter on these values – Richard Banks May 9 '13 at 15:13
This is because the filtering is done on the server before the xsl transform. Could you change that to be a computed column rather than defining the values in the xsl? – Ryan Erickson May 9 '13 at 15:26
@RyanErickson thanks for that. I thought as much. I dont think i can make it a calculated column as it does some date comparisons using the current date. As far as i know you cant do this server side – Richard Banks May 10 '13 at 9:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.