[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Make RSS output?


Subject: [xsl] Make RSS output?
From: Smoother@xxxxxx
Date: Mon, 31 Jul 2006 14:39:08 +0200

Hi,

today I have tried to output rss with xsl. I'm using libxslt (which is used by php5) to do so, but I always get well-formatted html.

My stylesheet:
=====================================================

<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:rss="http://purl.org/rss/1.0/"
                xmlns:dc="http://purl.org/dc/elements/1.1/"
                xmlns:content="http://purl.org/rss/1.0/modules/content/" version="1.0">
    
    <xsl:output method="text" doctype-public="-//Netscape Communications//DTD RSS 0.91//EN"
                doctype-system="http://my.netscape.com/publish/formats/rss-0.91.dtd" encoding="utf-8" /> 
    
    <xsl:template match="/">
        
        <rss version="0.91">
            <channel>
                <title>...</title>
                <link>...</link>
                <description>...</description>
                <language>en-us</language>
                
                <copyright>...</copyright>
                
                <item>
                    <title>...</title>
                    <description>...</description>
                    <link>...</link>
                </item>
            </channel>
        </rss>
        
    </xsl:template>
    
</xsl:stylesheet>


Output:
=====================================================

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
  </head>
  <body>
    .........en-us............
  </body>
</html>


It should be something like this:
=====================================================

<?xml version="1.0" encoding="ISO-8859-1" ?>
	<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> 	
	<rss version="0.91">
	<channel>
		<title>...</title>
		<link>...</link>
		<description>...</description>
		<language>en-us</language>

		<copyright>...</copyright>
	
			<item>

				<title>...</title>
				<description>...</description>
				<link>...</link>
			</item>
	
	</channel>
	</rss>
	

As I said, I'm using php5 with xsltProcessor and DomDocument, the same way as it is used in the example found at http://de2.php.net/manual/en/function.xsl-xsltprocessor-construct.php


What is necessary to get there? Can someone please give an example? Google returns only tuotrials on how to access rss with xsl.

Thanks, S. Renault.
-- 


Echte DSL-Flatrate dauerhaft f|r 0,- Euro*. Nur noch kurze Zeit!
"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl


Current Thread
Keywords