Removing CDATA stuff

wxdqz

New Member
Hello All,

I'm new to the forum...looks like a great resource!

I'm attempting, for the first time, to use weather data from the National Weather Service (NOAA) on a web page (asp.net/visual basic). The weather data is in the form of an RSS feed.

I had no problem grabbing the data and displaying it...so far so good. But the problem is this: the xml data contains a child node <description> that has the info I really need, but it also contains a small graphic that was inserted using CDATA - and I don't want that image to be displayed, just the text.

Here's a sample of the actual rss data:
<description>
- <![CDATA[ <img src=http://www.webdeveloper.com/forum/archive/index.php/"http://weather.gov/weather/images/fcicons/skc.jpg" class="noaaWeatherIcon" width="55" height="58" alt="Fair" style="float:left;" /><br />
]]>
Winds are West at 8 MPH. The pressure is 30.06" (1024.3 mb) and the humidity is 40%. The wind chill is 16. Last Updated on Jan 22, 9:53 am MST.
</description>

The XSL doc I'm using is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="rss/channel" />
</xsl:template>
<xsl:template match="channel">
<table width="200" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><p><xsl:value-of select="title" /></p>
</td>
</tr>
</table>
<xsl:apply-templates select="item" />
</xsl:template>
<xsl:template match="item">
<table width="200" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><p><xsl:value-of disable-output-escaping="yes" select="description" /></p>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>

Is there a way to strip out that CDATA stuff while leaving just the text to be displayed?

Thanx,
Don
 
Back
Top