<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<!-- below we define the column to be used as the grouping column -->
<!-- for WSS, use will be equal to "@ows_grouping_column name" and name will be equal to a grouping name of your choice-->
<xsl:key use="@ows_ArticleArchiveMonth" name="ArticleArchiveMonthList" match="row"/>
<xsl:template match="/">
<!---the javascript to provide expand/collapse grouping-->
<script language="JavaScript" type="text/javascript"><![CDATA[function showHideItems(myItem, myButton){
var myItem = document.getElementById(myItem.id);
var myButton = document.getElementById(myButton.id);
if (myItem.style.display != 'none') {
myItem.style.display = 'none';
swapImage(myButton,'plus');
}
else {
myItem.style.display = 'block';
swapImage(myButton,'minus');
}
}
function MouseOver(){
document.body.style.cursor = 'Hand';
}
function MouseOut(){
document.body.style.cursor = 'default';
}
function swapImage(myImage, state) {
if (state == 'minus') {
myImage.src = "/_layouts/images/minus.gif";
}
else {
myImage.src = "/_layouts/images/plus.gif";
}
}]]></script>
<html>
<head>
<title>Web Links</title>
</head>
<body>
<table width="100%">
<tr>
<td>
<!-- begin div containing hidden items -->
<!--- this for-each statement uses the generate-id xsl function to find each unique example of our category grouping column-->
<xsl:for-each select="//row[generate-id()= generate-id(key('ArticleArchiveMonthList', @ows_ArticleArchiveMonth) [1]) ]" xml:space="default">
<xsl:sort select="@ows_ArticleMonthAsNumber" order="descending"/>
<!--we need to provide unique names for the expand/collapse buttons and images so we prepend the list name by the concat statement below-->
<xsl:variable name="MyId" select="concat('ArticleArchiveMonthId_',@ows_ID)"/>
<xsl:variable name="MyBtn" select="concat('ArticleArchiveMonthBtn_',@ows_ID)"/>
<font face="Trebuchet MS">
<font size="2">
<font color="#000000">
<b>
<!--<h2>-->
<a onmouseover="MouseOver();" onmouseout="MouseOut();">
<xsl:attribute name="onclick"><xsl:value-of select="concat('showHideItems(', $MyId, ',', $MyBtn,');')"/></xsl:attribute>
<img src="/_layouts/images/minus.gif" border="0" hspace="10">
<xsl:attribute name="name"><xsl:value-of select="$MyBtn"/></xsl:attribute>
<xsl:attribute name="id"><xsl:value-of select="$MyBtn"/></xsl:attribute>
</img>
</a>
<xsl:value-of select="@ows_ArticleArchiveMonth"/>
<!--</h2>-->
</b>
</font>
</font>
<br/>
<!--the code between the div tags is what will expand/collapse based on user actions-->
<div style="">
<xsl:attribute name="name"><xsl:value-of select="$MyId"/></xsl:attribute>
<xsl:attribute name="id"><xsl:value-of select="$MyId"/></xsl:attribute>
<font size="2">
<table>
<tr>
<td width="15px"> </td>
<td>
<p>
<ul STYLE="list-style-image: url(/_layouts/images/square.gif)">
<xsl:for-each select="key('ArticleArchiveMonthList', @ows_ArticleArchiveMonth)">
<b>
<span>
<xsl:call-template name="FormatDate">
<xsl:with-param name="DateTime" select="@ows_ArticleDate"/>
</xsl:call-template>
</span>
....
<xsl:value-of select="@ows_Title"/>
</b>
<br/>
<br/>
<xsl:value-of select="@ows_ArticleTease" disable-output-escaping="yes"/>
<br/>
<xsl:if test="@ows_ArticleLink!=''">
<a>
<xsl:attribute name="target">_new</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="@ows_ArticleLink"/></xsl:attribute>
Read the full article: <xsl:value-of select="@ows_Title"/>...
</a>
</xsl:if>
<br/>
<hr/>
<br/>
<br/>
</xsl:for-each>
</ul>
</p>
</td>
</tr>
</table>
</font>
</div>
</font>
</xsl:for-each>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template name="FormatDate">
<xsl:param name="DateTime"/>
<!-- Current date format 2007-07-19 07:00:00 -->
<!-- new date format 07/24/2007 12:00 AM -->
<xsl:variable name="dy">
<xsl:value-of select="substring($DateTime,6,2)"/>
</xsl:variable>
<xsl:variable name="mo">
<xsl:value-of select="substring($DateTime,9,2)"/>
</xsl:variable>
<xsl:variable name="year-temp">
<xsl:value-of select="substring($DateTime,1,4)"/>
</xsl:variable>
<xsl:variable name="hh">
<xsl:value-of select="substring($DateTime,12,2)"/>
</xsl:variable>
<xsl:variable name="mm">
<xsl:value-of select="substring($DateTime,14,3)"/>
</xsl:variable>
<xsl:variable name="timestring">
<xsl:value-of select="substring-after($DateTime,' ')"/>
</xsl:variable>
<xsl:value-of select="$dy"/>
<xsl:value-of select="'/'"/>
<xsl:value-of select="$mo"/>
<xsl:value-of select="'/'"/>
<xsl:value-of select="$year-temp"/>
<xsl:value-of select="' '"/>
<xsl:if test="($timestring != '00:00:00')">
<xsl:choose>
<xsl:when test="$hh = '00'">12</xsl:when>
<xsl:when test="$hh = '01'">01</xsl:when>
<xsl:when test="$hh = '02'">02</xsl:when>
<xsl:when test="$hh = '03'">03</xsl:when>
<xsl:when test="$hh = '04'">04</xsl:when>
<xsl:when test="$hh = '05'">05</xsl:when>
<xsl:when test="$hh = '06'">06</xsl:when>
<xsl:when test="$hh = '07'">07</xsl:when>
<xsl:when test="$hh = '08'">08</xsl:when>
<xsl:when test="$hh = '09'">09</xsl:when>
<xsl:when test="$hh = '10'">10</xsl:when>
<xsl:when test="$hh = '11'">11</xsl:when>
<xsl:when test="$hh = '12'">12</xsl:when>
<xsl:when test="$hh = '13'">01</xsl:when>
<xsl:when test="$hh = '14'">02</xsl:when>
<xsl:when test="$hh = '15'">03</xsl:when>
<xsl:when test="$hh = '16'">04</xsl:when>
<xsl:when test="$hh = '17'">05</xsl:when>
<xsl:when test="$hh = '18'">06</xsl:when>
<xsl:when test="$hh = '19'">07</xsl:when>
<xsl:when test="$hh = '20'">08</xsl:when>
<xsl:when test="$hh = '21'">09</xsl:when>
<xsl:when test="$hh = '22'">10</xsl:when>
<xsl:when test="$hh = '23'">11</xsl:when>
<xsl:when test="$hh = '24'">12</xsl:when>
</xsl:choose>
<xsl:value-of select="$mm"/>
<xsl:if test="($hh < 13)">
<xsl:value-of select="'AM'"/>
</xsl:if>
<xsl:if test="($hh > 12)">
<xsl:value-of select="'PM'"/>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>