This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Encoded characters and CDATA
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] Encoded characters and CDATA
- From: "Thomas B. Passin" <tpassin at mitretek dot org>
- Date: Tue, 3 Jul 2001 11:01:38 -0400
- References: <3B41D0F7.FA43062@mail.nlm.nih.gov>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Everyone else has covered this, but I'll pull it together. You havethe 0D0A
characters in the result because they are included in the data:
<image_url>
<![CDATA[sample.htm ]]>
</image_url>
There is a newline before and after the CDATA part (you don't need the
CDATA, as has been said). So your solution
<image_url><![CDATA[sample.htm ]]></image_url>
would take care of it in the source data. normalize-space() will remove the
extra whitespace if there is any in the source. So you can handle it in the
data, in the stylesheet, or both. The CDATA does nothing for you.
Of course, if your filename could have two consecutive spaces, (like
sam ple.htm
you don't want to use normalize-space() because it would give you one space,
not two. That's probably very unlikely.
Cheers,
Tom P
[YueMa]
> Hi there,
> For CDATA like this:
> <image_url>
> <![CDATA[sample.htm ]]>
> </image_url>
>
> Note I do have a space after the "sample.htm" and the CDATA tag does
> start at a new line,
> and for the <xsl:value-of select="//image_url"/> I got result string
> like:
> %0D%0A%09%09%09sample.htm%20%0D%0A%09%09
>
> So if I want to avoid all the encoded characters, I have to have my
> CDATA like:
> <image_url><![CDATA[sample.htm ]]></image_url>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list