You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Trapo <ne...@trapo.it> on 2004/03/11 10:27:13 UTC

Aggregating rss feed

Hi list,
there's a way to aggregate rss feed from multiple sources in a page of a 
publication? I would like to make a special page with news from other 
sites that are related to my publication..

TYIA

giampaolo/trapo


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Aggregating rss feed

Posted by Justus Brugman <br...@kpmg-ct.com>.
On Thu, 2004-03-11 at 11:22, Christian Egli wrote:
> After that is taken care of you will have to adapt your stylesheets to
> make sure that the rss elements are properly displayed.
> 
> Hope that helps.

Thanks, i'll try this.
Justus


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Aggregating rss feed

Posted by Trapo <ne...@trapo.it>.
Trapo wrote:

> I have tried your pipeline using the stylesheet below...when i use it 
> in a standard c2 pipeline is all ok but when i move to lenya i get 
> always a blank page. It's a namespace problem?
>
I solved, was a simple problem that i report for future newbie reference:
the stylesheet should start with <div id=body> tag and not with <html>

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Aggregating rss feed

Posted by Trapo <ne...@trapo.it>.
I have tried your pipeline using the stylesheet below...when i use it in 
a standard c2 pipeline is all ok but when i move to lenya i get always a 
blank page. It's a namespace problem?

giampaolo/trapo


<?xml version="1.0"?>



<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
    exclude-result-prefixes="page xhtml"
    >




 <xsl:template match="/mynews">
   <html>
   <head>
    <title>RSS Aggregation Sample</title>
    </head>
    <body>
      <xsl:apply-templates />
   </body>
   </html>
  </xsl:template>
 
<xsl:template match="rss">
  <xsl:apply-templates select="channel"/>
</xsl:template>

<xsl:template match="channel">
  <xsl:if test="title">
    <b><a href="{link}"><xsl:value-of select="title"/></a></b>
    <br/>
  </xsl:if>
  <xsl:if test="description">
    (<xsl:value-of select="description"/>)
  </xsl:if>
  <table>
    <xsl:apply-templates select="item"/>
  </table>
</xsl:template>

<xsl:template match="item">
    <tr>
      <td>
        <a target="_blank" href="{link}">
            <b><xsl:value-of select="title"/></b>
        </a>
        <xsl:apply-templates select="description"/>
      </td>
    </tr>
    <tr><td height="5"></td></tr>
</xsl:template>

<xsl:template match="description">
    <br/>
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="node()|@*" priority="-1">
  <xsl:copy>
    <xsl:apply-templates select="@*"/>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Aggregating rss feed

Posted by Christian Egli <ch...@wyona.net>.
Justus Brugman <br...@kpmg-ct.com> writes:

> On Thu, 2004-03-11 at 10:27, Trapo wrote:
> > Hi list,
> > there's a way to aggregate rss feed from multiple sources in a page of a 
> > publication? I would like to make a special page with news from other 
> > sites that are related to my publication..

I have done this in a publication that is derived from the default
publication. You basically add the following pipeline to the doctypes
sitemap:

      <!-- RSS Matcher -->
      <map:match pattern="rss/**.xml">
	<map:generate src="http://{1}.xml"/>
	<map:serialize type="xml"/>
      </map:match>

In my case I have a doctype "homepage" for the front page which is
matched by the following pipeline. In there you'll see how the rss is
aggregated with the content of the page.

      <!-- homepage doctype matcher -->
      <!-- pattern="{rendertype}/{area}/homepage/{document-path}" -->
      <map:match pattern="*/*/homepage/**.xml">
        <map:aggregate element="homepage-aggregate">
          <map:part src="content/{2}/{3}.xml"/>
	  <!-- rss fetching -->
          <map:part src="cocoon:/rss/www.medienspiegel.ch/index.xml"/>
        </map:aggregate>
        <map:transform src="xslt/homepage2xhtml.xsl">
          <map:parameter name="rendertype" value="{1}"/>
          <map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
        </map:transform>
        <map:serialize type="xml"/>
      </map:match>

After that is taken care of you will have to adapt your stylesheets to
make sure that the rss elements are properly displayed.

Hope that helps.

-- 
Christian Egli       christian.egli@wyona.net   +41 1 272 9161
                     Wyona AG, Hardstrasse 219, CH-8005 Zurich
Open Source CMS      http://www.wyona.org http://www.wyona.com 


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org


Re: Aggregating rss feed

Posted by Justus Brugman <br...@kpmg-ct.com>.
On Thu, 2004-03-11 at 10:27, Trapo wrote:
> Hi list,
> there's a way to aggregate rss feed from multiple sources in a page of a 
> publication? I would like to make a special page with news from other 
> sites that are related to my publication..
> 
> TYIA
> 
> giampaolo/trapo

I haven't seen a way (yet?) I'm surely interested too, this is a great
feature for any CMS (if it's there)
Justus


---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org