Insert HTML Page into XML CDATA Tag
843840Jun 14 2009 — edited Jun 14 2009Hi Guy
I have a very big problem.
I create a little web site and I use XSL + XML to produce output.Now I
want to add a part of html page into xml tag to use a custom page section.
But i find a problme,
see the example :
I use this xml :
<resources>
<html><![CDATA[<B>Hello World</B>]]></html>
</resources>
trasform xml with xsl page
and my output into html browser is (<);B(>);Hello World(<);/B(>);(please remove the bracket( ) while reading the text to understand my problem)
my BOLD html tag is not parse by browser because xslt parser trasform
my special tag into other tag.
I want output like this:
<b>Hello World</b>
But it's coming like (<);B(>);Hello World(<);/B(>); (please remove the bracket( ) while reading the text to understand my problem)
Can you help me ?
this is my trasformation function :
private Transformer getXSLTransformer (xslFile) throws
XSLTransformerConfigurationException {
try {
Transformer transformer = null;
tFactory = TransformerFactory.newInstance();
transformer = tFactory.newTransformer(new
StreamSource(xslFile)); // load xslFile from disk
} catch (TransformerConfigurationException tce) {
throw new XSLTransformerConfigurationException(tce.getMessage());
}
return transformer;
}
public String myTrasform(String xml,String xslFile) throws Exception {
StringWriter outputString = new StringWriter(512);
Transformer transformer = getXSLTransformer (xslFile);
transformer.transform(new StreamSource(new StringReader(xml)), new
StreamResult(outputString));
return outputString.toString();
}
Thank's in advance.
kuruvi
Edited by: Mc_Kuruvi on Jun 14, 2009 3:47 AM