root/trunk/deployment/webuser/webapp/resources/demoskins/default/default/rss-list.xsl

Revision 1737 (checked in by johnsa, 5 years ago)

user clients: update pubDate of rss feeds to rely on "now" utc date

Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3   <xsl:output
4     method="xml"
5     omit-xml-declaration="no"
6     indent="yes"
7     doctype-public="'-//Netscape Communications//DTD RSS 0.91//EN' 'http://my.netscape.com/public/formats/rss-0.91.dtd'"
8     media-type="text/xml"
9     encoding="UTF-8"
10    />
11    <!-- =========================================================
12
13                       BEDEWORK RSS FEED
14
15      RSS for the Bedework events calendar.
16
17      Call the feed with the listEvents action to return
18      the discrete events in the next seven days (seven days is default):
19      http://localhost:8080/cal/main/listEvents.do?setappvar=summaryMode(details)&skinName=rss-list
20
21      _________________________________________________________
22      Optional parameters that may be added to the query string:
23
24      days=n    return n days from today into the future.
25                Example: http://localhost:8080/cal/main/listEvents.do?setappvar=summaryMode(details)&skinName=rss-list&days=5
26
27
28      Note: rss.xsl is an older file used to pull a list of events from the
29      day, week, or month views.  It is maintained for backwards
30      compatibility.
31
32      ===============================================================  -->
33 <!-- **********************************************************************
34     Copyright 2008 Rensselaer Polytechnic Institute. All worldwide rights reserved.
35
36     Redistribution and use of this distribution in source and binary forms,
37     with or without modification, are permitted provided that:
38        The above copyright notice and this permission notice appear in all
39         copies and supporting documentation;
40
41         The name, identifiers, and trademarks of Rensselaer Polytechnic
42         Institute are not used in advertising or publicity without the
43         express prior written permission of Rensselaer Polytechnic Institute;
44
45     DISCLAIMER: The software is distributed" AS IS" without any express or
46     implied warranty, including but not limited to, any implied warranties
47     of merchantability or fitness for a particular purpose or any warrant)'
48     of non-infringement of any current or pending patent rights. The authors
49     of the software make no representations about the suitability of this
50     software for any particular purpose. The entire risk as to the quality
51     and performance of the software is with the user. Should the software
52     prove defective, the user assumes the cost of all necessary servicing,
53     repair or correction. In particular, neither Rensselaer Polytechnic
54     Institute, nor the authors of the software are liable for any indirect,
55     special, consequential, or incidental damages related to the software,
56     to the maximum extent the law permits. -->
57
58    <xsl:template match="/">
59      <rss version="2.0">
60       <channel>
61         <title>Bedework Events Calendar</title>
62         <link><xsl:value-of select="/bedework/urlprefix"/></link>
63         <description>
64           <xsl:choose>
65             <xsl:when test="/bedework/now/longdate = /bedework/events/event[position()=last()]/start/longdate"><xsl:value-of select="/bedework/now/longdate"/></xsl:when>
66             <xsl:otherwise><xsl:value-of select="/bedework/now/longdate"/> - <xsl:value-of select="/bedework/events/event[position()=last()]/start/longdate"/></xsl:otherwise>
67           </xsl:choose>
68         </description>
69         <pubDate><!-- takes the form: 11 Jan 2008 17:00:00 UT (note - do not output dayname - we only provide dayname in local time).
70           --><xsl:value-of select="substring(/bedework/now/utc,7,2)"/><xsl:text> </xsl:text><!--
71           --><xsl:call-template name="monthNumToName"><xsl:with-param name="monthNum" select="substring(/bedework/now/utc,5,2)"/></xsl:call-template><xsl:text> </xsl:text><!--
72           --><xsl:value-of select="substring(/bedework/now/utc,1,4)"/><xsl:text> </xsl:text><!--
73           --><xsl:value-of select="substring(/bedework/now/utc,10,2)"/>:<xsl:value-of select="substring(/bedework/now/utc,11,2)"/>:00 UT</pubDate>
74         <language>en-US</language>
75         <copyright>Copyright <xsl:value-of select="substring(/bedework/now/utc,1,4)"/>, Bedework</copyright>
76         <managingEditor>editor@mysite.edu, Editor Name</managingEditor>
77         <xsl:choose>
78            <xsl:when test="/bedework/page='searchResult'">
79              <xsl:apply-templates select="/bedework/searchResults/searchResult"/>
80            </xsl:when>
81            <xsl:otherwise>
82              <xsl:apply-templates select="/bedework/events/event"/>
83            </xsl:otherwise>
84         </xsl:choose>
85       </channel>
86     </rss>
87   </xsl:template>
88
89   <xsl:template match="event">
90     <item>
91       <title><xsl:if test="status = 'CANCELLED'">CANCELLED: </xsl:if><xsl:value-of select="summary"/> - <xsl:value-of select="substring(start/dayname,1,3)"/>, <xsl:value-of select="start/longdate"/></title>
92       <link><xsl:value-of select="/bedework/urlprefix"/>/event/eventView.do?subid=<xsl:value-of select="subscription/id"/>&amp;calPath=<xsl:value-of select="calendar/encodedPath"/>&amp;guid=<xsl:value-of select="guid"/>&amp;recurrenceId=<xsl:value-of select="recurrenceId"/></link>
93       <pubDate><!-- takes the form: 11 Jan 2008 17:00:00 UT (note - do not output dayname - we only provide dayname in local time).
94         --><xsl:value-of select="substring(start/utcdate,7,2)"/><xsl:text> </xsl:text><!--
95         --><xsl:call-template name="monthNumToName"><xsl:with-param name="monthNum" select="substring(start/utcdate,5,2)"/></xsl:call-template><xsl:text> </xsl:text><!--
96         --><xsl:value-of select="substring(start/utcdate,1,4)"/><xsl:text> </xsl:text><!--
97         --><xsl:value-of select="substring(start/utcdate,10,2)"/>:<xsl:value-of select="substring(start/utcdate,11,2)"/>:00 UT</pubDate>
98       <description><!--
99         --><xsl:value-of select="substring(start/dayname,1,3)"/>,<xsl:text> </xsl:text><!--
100         --><xsl:value-of select="start/longdate"/><!--
101         --><xsl:text> </xsl:text><!--
102         --><xsl:value-of select="start/time"/><!--
103         --><xsl:if test="end/time != ''"> - </xsl:if><!--
104         --><xsl:if test="end/dayname != start/dayname"><xsl:value-of select="substring(end/dayname,1,3)"/>, </xsl:if><!--
105         --><xsl:if test="end/longdate != start/longdate"><xsl:value-of select="end/longdate"/>, </xsl:if><!--
106         --><xsl:if test="end/time != ''"><xsl:value-of select="end/time"/></xsl:if><!--
107         --><xsl:text> </xsl:text><!--
108         --><xsl:value-of select="location/address"/>.<!--
109         --><xsl:text> </xsl:text><!--
110         --><xsl:if test="cost!=''"><xsl:value-of select="cost"/>.</xsl:if><!--
111         --><xsl:text> </xsl:text><!--
112         --><xsl:value-of select="description"/><!--
113         --><xsl:text> </xsl:text><xsl:if test="status = 'CANCELLED'">(CANCELLED)</xsl:if><!--
114       --></description>
115     </item>
116   </xsl:template>
117
118   <!-- convert 2-digit utc month numeric values to
119        short month names as expected by RFC 822 -->
120   <xsl:template name="monthNumToName">
121     <xsl:param name="monthNum">00</xsl:param>
122     <xsl:choose>
123       <xsl:when test="$monthNum = '01'">Jan</xsl:when>
124       <xsl:when test="$monthNum = '02'">Feb</xsl:when>
125       <xsl:when test="$monthNum = '03'">Mar</xsl:when>
126       <xsl:when test="$monthNum = '04'">Apr</xsl:when>
127       <xsl:when test="$monthNum = '05'">May</xsl:when>
128       <xsl:when test="$monthNum = '06'">Jun</xsl:when>
129       <xsl:when test="$monthNum = '07'">Jul</xsl:when>
130       <xsl:when test="$monthNum = '08'">Aug</xsl:when>
131       <xsl:when test="$monthNum = '09'">Sep</xsl:when>
132       <xsl:when test="$monthNum = '10'">Oct</xsl:when>
133       <xsl:when test="$monthNum = '11'">Nov</xsl:when>
134       <xsl:when test="$monthNum = '12'">Dec</xsl:when>
135       <xsl:otherwise>badMonthNum</xsl:otherwise>
136     </xsl:choose>
137   </xsl:template>
138 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.