Altova Mailing List Archives

Re: [xsl] Merging multiple RSS feeds into one RSS feed

From: Nic <nferrier@-------------------->
Date: 4/18/2006 7:44:00 PM
Robert Fidler <robert.fidler@xxxxxxxxxx> writes:

> Does any one know how I can merge multiple RSS feeds into one feed? I 
> have this code, but when I view the feed.xml in IE, it does not have any 
> of the XML formating in it, just plain text output all strong out. And 
> RSSOwl does not even read it.
> feed.xml:
> <?xml version="1.0"?>
> <?xml-stylesheet type="text/xsl" href="merge-rss.xsl"?>
> <feeds>
>     <link href=""/>
>     <link href=""/>
> </feeds>
> merge-rss.xsl:
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="">
>     <xsl:output  method="xml" version="1.0" encoding="UTF-8" 
> indent="yes" omit-xml-declaration="no" media-type="text/xml" />
>     <xsl:template match="/">
>         <rss version="2.0">
>             <channel>
>                 <title>My Title</title>
>                 <description>My Description</description>
>                 <language>en-us</language>
>                 <link>http://mysite/rss</link>
>                 <xsl:for-each select="feeds/link/@href">
>                     <xsl:copy-of select="document(.)/rss/channel/item"/>
>                 </xsl:for-each>
>             </channel>
>         </rss>
>     </xsl:template>
> </xsl:stylesheet>

Something like:

  <xsl:for-each select="feeds/link">
    <xsl:variable name="source" select="document(@href)"/>
    <xsl:copy-of select="$source//item"/>

Works for me.

Note that this is essentially what
does. This is my RSS/ATOM aggregator. It's simple but not as simple as
a single sylesheet; you can see it at:

you do have to register for it first.

Nic Ferrier


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.