Transforming XML/XSLT : CDATA problem
843834Apr 30 2002 — edited Jul 7 2003Hi!
I have a problem transforming xml with XSLT using the API javax.xml.
The result is correct until I have a CDATA section in my xml document.
The transforming process encodes all the & < > (special characters) it finds in.
This occurs problem for the follow of my treatement because the content of my CDATA is already encoded.
For example, this xml code :
<?xml version='1.0' encoding="ISO-8859-1" ?>
<article>
<article-contenu><![CDATA[Accent : é Signe : <]]></article-contenu>
</article>
produces in my output :
Accent : &eacute; Signe : &lt;
This is my java code :
TransformerFactory tFactory = TransformerFactory.newInstance();
Source xmlSource = new StreamSource(readerXml);
Source xslSource = new StreamSource( fileXsl );
// Generate the transformer.
Transformer transformer = tFactory.newTransformer(xslSource);
// Perform the transformation, sending the output to the response.
transformer.transform(xmlSource, new javax.xml.transform.stream.StreamResult(sw));
How can I tell the transformer not to do that?
Thanks for your answers!