Subject: How to disable escaping of '<' characters
From: Satish Patil <Satish.Patil@xxxxxxx>
Date: Sun, 11 Mar 2001 12:05:05 -0500
|
Hi
I want to disable the escaping of '<' ,'>' characters in XML.
Ex:
I create a dom tree
<PARENT>
<CHILD>
<font size = '2'>XML</font>
<CHILD>
<PARENT>
and apply xls sheet which prints the value CHILD element.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="PARENT">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="CHILD">
<html>
<xsl:value-of select="." />
</html>
</xsl:template>
</xsl:stylesheet>
The o/p I want is
<html>
<font size='2'>XML</font>
</html>
what I am getting is
<html>
<font size='2'>XML</font>
<html>
Is there a solution for this.
The java program which creates the DOM is
Document doc = new DocumentImpl();
Element parent = doc.createElement("PARENT");
Element child = doc.createElement("CHILD");
child.appendChild(doc.createCDATASection("<font
size='2'>XML</font>"));
//child.appendChild(doc.createTextNode("<font
size='2'>XML</font>"));
parent.appendChild(child);
doc.appendChild(parent);
DOMSource domSource = new DOMSource(doc);
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new
StreamSource("Temp.xsl"));
transformer.transform(domSource, new StreamResult(new
FileOutputStream("Temp.html")));
Thank you in advance.
Satish
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|