Re: [xsl] Problem with < and > in front and after CDATA section

Subject: Re: [xsl] Problem with < and > in front and after CDATA section
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Sat, 06 Dec 2008 17:42:12 +0100
jo lemen wrote:
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>&lt;![CDATA[ text ]]&gt;</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 &lt; and &gt; 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.

Well assuming your stylesheet is only processing XML documents where the description element looks like below


<description>&lt;![CDATA[description text]]&gt;</description>

then you could use
<xsl:value-of select="substring-before(substring-after(description, '[CDATA['), ']]')"/>




--

	Martin Honnen
	http://JavaScript.FAQTs.com/

Current Thread