2012-04-07 4 views
8

私はロードする場合は、このフィードhttp://code.google.com/feeds/p/v8/svnchanges/basicがTWebbrowserで、TWebBrowserコンポーネントにHTML形式でRSSフィードの出力を表示したい、これはRSSフィードの出力をTWebBrowserのHTML形式で表示する方法はありますか?

enter image description here

しかし、もしXMLファイルなどのコンテンツを表示します私はこの質問CSS and TWebbrowser delphiで提案されているが、私はまだ同じ結果を得ているとしてロードIHTMLDocument2にCSSを注入しようとした

enter image description here

同じページをロードするためにIEを使用しています。

質問は、私はTWebbrowserでRSSフィードを読み込むことはできますが、IEのようにHTMLドキュメントとして出力を表示することはできますか?

答えて

5

だけで推測していますが、(下のコメント欄でcherdtにより示唆されるようにhttp://snippets.dzone.com/posts/show/1162から採取され、変更された)次のXSLスタイルシートを適用してみてください:あなたが受けているフィードに

<xsl:stylesheet version="1.0" 
    xmlns:atom="http://www.w3.org/2005/Atom" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:dc="http://purl.org/dc/elements/1.1/"> 
    <xsl:output method="html"/> 
    <xsl:template match="/"> 
    <xsl:apply-templates select="/atom:feed/atom:head"/> 
     <xsl:apply-templates select="/atom:feed"/> 
    </xsl:template> 
    <xsl:template match="atom:feed/atom:head"> 
     <h3><xsl:value-of select="atom:title"/></h3> 
     <xsl:if test="atom:tagline"><p><xsl:value-of select="atom:tagline"/></p></xsl:if> 
     <xsl:if test="atom:subtitle"><p><xsl:value-of select="atom:subtitle"/></p></xsl:if> 
    </xsl:template> 
    <xsl:template match="/atom:feed"> 
     <h3><xsl:value-of select="atom:title"/></h3> 
     <xsl:if test="atom:tagline"><p><xsl:value-of select="atom:tagline"/></p></xsl:if> 
     <xsl:if test="atom:subtitle"><p><xsl:value-of select="atom:subtitle"/></p></xsl:if> 
     <ul> 
      <xsl:apply-templates select="atom:entry"/> 
     </ul> 
    </xsl:template> 
    <xsl:template match="atom:entry"> 
     <li> 
      <a href="{atom:link[@rel='related']/@href}" title="{substring(atom:published, 0, 11)}"><xsl:value-of select="atom:title"/></a> 
      <xsl:choose> 
       <xsl:when test="atom:content != ''"> 
        <p><xsl:value-of select="atom:content" disable-output-escaping="yes" /></p> 
       </xsl:when> 
       <xsl:otherwise> 
        <p><xsl:value-of select="atom:summary" disable-output-escaping="yes" /></p> 
       </xsl:otherwise> 
      </xsl:choose> 
     </li> 
    </xsl:template> 
</xsl:stylesheet> 

を。ドキュメントを変換するには、this question's selected answerを参照して、結果のXMLをWebブラウザーに割り当てることができます。

WebBrowserコントロールをフィードに向けていると推測していますが、この方法を使用すると、たとえばIndy(TIdHTTPとそのGet()メソッドをチェックしてください)を使用してフィードをダウンロードし、あなたのコントロールに表示されます。

上記はちょうど推測ですが、私はそれが良い前提だと考えています。 :)

2

IEは、RSSフィードXMLにデフォルトのスタイルシートとXSLトランスフォームを適用しています。これは、IEのことではなく、標準やそれ以外のものです。

表示する前にページを変更することで、自分自身で同様の操作を行う必要があります。

関連する問題