On a recent engagement, I had a number of requirements to display data in a grid and/or chart that compared a current period from the same period one year ago. The content was all coming from SharePoint lists. As many of you know, the SharePoint Data Provider has some built in date filtering options.
These are from the Online Help for the SharePoint Data Provider:
• [Today] – Today’s date
• [CurrentWeekStart] – The first day in the current week
• [CurrentWeekEnd] – The last day in the current week
• [CurrentMonthStart] – The first day in the current month
• [CurrentMonthEnd] – The last day in the current month
• [CurrentYearStart] – The first day in the current year
• [CurrentYearEnd] – The last day in the current year
• [Quarter1Start] – The first day in the first quarter of the current year
• [Quarter1End] – The last day in the first quarter of the current year
• [Quarter2Start] – The first day in the second quarter of the current year
• [Quarter2End] – The last day in the second quarter of the current year
• [Quarter3Start] – The first day in the third quarter of the current year
• [Quarter3End] – The last day in the third quarter of the current year
• [Quarter4Start] – The first day in the fourth quarter of the current year
• [Quarter4End] – The last day in the fourth quarter of the current year
• [OneWeekAgoStart] – The first day of the previous week
• [OneWeekAgoEnd] – The last day of the previous week
• [TwoWeeksAgoStart] – The first day of the week before last
• [TwoWeeksAgoEnd] – The last day of the week before last
• [OneWeekFromNowStart] – The first day of next week
• [OneWeekFromNowEnd] – The last day of next week
• [TwoWeeksFromNowStart] – The first day of the week after next
• [TwoWeeksFromNowEnd] – The last day of the week after next
• [OneMonthAgoStart] – The first day of last month
• [OneMonthAgoEnd] – The last day of last month
• [OneMonthFromNowStart] – The first day of next month
• [OneMonthFromNowEnd] – The last day of next month
My customer wanted the display to show several different periods based on today’s date. They were Current/Prior Month, Current/Prior Quarter and Current/Prior Year. And the Prior period was for same period last year. For example, if the today’s date is March 11, 2010, then the following providers were needed:
Current/Prior Month = March 2010/March 2009
Current/Prior Quarter = Jan-Mar 2010/Jan-Mar 2009
Current/Prior Year = 2010/2009
So customer needed providers that would filter based on that criteria. If my list item had a date of March 5, 2010, it would appear in the provider for Current Month, Current Quarter and Current Year. If the list item had a date of February 12, 2010, it would appear in the provider for Current Quarter and Current Year but not current month because it’s March not February. Well you get the idea.
So from our date filter options listed above, we only have several options for building our required providers.
• [CurrentMonthStart] – The first day in the current month
• [CurrentMonthEnd] – The last day in the current month
• [CurrentYearStart] – The first day in the current year
• [CurrentYearEnd] – The last day in the current year
Using the above filter options, we could produce a filter that gives us Current Month and Current Year based today’s date. However, we have several other provider requirements to satisfy with no date filter options available to us.
So I decided to use a mashup to filter the SharePoint Data Provider to produce the filtered results that I needed. I have included all three XSLT files below should you ever need to do something similar.
Current/Prior Month XSLT
<?xml version=”1.0″ encoding=”utf-8″ ?>
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:ms=”urn:schemas-microsoft-com:xslt”>
<xsl:output method=”xml” omit-xml-declaration=”yes” />
<xsl:template match=”/”>
<NewDataSet>
<xsl:for-each select=”NewDataSet/Table1″>
<xsl:variable name=”currbeg”><xsl:call-template name=’FormatCurrentBeginDate’/></xsl:variable>
<xsl:variable name=”currend”><xsl:call-template name=’FormatCurrentEndDate’/></xsl:variable>
<xsl:variable name=”priorbeg”><xsl:call-template name=’FormatPriorBeginDate’/></xsl:variable>
<xsl:variable name=”priorend”><xsl:call-template name=’FormatPriorEndDate’/></xsl:variable>
<xsl:variable name=”od”>
<xsl:choose>
<xsl:when test=”Revised_x0020_Delivery != ””>
<xsl:call-template name=’FormatOrderDate’><xsl:with-param name=”orderdate” select=”Revised_x0020_Delivery”/></xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name=’FormatOrderDate’><xsl:with-param name=”orderdate” select=”Planned_x0020_Delivery”/></xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test=”$od >= $currbeg and $od <= $currend”>
<Table1>
<Site>
<xsl:value-of select=”Site”/>
</Site>
<OrderDate>
<xsl:value-of select=”$od”/>
</OrderDate>
<Current>
<xsl:value-of select=”Total_x0020_Billed”/>
</Current>
<Amount>
<xsl:value-of select=”Total_x0020_Billed”/>
</Amount>
<PivotColumn>Current</PivotColumn>
</Table1>
</xsl:if>
<xsl:if test=”$od >= $priorbeg and $od <= $priorend”>
<Table1>
<Site>
<xsl:value-of select=”Site”/>
</Site>
<OrderDate>
<xsl:value-of select=”$od”/>
</OrderDate>
<Prior>
<xsl:value-of select=”Total_x0020_Billed”/>
</Prior>
<Amount>
<xsl:value-of select=”Total_x0020_Billed”/>
</Amount>
<PivotColumn>Prior</PivotColumn>
</Table1>
</xsl:if>
</xsl:for-each>
<Table1>
<Site/>
<OrderDate/>
<Current>0</Current>
<Amount>0</Amount>
<PivotColumn>Current</PivotColumn>
</Table1>
<Table1>
<Site/>
<OrderDate/>
<Prior>0</Prior>
<Amount>0</Amount>
<PivotColumn>Prior</PivotColumn>
</Table1>
</NewDataSet>
</xsl:template>
<xsl:template name=”FormatCurrentBeginDate”>
<xsl:variable name=”extractedDate”>
<xsl:value-of select=”substring-before(‘[currentmonthstart]‘,’ ‘)” />
</xsl:variable>
<xsl:variable name=”month”>
<xsl:value-of select=”substring-before($extractedDate,’/')” />
</xsl:variable>
<xsl:variable name=”day”>
<xsl:value-of select=”substring-before(substring-after($extractedDate,’/'),’/')” />
</xsl:variable>
<xsl:variable name=”year”>
<xsl:value-of select=”substring-after(substring-after($extractedDate,’/'),’/')” />
</xsl:variable>
<xsl:value-of select=”$year”/>
<xsl:choose>
<xsl:when test=”string-length($month) = 1″>0<xsl:value-of select=”$month”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$month”/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test=”string-length($day) = 1″>0<xsl:value-of select=”$day”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$day”/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name=”FormatCurrentEndDate”>
<xsl:variable name=”extractedDate”>
<xsl:value-of select=”substring-before(‘[currentmonthend]‘,’ ‘)” />
</xsl:variable>
<xsl:variable name=”month”>
<xsl:value-of select=”substring-before($extractedDate,’/')” />
</xsl:variable>
<xsl:variable name=”day”>
<xsl:value-of select=”substring-before(substring-after($extractedDate,’/'),’/')” />
</xsl:variable>
<xsl:variable name=”year”>
<xsl:value-of select=”substring-after(substring-after($extractedDate,’/'),’/')” />
</xsl:variable>
<xsl:value-of select=”$year”/>
<xsl:choose>
<xsl:when test=”string-length($month) = 1″>0<xsl:value-of select=”$month”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$month”/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test=”string-length($day) = 1″>0<xsl:value-of select=”$day”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$day”/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name=”FormatPriorBeginDate”>
<xsl:variable name=”extractedDate”>
<xsl:value-of select=”substring-before(‘[currentmonthstart]‘,’ ‘)” />
</xsl:variable>
<xsl:variable name=”month”>
<xsl:value-of select=”substring-before($extractedDate,’/')” />
</xsl:variable>
<xsl:variable name=”day”>
<xsl:value-of select=”substring-before(substring-after($extractedDate,’/'),’/')” />
</xsl:variable>
<xsl:variable name=”year”>
<xsl:value-of select=”substring-after(substring-after($extractedDate,’/'),’/')” />
</xsl:variable>
<xsl:value-of select=”$year – 1″/>
<xsl:choose>
<xsl:when test=”string-length($month) = 1″>0<xsl:value-of select=”$month”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$month”/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test=”string-length($day) = 1″>0<xsl:value-of select=”$day”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$day”/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name=”FormatPriorEndDate”>
<xsl:variable name=”extractedDate”>
<xsl:value-of select=”substring-before(‘[currentmonthend]‘,’ ‘)” />
</xsl:variable>
<xsl:variable name=”month”>
<xsl:value-of select=”substring-before($extractedDate,’/')” />
</xsl:variable>
<xsl:variable name=”day”>
<xsl:value-of select=”substring-before(substring-after($extractedDate,’/'),’/')” />
</xsl:variable>
<xsl:variable name=”year”>
<xsl:value-of select=”substring-after(substring-after($extractedDate,’/'),’/')” />
</xsl:variable>
<xsl:value-of select=”$year – 1″/>
<!– Subtracting 1 to get previous period. –>
<xsl:choose>
<xsl:when test=”string-length($month) = 1″>0<xsl:value-of select=”$month”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$month”/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test=”string-length($day) = 1″>0<xsl:value-of select=”$day”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$day + 1″/>
<!– Adding 1 day to every month to account for a potential Leap Year.
Having an extra day for months other than February should not affect the result set –>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name=”FormatOrderDate”>
<xsl:param name=”orderdate” />
<xsl:variable name=”month”>
<xsl:value-of select=”substring-before($orderdate,’/')” />
</xsl:variable>
<xsl:variable name=”day”>
<xsl:value-of select=”substring-before(substring-after($orderdate,’/'),’/')” />
</xsl:variable>
<xsl:variable name=”year”>
<xsl:value-of select=”substring-after(substring-after($orderdate,’/'),’/')” />
</xsl:variable>
<xsl:value-of select=”$year”/>
<xsl:choose>
<xsl:when test=”string-length($month) = 1″>0<xsl:value-of select=”$month”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$month”/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test=”string-length($day) = 1″>0<xsl:value-of select=”$day”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$day”/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Current/Prior Quarter XSLT
<?xml version=”1.0″ encoding=”utf-8″ ?>
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:ms=”urn:schemas-microsoft-com:xslt”>
<xsl:output method=”xml” omit-xml-declaration=”yes” />
<xsl:template match=”/”>
<NewDataSet>
<xsl:for-each select=”NewDataSet/Table1″>
<xsl:variable name=”currbeg”><xsl:call-template name=’FormatCurrentBeginDate’/></xsl:variable>
<xsl:variable name=”currend”><xsl:call-template name=’FormatCurrentEndDate’/></xsl:variable>
<xsl:variable name=”priorbeg”><xsl:call-template name=’FormatPriorBeginDate’/></xsl:variable>
<xsl:variable name=”priorend”><xsl:call-template name=’FormatPriorEndDate’/></xsl:variable>
<xsl:variable name=”od”>
<xsl:choose>
<xsl:when test=”Revised_x0020_Delivery != ””>
<xsl:call-template name=’FormatOrderDate’><xsl:with-param name=”orderdate” select=”Revised_x0020_Delivery”/></xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name=’FormatOrderDate’><xsl:with-param name=”orderdate” select=”Planned_x0020_Delivery”/></xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test=”$od >= $currbeg and $od <= $currend”>
<Table1>
<Site>
<xsl:value-of select=”Site”/>
</Site>
<OrderDate>
<xsl:value-of select=”$od”/>
</OrderDate>
<Current>
<xsl:value-of select=”Total_x0020_Billed”/>
</Current>
<Amount>
<xsl:value-of select=”Total_x0020_Billed”/>
</Amount>
<PivotColumn>Current</PivotColumn>
</Table1>
</xsl:if>
<xsl:if test=”$od >= $priorbeg and $od <= $priorend”>
<Table1>
<Site>
<xsl:value-of select=”Site”/>
</Site>
<OrderDate>
<xsl:value-of select=”$od”/>
</OrderDate>
<Prior>
<xsl:value-of select=”Total_x0020_Billed”/>
</Prior>
<Amount>
<xsl:value-of select=”Total_x0020_Billed”/>
</Amount>
<PivotColumn>Prior</PivotColumn>
</Table1>
</xsl:if>
</xsl:for-each>
<Table1>
<Site/>
<OrderDate/>
<Current>0</Current>
<Amount>0</Amount>
<PivotColumn>Current</PivotColumn>
</Table1>
<Table1>
<Site/>
<OrderDate/>
<Prior>0</Prior>
<Amount>0</Amount>
<PivotColumn>Prior</PivotColumn>
</Table1>
</NewDataSet>
</xsl:template>
<xsl:template name=”FormatCurrentBeginDate”>
<xsl:choose>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’1′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’2′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’3′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>0101</xsl:text>
</xsl:when>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’4′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’5′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’6′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>0401</xsl:text>
</xsl:when>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’7′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’8′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’9′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>0701</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>1001</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name=”FormatCurrentEndDate”>
<xsl:choose>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’1′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’2′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’3′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>0331</xsl:text>
</xsl:when>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’4′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’5′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’6′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>0630</xsl:text>
</xsl:when>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’7′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’8′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’9′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>0930</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>1231</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name=”FormatPriorBeginDate”>
<xsl:choose>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’1′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’2′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’3′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>0101</xsl:text>
</xsl:when>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’4′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’5′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’6′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>0401</xsl:text>
</xsl:when>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’7′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’8′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’9′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>0701</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>1001</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name=”FormatPriorEndDate”>
<xsl:choose>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’1′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’2′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’3′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>0331</xsl:text>
</xsl:when>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’4′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’5′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’6′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>0630</xsl:text>
</xsl:when>
<xsl:when test=”ms:format-date(‘[todayrfc]‘, ‘M’) = ’7′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’8′ or ms:format-date(‘[todayrfc]‘, ‘M’) = ’9′”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>0930</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>1231</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name=”FormatOrderDate”>
<xsl:param name=”orderdate” />
<xsl:variable name=”month”>
<xsl:value-of select=”substring-before($orderdate,’/')” />
</xsl:variable>
<xsl:variable name=”day”>
<xsl:value-of select=”substring-before(substring-after($orderdate,’/'),’/')” />
</xsl:variable>
<xsl:variable name=”year”>
<xsl:value-of select=”substring-after(substring-after($orderdate,’/'),’/')” />
</xsl:variable>
<xsl:value-of select=”$year”/>
<xsl:choose>
<xsl:when test=”string-length($month) = 1″>0<xsl:value-of select=”$month”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$month”/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test=”string-length($day) = 1″>0<xsl:value-of select=”$day”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$day”/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Current/Prior Year XSLT
<?xml version=”1.0″ encoding=”utf-8″ ?>
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:ms=”urn:schemas-microsoft-com:xslt”>
<xsl:output method=”xml” omit-xml-declaration=”yes” />
<xsl:template match=”/”>
<NewDataSet>
<xsl:for-each select=”NewDataSet/Table1″>
<xsl:variable name=”currbeg”><xsl:call-template name=’FormatCurrentBeginDate’/></xsl:variable>
<xsl:variable name=”currend”><xsl:call-template name=’FormatCurrentEndDate’/></xsl:variable>
<xsl:variable name=”priorbeg”><xsl:call-template name=’FormatPriorBeginDate’/></xsl:variable>
<xsl:variable name=”priorend”><xsl:call-template name=’FormatPriorEndDate’/></xsl:variable>
<xsl:variable name=”od”>
<xsl:choose>
<xsl:when test=”Revised_x0020_Delivery != ””>
<xsl:call-template name=’FormatOrderDate’><xsl:with-param name=”orderdate” select=”Revised_x0020_Delivery”/></xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name=’FormatOrderDate’><xsl:with-param name=”orderdate” select=”Planned_x0020_Delivery”/></xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test=”$od >= $currbeg and $od <= $currend”>
<Table1>
<Site>
<xsl:value-of select=”Site”/>
</Site>
<OrderDate>
<xsl:value-of select=”$od”/>
</OrderDate>
<Current>
<xsl:value-of select=”Total_x0020_Billed”/>
</Current>
<Amount>
<xsl:value-of select=”Total_x0020_Billed”/>
</Amount>
<PivotColumn>Current</PivotColumn>
</Table1>
</xsl:if>
<xsl:if test=”$od >= $priorbeg and $od <= $priorend”>
<Table1>
<Site>
<xsl:value-of select=”Site”/>
</Site>
<OrderDate>
<xsl:value-of select=”$od”/>
</OrderDate>
<Prior>
<xsl:value-of select=”Total_x0020_Billed”/>
</Prior>
<Amount>
<xsl:value-of select=”Total_x0020_Billed”/>
</Amount>
<PivotColumn>Prior</PivotColumn>
</Table1>
</xsl:if>
</xsl:for-each>
<Table1>
<Site/>
<OrderDate/>
<Current>0</Current>
<Amount>0</Amount>
<PivotColumn>Current</PivotColumn>
</Table1>
<Table1>
<Site/>
<OrderDate/>
<Prior>0</Prior>
<Amount>0</Amount>
<PivotColumn>Prior</PivotColumn>
</Table1>
</NewDataSet>
</xsl:template>
<xsl:template name=”FormatCurrentBeginDate”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>0101</xsl:text>
</xsl:template>
<xsl:template name=”FormatCurrentEndDate”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)”/>
<xsl:text>1231</xsl:text>
</xsl:template>
<xsl:template name=”FormatPriorBeginDate”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>0101</xsl:text>
</xsl:template>
<xsl:template name=”FormatPriorEndDate”>
<xsl:value-of select=”ms:format-date(‘[todayrfc]‘, ‘yyyy’)-1″/>
<xsl:text>1231</xsl:text>
</xsl:template>
<xsl:template name=”FormatOrderDate”>
<xsl:param name=”orderdate” />
<xsl:variable name=”month”>
<xsl:value-of select=”substring-before($orderdate,’/')” />
</xsl:variable>
<xsl:variable name=”day”>
<xsl:value-of select=”substring-before(substring-after($orderdate,’/'),’/')” />
</xsl:variable>
<xsl:variable name=”year”>
<xsl:value-of select=”substring-after(substring-after($orderdate,’/'),’/')” />
</xsl:variable>
<xsl:value-of select=”$year”/>
<xsl:choose>
<xsl:when test=”string-length($month) = 1″>0<xsl:value-of select=”$month”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$month”/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test=”string-length($day) = 1″>0<xsl:value-of select=”$day”/></xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$day”/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>