呈现RSS页面时出错

时间:2015-08-16 18:38:22

标签: xml rss

我正在尝试为网站呈现RSS页面。 RSS它本身工作正常,它也经过验证。它是由我制作的PHP脚本构建的。

然而,当我实现CSS和XSL,并且我调用页面时,我得到的是这条消息:

compile 'com.google.android.gms:play-services-appstate:7.8.0'

但是第4行根本不是空的,也不是文档的其余部分。

请在这里有XSL文件:

This page contains the following errors:

error on line 4 at column 1: Document is empty
Below is a rendering of the page up to the first error.

This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result.

这里的页面是“可见的”:

http://www.melanie-music.net/feed/?feed=rss2

您将收到上述错误,但如果您去检查源,则会找到代码

我能做些什么?

修改

删除XSL行并添加参数

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/feed">
    <html>
    <head>
        <link href="xsl.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            body {
                font-size:0.83em;
            }
        </style>
    </head>
    <body>
        <div id="logo">
            <xsl:element name="a">
                <xsl:attribute name="href">
                    <xsl:value-of select="channel/link" />
                </xsl:attribute>
                <xsl:value-of select="channel/title" />
            </xsl:element>
        </div>
        <div class="Snippet" style="border-width:0; background-color:#FFF; margin:1em">
            <div class="titleWithLine">
                <xsl:value-of select="channel/description" />
            </div>
            <dl style="padding-right:1em">
                <xsl:for-each select="channel/item">
                    <dd>
                        <xsl:element name="a">
                            <xsl:attribute name="href">
                                <xsl:value-of select="link"/>
                            </xsl:attribute>
                            <xsl:value-of select="title"/>
                        </xsl:element>
                    </dd>
                    <dt>
                        <xsl:value-of select="description" /><br />
                        <span class="comments"><xsl:value-of select="pubDate" /></span>
                    </dt>
                </xsl:for-each>
            </dl>
        </div>
        <div id="footer">
            <xsl:value-of select="channel/copyright" />
        </div>
    </body>
    </html>
</xsl:template>
</xsl:stylesheet>

到RSS标签,至少我做了CSS 仍然没有正确解释所有CDATA

1 个答案:

答案 0 :(得分:0)

好的,如果有人拥有我所拥有的,那么将属性移除到<rss>标签的方法是不错的选择

对于CDATA,我提出了这个话题: Styling RSS feed using XSLT issues with CDATA tags

这很棒,但你需要对它进行一些工作,以使其以可接受的方式工作并添加

<xsl:output method="html" doctype-system="about:legacy-compat" encoding="UTF-8" indent="yes" />

拥有HTML5(让我们说)