I'm having trouble parsing an RSS feed (version 2.0), over which I have no
control, server-side using using classic ASP and XSL (version 1)
Mu guess is that the problem lies in the following line of the RSS feed:
<description><![CDATA[ text ]]></description>
The result is that none of the content in between the description tag shows up
on screen. Below are the relevant pieces of code.
Is there a way in XSL 1.0 to fix the < and > in front of and after the
CDATA section? If it can only be done in XSLT 2.0, I would be glad to learn
how. Thanks in advance.
The RSS source file
<rss version="2.0">
<item>
<title>Title text</title>
<link>URL</link>
<description><![CDATA[description text]]></description>
<pubDate>pubDate</pubDate>
</item>
.. 3 other items
HTML I want
<p>
<strong>Title text</strong>
<br />
<em>( Date: pubDate )</em>
<br />
description text .. <a href="URL">.. details</a>
</p>
XSL code used:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:apply-templates select="/rss/channel/item"/>
</xsl:template>
<xsl:template match="/rss/channel/item">
<xsl:if test="position() < 2">
<p><strong><xsl:value-of select="title"/></strong>
<xsl:text disable-output-escaping="yes"><br /></xsl:text>
<em>( Date: <xsl:value-of select="substring(pubDate, 6, 11)" /> )</em>
<xsl:text disable-output-escaping="yes"><br /></xsl:text>
<xsl:value-of select="description" disable-output-escaping="yes" />
<xsl:text>.. </xsl:text>
<a><xsl:attribute name="href"><xsl:value-of select="link" /></xsl:attribute>
<xsl:attribute name="title">.. details</xsl:attribute>
<xsl:text>.. details</xsl:text>
</a></p>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Resulting HTML source code:
<p><strong>Title text</strong>
<br />
<em>( Date: pubDate )</em>
<br />
<![CDATA[description text]]>.. <a href="URL" title=".. details">..
details</a></p>
Resulting text on screen:
Title text
( Date: pubDate )
.. .. details
Title text
( Date: pubDate )
.. .. details
--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com
Powered by Outblaze
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--