我正在开发一个 Windows 控制台应用程序,它读取 XML RSS 提要并通过 XSLT 文件对其进行翻译。其中一个 RSS 节点内容是 HMTL 编码的,下面是一个示例:
<description><b>When:</b> Monday, November 05, 2012 - 10:00 AM<br><b>Where:</b> Red Mountain Branch<br><br>Where: The Roadrunner Room<br /><br />Our Job Lab is open to help you with:<br /><br />• Job searching<br />• Creating resumes and cover letters<br />• Completing online job applications<br />• Providing interview tips<br />• Exploring your career interests<br />• Improving computer skills<br />• Increasing workplace skills and marketability.<br />• Marketing through Social Media<br />• GETTING HIRED!<br /><br />Need more information:<br /><br />Email: MesaLibJHH@gmail.com<br />Twitter: @MesaLibJHH<br />Facebook: www.facebook.com/MesaLibraryJobHelpHub<br /><br /></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 编码进行哪些修改?