Smoother@xxxxxx writes:
> 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>
>
<snip/>
> 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
Your XSLT looks ok apart from:
> <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" />
should be:
> <xsl:output method="xml" doctype-public="-//Netscape Communications//DTD RSS 0.91//EN"
> doctype-system="http://my.netscape.com/publish/formats/rss-0.91.dtd"
> encoding="utf-8" />
If that doesn't work it suggests this is a PHP problem.
If you want an answer it would be better to ask the PHP people, but I
daresay if you post your PHP code here someone (maybe me!) will answer
your question.
> What is necessary to get there? Can someone please give an example?
> Google returns only tuotrials on how to access rss with xsl.
I generate RSS from XSLT all the time. Not necessarily with PHP
though...
--
Nic Ferrier
http://www.tapsellferrier.co.uk for all your tapsell ferrier needs
|