2009-06-30 6 views
1

나는 우리 웹 사이트의 한 위치에 게시 될 XML 피드를 가지고 있으며 RSS 피드 용으로 재사용하고자합니다.XML을 RSS로 변환

웹 사이트의 몇 페이지가 동일한 XML을 참조하기 때문에 이러한 변환이 모두 설정되어 작동합니다. 나는 다음과 같은 설정 (feed.xml + rss.xsl)를 사용하여 RSS 피드에 XML을 변환하기 위해 노력하고있어

<POST> 
    <item> 
    <POST_ID>80000852</POST_ID> 
    <POST_TITLE>title</POST_TITLE> 
    <POST_CHANNEL>I</POST_CHANNEL> 
    <POST_DESC>description</POST_DESC> 
    <LINK>http://www...</LINK> 
    <STOC>N</STOC> 
    </item> 
</POST> 

:

기본 XML 파일 (XMLTEST.xml)

는이 구조를 사용하고 있습니다

feed.xml :

<?xml-stylesheet href="rss.xsl" type="text/xsl"?> 
<RSSChannels> 
    <RSSChannel src="XMLTEST.xml"/> 
</RSSChannels> 

rss.xsl :

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 

    <xsl:output method="xml" omit-xml-declaration="yes" /> 

    <xsl:template match="RSSChannels"> 
    <rss version="2.0"> 
     <channel> 
     <title>site title</title> 
     <link></link> 
     <description>Site description...</description> 
     <xsl:apply-templates /> 
     </channel> 
    </rss> 
    </xsl:template> 

    <xsl:template match="RSSChannel"> 
    <xsl:apply-templates select="document(@src)" /> 
    </xsl:template> 

    <xsl:template match="item"> 
    <xsl:choose> 
     <xsl:when test="STOC = 'Y'"></xsl:when> 
     <xsl:when test="POST_CHANNEL = 'I'"></xsl:when> 
     <xsl:otherwise> 
     <item> 
      <title> 
      <xsl:value-of select="*[local-name()='POST_TITLE']" /> 
      </title> 
      <link> 
      <xsl:value-of select="*[local-name()='LINK']" /> 
      </link> 
      <description> 
      <xsl:value-of select="*[local-name()='POST_DESC']" /> 
      </description> 
     </item> 
     </xsl:otherwise> 
    </xsl:choose> 
    </xsl:template> 

</xsl:stylesheet> 

Firefox에서 feed.xml의 출력을 보려고하면 모든 필터링이 올바르게 적용됩니다 (해당 채널에 게시해서는 안되는 항목을 정렬 함). 그러나 페이지는 일반적인 텍스트가 아닌 일반 텍스트로 출력됩니다 Firefox에서 발생하는 피드 감지. 내가 누락 된 것에 대한 아이디어가 있습니까?

제공해 주신 의견을 보내 주셔서 감사합니다.

답변