Re: Special characters in xsl

Subject: Re: Special characters in xsl
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 9 May 2000 18:50:57 +0100 (BST)
> My problem is the next. I have a xml file like:

But why is it like that?


is exactly the same input as


   <content><![CDATA[<form method="post" action=""><font ....

is exactly the same input as

   <content>&lt;form method="post" action=""&gt;&lt;font ....

You say:
> When I execute the instruction: <xsl:value-of select="content"> in my
> xsl file, which is a variable field, the character < is substituted by
> &lt;

but that doesn't really describe the situation: You quoted the input
with CDATA and that is completely equivalent to quoting each individual
< as &lt;. So your xsl:value-of is just showing you the input.

> What can I do?
If the HTML fragments in your input are well formed (which seems to be
the case in your example) then remove all the CDATA markup and use
<xsl:copy-of select="content"/>  instead of value-of.

If the HTML fragments are not well formed then you are in a much worse
situation, you could try adding disable-output-encoding="yes" to your
xsl:value of, but searching the archives of this list will show why that
does not always work and is always a very fragile hack.


 XSL-List info and archive:

Current Thread