Subject: [xsl] Display RSS by category (Muenchian Method) From: Brent Wilcox <cwilly00@xxxxxxxxx> Date: Fri, 23 Nov 2007 10:05:44 -0800 (PST) |
Hi, I am trying to display my RSS feed on a page grouped by category, however, I am getting this error: The stylesheet does not contain a document element. Here is my XSL (using Jeni's Muenchian Method example): <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:common="http://exslt.org/common" version="1.0"> <xsl:output method="html" /> <xsl:key name="items-by-category" match="item" use="category" /> <xsl:template match="channel"> <xsl:for-each select="item[count(. | key('items-by-category', category)[1]) = 1]"> <xsl:sort select="category" /> <xsl:value-of select="category" />,<br /> <xsl:for-each select="key('items-by-category', category)"> <xsl:sort select="title" /> <xsl:value-of select="title" /> (<xsl:value-of select="title" />)<br /> </xsl:for-each> </xsl:for-each> </xsl:template> Here is my XML: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>Tips</title> <pubDate>Fri, 23 Nov 2007 11:35:27 -0500</pubDate> <item> <title>Winter driving</title> <description>Winter travel</description> <link>http://www.mysite.ca/tip/tips/tp200711_e.asp</link> <category domain="">Winter</category> <guid isPermaLink="false">030629A4-4A82-4E2C-B4D3-7147800B78B7</guid> <pubDate>Sun, 1 Oct 2006 11:17:19 -0500</pubDate> </item> <item> <title>Winter storm</title> <description>Hail, blizzards</description> <link>http://www.mysite.ca/tip/tips/tp200711_e.asp</link> <category domain="">Winter</category> <guid isPermaLink="false">9FCCDD38-D8ED-4FAB-9CCA-E4D5E84B09AE</guid> <pubDate>Fri, 1 Dec 2006 11:16:47 -0500</pubDate> </item> </channel> </rss> Any thoughts would be much appreciated. Thank you. Brent Wilcox ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Follow path in source-xml, Mukul Gandhi | Thread | Re: [xsl] Display RSS by category (, Mukul Gandhi |
Re: [xsl] Follow path in source-xml, Mukul Gandhi | Date | [xsl] HTML inside XML using XSLT, Lucas Gonçalves Gros |
Month |