RSS Feed Block not displaying results of XSLT transform

zcummings's Avatar

zcummings

13 Nov, 2014 09:02 PM

Hello.

I am getting an xml feed from a calendar here on campus that I am having awesomely bad problems with, specifically with the namespace.

Here is the xml feed: http://calendar.tamu.edu/?calendar_id=81&upcoming&format=xml&limit=8

The XSLT I've been trying is this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ev="urn:cde.berkeley.edu:babl:events:1.00">
<xsl:template match="/">
<div>
<h2>Upcoming Events</h2>
<xsl:for-each select="system-xml/ev:Events/ev:Event">
<aside class="upcoming-events">
<div class="event">
<div class="date"><xsl:value-of select="ev:DateTime/ev:StartDate" />
</div>
<h4>
<a><xsl:value-of select="ev:EventTitle" />
</a>
</h4>
<div class="location">
<p><xsl:value-of select="ev:Locations/ev:Location/ev:LocationName" />
</p>
</div>
<div class="time"><xsl:value-of select="ev:DateTime/ev:StartTime" />
</div>
</div>
</aside>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>

Which generates this:

<?xml version="1.0"?>
<div xmlns:ev="urn:cde.berkeley.edu:babl:events:1.00"><h2>Upcoming Events</h2><aside class="upcoming-events"><div class="event"><div class="date">2014-11-14</div><h4><a>
                Emerging Technologies and the Design Impact on Special Care Units
            </a></h4><div class="location"><p>Langford Architecture Center - Building C (ARCC)</p></div><div class="time">11:30:00</div></div></aside><aside class="upcoming-events"><div class="event"><div class="date">2014-11-17</div><h4><a>
                Architecture Lecture by David Allin
            </a></h4><div class="location"><p>Langford Architecture Center - Building B (ARCB)</p></div><div class="time">17:45:00</div></div></aside><aside class="upcoming-events"><div class="event"><div class="date">2014-11-19</div><h4><a>
                What Planners Do Lecture Series
            </a></h4><div class="location"><p>Langford Architecture Center - Building B (ARCB)</p></div><div class="time">12:45:00</div></div></aside><aside class="upcoming-events"><div class="event"><div class="date">2014-11-21</div><h4><a>
                Future Technology and Health Care
            </a></h4><div class="location"><p>Langford Architecture Center - Building C (ARCC)</p></div><div class="time">11:30:00</div></div></aside><aside class="upcoming-events"><div class="event"><div class="date">2014-12-03</div><h4><a>
                What Planners Do Lecture Series
            </a></h4><div class="location"><p>Langford Architecture Center - Building B (ARCB)</p></div><div class="time">12:45:00</div></div></aside><aside class="upcoming-events"><div class="event"><div class="date">2015-10-06</div><h4><a>
                Architecture Lecture by LoJo Principals
            </a></h4><div class="location"><p>Langford Architecture Center - Building B (ARCB)</p></div><div class="time">17:45:00</div></div></aside></div>

However, nothing displays other than the words "Upcoming Events" ... and I'm stumped.

Any help would be appreciated.

  1. 1 Posted by zcummings on 13 Nov, 2014 09:19 PM

    zcummings's Avatar

    Apologies for the lack of code brackets.

  2. 2 Posted by Ryan Griffith on 14 Nov, 2014 02:22 PM

    Ryan Griffith's Avatar

    Hi Zach,

    It looks like you are on the right track. After some local testing, the following XSLT seemed to do the trick for me. When you have a moment, give it a try and let me know how it works out for you.

    <xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        version="1.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ev="urn:cde.berkeley.edu:babl:events:1.00"
        exclude-result-prefixes="xsi ev">
        <xsl:template match="/">
            <div>
                <h2>Upcoming Events</h2>
                <xsl:apply-templates select="//ev:Event"/>
            </div>
        </xsl:template>
        <xsl:template match="ev:Event">
            <aside class="upcoming-events">
                <div class="event">
                    <div class="date">
                        <xsl:value-of select="ev:DateTime/ev:StartDate"/>
                    </div>
                    <h4>
                        <a><xsl:value-of select="ev:EventTitle"/></a>
                    </h4>
                    <div class="location">
                        <xsl:apply-templates select="ev:Locations/ev:Location"/>
                    </div>
                    <div class="time">
                        <xsl:value-of select="ev:DateTime/ev:StartTime"/>
                    </div>
                </div>
            </aside>
        </xsl:template>
        <xsl:template match="ev:Location">
            <p><xsl:value-of select="ev:LocationName"/></p>
        </xsl:template>
    </xsl:stylesheet>
    

    Please let me know if you have any questions.

    Thanks!

  3. Ryan Griffith closed this discussion on 03 Dec, 2014 02:51 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM