You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by st...@locus.apache.org on 2000/03/25 13:47:41 UTC
cvs commit: xml-cocoon/samples/rss fancy-rss-wml.xsl publishing-rss.xml rss-html.xsl simple-rss-wml.xsl
stefano 00/03/25 04:47:41
Modified: samples README index.xml
Added: samples/rss fancy-rss-wml.xsl publishing-rss.xml
rss-html.xsl simple-rss-wml.xsl
Log:
added RSS example
Revision Changes Path
1.4 +1 -0 xml-cocoon/samples/README
Index: README
===================================================================
RCS file: /home/cvs/xml-cocoon/samples/README,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- README 2000/01/09 23:44:17 1.3
+++ README 2000/03/25 12:47:40 1.4
@@ -18,6 +18,7 @@
- xsp ................... examples to show XML compiled server pages
- ldap .................. how to XML-ize your LDAP data
- vrml .................. how to use Cocoon to generate VRML
+ - rss ................... how to use RSS information in your site
- fromServlet ........... how to call Cocoon from another servlet
1.10 +8 -0 xml-cocoon/samples/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/xml-cocoon/samples/index.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- index.xml 2000/03/23 12:01:50 1.9
+++ index.xml 2000/03/25 12:47:40 1.10
@@ -30,6 +30,14 @@
</sample>
</group>
+ <group name="Cross-site information">
+ <sample name="RSS Example" url="rss/publishing-rss.xml">
+ This page shows the use of Netscape RSS format for site description. This
+ creates a simple way for one site to have headlines for news or items on
+ other sites.
+ </sample>
+ </group>
+
<group name="Dynamic content Generation">
<sample name="First XSP Page" url="xsp/page.xml?message=Hello%20World!">
This page shows the power of XSP technology with Java logic. In this page
1.1 xml-cocoon/samples/rss/fancy-rss-wml.xsl
Index: fancy-rss-wml.xsl
===================================================================
<?xml version="1.0"?>
<!-- Written by Vjekoslav Nesek -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="rss">
<xsl:apply-templates select="channel"/>
</xsl:template>
<xsl:template match="channel">
<xsl:processing-instruction name="cocoon-format">type="text/wml"</xsl:processing-instruction>
<wml>
<card id="news">
<xsl:attribute name="title"><xsl:value-of select="title"/></xsl:attribute>
<p align="center">
<small>
<xsl:value-of select="description"/>
</small>
</p>
<p>
<xsl:for-each select="item">
<xsl:call-template name="news-item"/> <br/>
</xsl:for-each>
</p>
<do label="About" type="accept">
<go href="#about"/>
</do>
</card>
<xsl:apply-templates select="item"/>
<card id="about" title="About">
<onevent type="ontimer">
<prev/>
</onevent>
<timer value="25"/>
<p align="center">
<br/>
<br/>
<small>
Copyright © 2000
<br/>
TIS d.o.o.
<br/>
All rights reserved.
</small>
</p>
</card>
</wml>
</xsl:template>
<xsl:template match="*" name="news-item">
<a>
<xsl:attribute name="href">#_<xsl:number/></xsl:attribute>
<xsl:value-of select="title"/>
</a>
</xsl:template>
<xsl:template match="item">
<card>
<xsl:attribute name="id">
_<xsl:number/>
</xsl:attribute>
<p>
<small>
<xsl:value-of select="description"/>
</small>
</p>
<do type="prev">
<prev/>
</do>
<do label="View URL" type="accept">
<go>
<xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>
</go>
</do>
</card>
</xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon/samples/rss/publishing-rss.xml
Index: publishing-rss.xml
===================================================================
<?xml version="1.0"?>
<?xml-stylesheet href="rss-html.xsl" type="text/xsl"?>
<?xml-stylesheet href="fancy-rss-wml.xsl" type="text/xsl" media="wap"?>
<?cocoon-process type="xslt"?>
<rss version="0.91">
<channel>
<title>About.com Publishing</title>
<link>http://publishing.about.com/</link>
<description>Keeping tabs on the book biz!</description>
<language>en-us</language>
<item>
<title>Amazon's Patents - The Problem and Resolution</title>
<link>http://publishing.about.com/arts/publishing/library/weekly/aa031000a.htm</link>
<description>Amazon's patent applications cause a public relations nightmare, and an opportunity for change.</description>
</item>
<item>
<title>Canadian Copyright Information</title>
<link>http://publishing.about.com/arts/publishing/msub11ca.htm</link>
</item>
<item>
<title>UK Copyright Information</title>
<link>http://publishing.about.com/arts/publishing/msub11uk.htm</link>
</item>
<item>
<title>Self-Syndication through RSS</title>
<link>http://publishing.about.com/library/blrss.htm</link>
<description>Your news, bestseller lists, and new release info could be the stuff portals are made of.</description>
</item>
<item>
<title>eMatter Not Rocketing</title>
<link>http://publishing.about.com/arts/publishing/library/weekly/aa022200a.htm</link>
<description>Why Fatbrain.com's epublishing program isn't living up to expectations. </description>
</item>
<item>
<title>Forum: Build a Better e-Bookstore</title>
<link>http://about.delphi.com/ab-publishing/messages/?msg=213.1&ctx=1</link>
<description>What is your vision for an ideal ebook bookstore?</description>
</item>
<item>
<title>Race Relations in Publishing</title>
<link>http://publishing.about.com/arts/publishing/library/issues/bli_minorities.htm</link>
<description>Ethnic minorities feel snubbed by the industry.</description>
</item>
<item>
<title>Barcodes for Books</title>
<link>http://publishing.about.com/arts/publishing/library/weekly/aa012500a.htm</link>
<description>Bookland EAN and UPC barcodes FAQ.</description>
</item>
<item>
<title>How to Get a Children's Book Published</title>
<link>http://publishing.about.com/arts/publishing/library/blhowto1.htm</link>
</item>
<item>
<title>Forum: Publish Your Poetry as eMatter</title>
<link>http://www.delphi.com/ab-publishing/messages/?msg=210.1&ctx=1</link>
</item>
<item>
<title>Forum: Prepublication Book Reviews</title>
<link>http://www.delphi.com/ab-publishing/messages/?msg=206.1&ctx=1</link>
</item>
<item>
<title>More Articles</title>
<link>http://publishing.about.com/arts/publishing/library/weekly/mpreviss.htm</link>
</item>
<item>
<title>Net Links</title>
<link>http://publishing.about.com/mlibrary.htm</link>
</item>
</channel>
</rss>
1.1 xml-cocoon/samples/rss/rss-html.xsl
Index: rss-html.xsl
===================================================================
<?xml version="1.0"?>
<!-- Written by Vjekoslav Nesek -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="rss">
<xsl:apply-templates select="channel"/>
</xsl:template>
<xsl:template match="channel">
<xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>
<html>
<head>
<title><xsl:value-of select="title"/></title>
<style type="text/css">
dd { margin-bottom: 20pix; }
</style>
</head>
<body bgcolor="white">
<h1><xsl:value-of select="title"/></h1>
<p><xsl:value-of select="description"/></p>
<dl>
<xsl:apply-templates select="item"/>
</dl>
</body>
</html>
</xsl:template>
<xsl:template match="item">
<dt>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</dt>
<dd><xsl:value-of select="description"/></dd>
</xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon/samples/rss/simple-rss-wml.xsl
Index: simple-rss-wml.xsl
===================================================================
<?xml version="1.0"?>
<!-- Written by Vjekoslav Nesek -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="rss">
<xsl:apply-templates select="channel"/>
</xsl:template>
<xsl:template match="channel">
<xsl:processing-instruction name="cocoon-format">type="text/wml"</xsl:processing-instruction>
<wml>
<card id="news">
<xsl:apply-templates select="item"/>
</card>
</wml>
</xsl:template>
<xsl:template match="item">
<p>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
<br/>
<xsl:value-of select="description"/>
</p>
</xsl:template>
</xsl:stylesheet>