0

我正在开发一个 Windows 控制台应用程序,它读取 XML RSS 提要并通过 XSLT 文件对其进行翻译。其中一个 RSS 节点内容是 HMTL 编码的,下面是一个示例:

<description>&lt;b&gt;When:&lt;/b&gt; Monday, November 05, 2012 - 10:00 AM&lt;br&gt;&lt;b&gt;Where:&lt;/b&gt; Red Mountain Branch&lt;br&gt;&lt;br&gt;Where: The Roadrunner Room&lt;br /&gt;&lt;br /&gt;Our Job Lab is open to help you with:&lt;br /&gt;&lt;br /&gt;&#149; Job searching&lt;br /&gt;&#149; Creating resumes and cover letters&lt;br /&gt;&#149; Completing online job applications&lt;br /&gt;&#149; Providing interview tips&lt;br /&gt;&#149; Exploring your career interests&lt;br /&gt;&#149; Improving computer skills&lt;br /&gt;&#149; Increasing workplace skills and marketability.&lt;br /&gt;&#149; Marketing through Social Media&lt;br /&gt;&#149; GETTING HIRED!&lt;br /&gt;&lt;br /&gt;Need more information:&lt;br /&gt;&lt;br /&gt;Email: MesaLibJHH@gmail.com&lt;br /&gt;Twitter: @MesaLibJHH&lt;br /&gt;Facebook: www.facebook.com/MesaLibraryJobHelpHub&lt;br /&gt;&lt;br /&gt;</description>

这是我用来翻译文件的 XSLT 文件:

<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <xsl:output method="html" indent="yes" encoding="ISO-8859-1" />
  <xsl:strip-space elements="category" />
  <xsl:template match="/">
      <xsl:for-each select="rss">
          <xsl:for-each select="channel">
              <rssItems>
                  <xsl:for-each select="item">
                      <item>
                          <title>
                              <xsl:value-of select="title"/>
                          </title>
                          <description>
                              <xsl:value-of select="description"/>
                          </description>
                          <category>
                              <xsl:for-each select="category">
                                  <xsl:value-of select="text()"/>,
                              </xsl:for-each>
                          </category>
                          <link>
                              <xsl:value-of select="link"/>
                          </link>
                          <guid>
                              <xsl:value-of select="guid"/>
                          </guid>
                      </item>
                  </xsl:for-each>
              </rssItems>
          </xsl:for-each>
      </xsl:for-each>
  </xsl:template>
</xsl:transform>

<xsl:value-of select="description" />在处理 RSS 提要时,我需要对保留 HTML 编码进行哪些修改?

4

0 回答 0