by Phil 'iwonder' Guerra
- (Mission, KS) - Here's a bit of something I ran across while looking into a question about DNN and whether or not it supports podcasts. First, out of the box, DNN will support podcast with only the XML/XSL module, and you'll need a custom xsl to do it.
Secondly, the presentation and results vary by browser. I created a custom xsl that enables presentation of the information in a newsfeed that point (links) to the actual podcast, which is usually an mp3 or video file of some sort. It's pretty straightforward transformation of the enclosure element, which contains a URL, type, and size. All 3 attributes are important as there are some issues with downloading that content for some browsers, at least that's the case when IE7 is used. Firefox did not have a problem, but I ran into issues when I used IE7. Why?
Well, it took some googling, but here's a link to the secret, IE7 has a 'limit' on the size it will allow to be downloaded. No file larger than 15MB on servers that do not support HTTP range requests. Since, I'm using a test environment built on Windows XP, and using IIS v5.0, I'm not sure if that's the real problem or not. I'll toss the custom XSL I created to test and show how I'm doing this for a particular site, DNN Creative DotNetNuke Podcasts and give me feedback. (I don't have a public DNN website, it's a matter of controlling my expenses, which is why I blog freely.)
Anyway, using FireFox, tells me that DNN will support presentation of news feeds that include podcasts, and that's the good news.
Here's an example XSL to use with the DNN XML/XSL module to present the DNNCreative Podcast newsfeed. Just a couple notes:
1) I'm not advocating adding the ability to include enclosures wholesale on a website. There are a number of security issues with doing so. I provide this example as quick 'how-to' not as a reccommended practice. Above all know your newssource and test on a non-production site to aovid issues.
2) This example was specifically built to transform the DNN Creative DotNetNuke Podcast feed. As such, you would have to modify it for any other use. Also, feeds change formats from time to time, so it may not always work. However, if you are seriously considering doing this type of thing, you'll need to be more than a novice with XML and XSL to get the most of this type of transformation.
3) To use this code, cut and paste it into a text file using a simple text editor. Save it as PodcastEnabled.xsl, and then upload it to you site during the setup conversation of a DNN XML/XSL module. I know the formatting of this code is less than desireable, but that's a function of my blogger app, so sorry. If you have a lot of problems with the xsl example, leave a comment and I'll go over it.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" >
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<!-- phil 'iwonder' guerra - PodcastEnabled.xsl - custom xsl for DnnCreative Podcasts -->
<xsl:template match="/">
<div>
<xsl:apply-templates select="rss/channel"/>
</div>
</xsl:template>
<xsl:template match="rss/channel">
<xsl:apply-templates select="item"/>
</xsl:template>
<xsl:template match="item">
<xsl:variable name="item_link" select="link"/>
<xsl:variable name="podlink" select="enclosure/@url"/>
<xsl:variable name="podmedia" select="enclosure/@type"/>
<xsl:variable name="altmedia" select="feedburner:origLink"/>
<xsl:variable name="item_title" select="description"/>
<div class="rssItemDescription">
<xsl:value-of select="description" disable-output-escaping="yes"/>
</div>
<div class="rssItemSub">
<xsl:if test="enclosure/@url">
<a href="{$podlink}">Listen Now</a> (<xsl:value-of select="$podmedia"/> - Size <xsl:value-of select="enclosure/@length"/>)<br></br>
</xsl:if>
<xsl:if test="not(enclosure/@url)">
<a href="{$altmedia}">See the Video</a>
</xsl:if>
(<xsl:value-of select="pubDate"/>) <hr/>
</div>
</xsl:template>
</xsl:stylesheet>
No comments:
Post a Comment