Tags

,

I installed Sike Mullivan’s reminder and make some changes. Here is the xslt I am using

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform&quot;
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:z="#RowsetSchema">

<xsl:param name="listId" />
<xsl:param name="listTitle" />
<xsl:param name="listUrl" />
<xsl:param name="listImageUrl" />
<xsl:param name="listEditFormUrl" />
<xsl:param name="listDefaultViewUrl" />
<xsl:param name="siteUrl" />

<!– Main body template. Sets the Results view (Relevance or date) options –>
<xsl:template name="dvt_1.body">
<div >
<table style="font-size:9px;width:100%" cellpadding="5" cellspacing ="0" border="0" >
<tr>
<th nowrap="true">Title</th>
<th nowrap="true">Expire Date</th>
<th nowrap="true">Author</th>
<th nowrap="true">Created Date</th>
</tr>
<xsl:call-template name="DisplayResults">
</xsl:call-template>
</table>
</div>
</xsl:template>

<!– This template is called for each result –>
<xsl:template name="DisplayResults" >
<xsl:for-each select="/xml/rs:data/z:row">
<tr style="vertical-align=top;">
<td align="center">
<a>
<xsl:attribute name="href">
<xsl:value-of select="$listUrl" />/<xsl:value-of select="@ows_LinkFilename"/>
</xsl:attribute>
<xsl:value-of select="@ows_LinkFilename" />
</a>
</td>
<td align="center">
<xsl:call-template name="DateFormatter">
<xsl:with-param name="WholeDate" select="@ows_Expired_x0020_Date" />
</xsl:call-template>
</td>
<td align="center">
<xsl:call-template name="SPFormatSeparatedString">
<xsl:with-param name="Value" select="@ows_Author" />
<xsl:with-param name="ReturnIndex">
1
</xsl:with-param>
</xsl:call-template>
</td>
<td align="center">
<xsl:variable name="CreatedDate">
<xsl:call-template name="SPFormatSeparatedString">
<xsl:with-param name="Value" select="@ows_Created_x0020_Date" />
<xsl:with-param name="ReturnIndex">
1
</xsl:with-param>
</xsl:call-template>
</xsl:variable>

<xsl:call-template name="DateFormatter">
<xsl:with-param name="WholeDate" select="$CreatedDate" />
</xsl:call-template>
</td>
<td>

</td>
</tr>
</xsl:for-each>
</xsl:template>

<!– Format fields with ;# separator –>
<xsl:template name="SPFormatSeparatedString">
<xsl:param name="Value" />
<xsl:param name="ReturnIndex" />
<xsl:variable name="val1" select="substring-before($Value,’;#’)" />
<xsl:variable name="val2" select="substring-after($Value,’;#’)" />
<!– Printing the Value –>
<xsl:choose>
<xsl:when test="$ReturnIndex = 0">
<xsl:value-of select="$val1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$val2"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<!– The size attribute for each result is prepared here –>
<xsl:template name="DisplaySize">
<xsl:param name="size" />
<xsl:if test=’string-length($size) &gt; 0′>
<xsl:if test="number($size) &gt; 0">
<xsl:choose>
<xsl:when test="round($size div 1024) &lt; 1">
<xsl:value-of select="$size" /> Bytes
</xsl:when>
<xsl:when test="round($size div (1024 *1024)) &lt; 1">
<xsl:value-of select="round($size div 1024)" />KB
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="round($size div (1024 * 1024))"/>MB
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:if>
</xsl:template>

<!– A generic template to display string with non 0 string length (used for author and lastmodified time –>
<xsl:template name="DisplayString">
<xsl:param name="str" />
<xsl:if test=’string-length($str) &gt; 0′>
<xsl:value-of select="$str" />
</xsl:if>
</xsl:template>

<!– Date Formatter –>
<xsl:template name="DateFormatter">
<xsl:param name="WholeDate" />
<xsl:variable name="YrMonDat" select="substring-before($WholeDate,’ ‘)" />
<xsl:variable name="TimeGiven" select="substring-after($WholeDate,’ ‘)" />
<!–Extracting Date–>
<xsl:variable name="Year" select="substring-before($YrMonDat,’-‘)" />
<xsl:variable name="RemYear" select="substring-after($YrMonDat,’-‘)" />
<xsl:variable name="Month" select="substring-before($RemYear,’-‘)" />
<xsl:variable name="Day" select="substring-after($RemYear,’-‘)" />
<xsl:variable name="MonthName">
<xsl:choose>
<xsl:when test="$Month = 1">Jan</xsl:when>
<xsl:when test="$Month = 2">Feb</xsl:when>
<xsl:when test="$Month = 3">Mar</xsl:when>
<xsl:when test="$Month = 4">Apr</xsl:when>
<xsl:when test="$Month = 5">May</xsl:when>
<xsl:when test="$Month = 6">Jun</xsl:when>
<xsl:when test="$Month = 7">Jul</xsl:when>
<xsl:when test="$Month = 8">Aug</xsl:when>
<xsl:when test="$Month = 9">Sep</xsl:when>
<xsl:when test="$Month = 10">Oct</xsl:when>
<xsl:when test="$Month = 11">Nov</xsl:when>
<xsl:when test="$Month = 12">Dec</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="MonthDisplayNum">
<xsl:choose>
<xsl:when test="$Month = 1">1</xsl:when>
<xsl:when test="$Month = 2">2</xsl:when>
<xsl:when test="$Month = 3">3</xsl:when>
<xsl:when test="$Month = 4">4</xsl:when>
<xsl:when test="$Month = 5">5</xsl:when>
<xsl:when test="$Month = 6">6</xsl:when>
<xsl:when test="$Month = 7">7</xsl:when>
<xsl:when test="$Month = 8">8</xsl:when>
<xsl:when test="$Month = 9">9</xsl:when>
<xsl:when test="$Month = 10">10</xsl:when>
<xsl:when test="$Month = 11">11</xsl:when>
<xsl:when test="$Month = 12">12</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<!–Extracting Time–>
<xsl:variable name="MilHour" select="substring-before($TimeGiven,’:’)" />
<xsl:variable name="RemHour" select="substring-after($TimeGiven,’:’)" />
<xsl:variable name="Min" select="substring-before($RemHour,’:’)" />
<xsl:variable name="Hour">
<xsl:choose>
<xsl:when test="$MilHour &gt; 12">
<xsl:value-of select="$MilHour – 12"/>
</xsl:when>
<xsl:when test="$MilHour = 0">
12
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$MilHour"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="HourExt">
<xsl:choose>
<xsl:when test="$MilHour &gt; 12">
PM
</xsl:when>
<xsl:otherwise>
AM
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!– Printing the Value –>
<xsl:choose>
<xsl:when test="normalize-space($WholeDate) != ”">
<xsl:value-of select="$Day" />/<xsl:value-of select="$MonthDisplayNum"/>/<xsl:value-of select="$Year" /> <xsl:value-of select="$Hour" />:<xsl:value-of select="$Min" /><xsl:value-of select="$HourExt" />
</xsl:when>
<xsl:otherwise>

</xsl:otherwise>
</xsl:choose>
</xsl:template>

<!– XSL transformation starts here –>
<xsl:template match="/">
<div style="width:100%;text-align:left">
Go to
<a border="0">
<xsl:attribute name="href">
<xsl:value-of select="$listDefaultViewUrl"></xsl:value-of>
</xsl:attribute>
<img border="0">
<xsl:attribute name="src">
<xsl:value-of select="$listImageUrl"></xsl:value-of>
</xsl:attribute>
</img>
 
<xsl:value-of select="$listTitle"></xsl:value-of>
</a>
<br/>
<br/>
<div style="font-size:12px;text-align:left;font-weight:bold">
<span>Expired Items</span>
</div>
<xsl:call-template name="dvt_1.body">
</xsl:call-template>
<br/>
<br/>
</div>
</xsl:template>

<!– End of Stylesheet –>
</xsl:stylesheet>

Advertisements