Calendar Table Sample

Want to mess around with the college calendar and feeds?
Here are some sample files to get you started.

The Feed

 http://apps.cehd.umn.edu/events/admin/RSSFeed.aspx?&x=20&r=3&q=6&t=170

The XSLT

<xsl:stylesheet version="1.0">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:template match="/rss/channel">
<table id="CalGrid"><!-- Starting the table -->
<xsl:for-each select="item"><xsl:choose><!-- Making a choice if there are events or not -->
<xsl:when test="string(title)='There are no events listed for this month'">
<!-- This is the default text of there are no events, so it exists write the next line -->
<tr><td><strong>Sorry, there are no events listed this week!</strong></td></tr></xsl:when>
<!-- Exit this when -->
<xsl:otherwise><!-- Plain English, so if it didn't match do this! -->
<xsl:if test="@sequenceByDate='1'"><!-- Testing to see if it is the first item in a set of items for the same day -->
<!-- This allows me to write a date once, then stack events under it -->
<tr><th colspan="3"><xsl:value-of select="dateFull" disable-output-escaping="yes"/></th></tr><tr><th>Time</th><th>Description</th><th>Location</th></tr></xsl:if><!-- Exit the if test --><tr><td><xsl:value-of select="startTime" disable-output-escaping="yes"/> -
<xsl:value-of select="endTime" disable-output-escaping="yes"/></td><td>
<p><xsl:attribute name="id"><xsl:value-of select="concat('E',occurrenceId)"/>
<!-- Assigning a value the attribute id incase I want to link right to the event -->
</xsl:attribute><strong><xsl:value-of select="title" disable-output-escaping="yes"/></strong></p>
<xsl:value-of select="description" disable-output-escaping="yes"/></td><td>
<xsl:choose>
<xsl:when test="string(locationURL)">
<!-- Checking for a location URL before I try to make a hyperlink from it --><a><xsl:attribute name="href">
<xsl:value-of select="locationURL"/></xsl:attribute><xsl:value-of select="location" disable-output-escaping="yes"/></a>
</xsl:when>
<xsl:otherwise><!-- If no URL exists, don't hyperlink the text -->
<xsl:value-of select="location" disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose></td></tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</table>
</xsl:template></xsl:stylesheet>

The CSS

/*	College of Education and Human Development
	CSS for XSLT Examples
	Authors: Jeff Abuzzahab
	Created: 2009-10-06
	Updated: 2009-10-06 */

body {
	background-color: #fff;
	font-family:Verdana, Arial, Helvetica, sans-serif;
	font-size:.8em;

}

h1 {font:bold 175%/100% Calibri, Arial, sans-serif;color:#3d873b;margin-top:20px;}
h2 {font:bold 145%/100% Calibri, Arial, sans-serif;color:#434087;margin-top:20px;}
h3 {font:bold 110%/100% Calibri, Arial, sans-serif;color:#434087;margin-top:20px;}
h4 {font:bold 105%/100% Calibri, Arial, sans-serif;color:#434087;margin-top:20px;}
h5 {font:bold 100%/100% Calibri, Arial, sans-serif;color:#434087;}
h6 {font:bold 100%/100% Calibri, Arial, sans-serif;color:#434087;}

a {color:#434087;}

table#CalGrid {
	border:none;
	border-collapse: collapse;
	empty-cells: show;
	width: 725px;
	padding:0;
	margin:10px 25px;
}

table#CalGrid caption {
	text-align:left;
	color:#336666;;
	font-weight:bold;
	padding:0;
	margin:15px 0 10px 0;
}

table#CalGrid th {
	padding:4px;
	border-spacing: 4px;
	vertical-align:top;
	text-align:left;
	border:1px solid #ccc;
	background-color:#e2e2e2;
}

table#CalGrid td {
	padding:4px;
	border-spacing: 4px;
	vertical-align:top;
	text-align:left;
	border:1px solid #ccc;
}

table#CalGrid td.item {
	font-weight:bold;
	background-color:#e2e2e2;
	width:20%;
} 

table#CalGrid td.time {
	width:22%;
}

table#CalGrid td.description {
	width:58%;
}

table#CalGrid td.location {
	width:20%;
}

table#CalGrid th.HdrDate {
	color:#fff;
	background-color:#366;
}

table#CalGrid td p {
	padding:0 0 5px 5px;
	margin:0;
}

table#CalGrid td ul {
	margin:0px;
	padding:0px;
}

table#CalGrid td ul li {
	list-style-type:none;
	margin:0 0 5px 5px;
	padding:0px;
}

table#CalGrid td ul li ul li {margin:0 0 0 15px;}

@media print {
	table#CalGrid {width:98%;margin:10px;font-size:14pt;color:black;}
	table#CalGrid th.HdrDate {font-size:16pt;font-weight:bold;color:#000;background-color:#fff;}
	div#maincontent { width:100%;margin:0;}
	div#cal-future h2, h2 {font-size:18pt;}
	div#cal-future h2 {font-size:16pt;}
	p, li {font-size:14pt;}
}