Results 1 to 1 of 1
- 03-28-2011, 09:01 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 1
- Rep Power
- 0
How to Avoid Nested Cdata Sections in a single node when transformation using XSL
Hi All,
I have a simple xml and iam trying to apply the xsl on the i/p xml to generate the simple o/p xml, but when iam tranformation applies ->the o/p xml getting nested Cdata sections in a single Node.
For Ex :
<nodeName>
- <![CDATA[ Content 1 ]]>
- <![CDATA[ Content 2 ]]>
- <![CDATA[ Content 3 ]]>
- <![CDATA[ Content 4 ]]>
</nodeName>
Iam using JDK1.4 and here is the My I/P XML
ip.xml
<root>
<content>Content 1 Content 2 Content 3 Content 4</content>
</root>
Apply.xml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes" cdata-section-elements="content"/>
<xsl:template match="root/content">
<xsl:element name="content">
<xsl:value-of select="content" disable-output-escaping="yes"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Here is the my java Code
String ip = "ip.xml";
String op = "op.xml";
String xsl="Apply.xsl";
Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
transformer.transform(new StreamSource(ip), new StreamResult(new FileOutputStream(op)));
Similar Threads
-
[Semi-Beginner] (nested loops) What's wrong with my code? (nested loops)
By Solarsonic in forum New To JavaReplies: 20Last Post: 03-22-2011, 04:02 AM -
Special Sections
By supertreta in forum AWT / SwingReplies: 4Last Post: 11-13-2010, 07:16 PM -
Sending [CDATA] element with SOAP message
By suchismitasuchi in forum Advanced JavaReplies: 0Last Post: 01-19-2009, 10:59 AM -
Transformation
By rosh72851 in forum New To JavaReplies: 1Last Post: 11-19-2008, 04:11 PM -
OpenGl transformation question newbie
By ankitmcgill in forum New To JavaReplies: 1Last Post: 11-16-2008, 03:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks