  | |  | PLEASE HELP: SAX events and CDATA problem when using transformation chainin | PLEASE HELP: SAX events and CDATA problem when using transformation chainin 2003-04-07 - By Andrew Welch
Theres nothing wrong with your setup... you will need to understand what a cdata section is a little better.
If you want to output cdata sections, you need to tell the xslt processor by adding
cdata-section-elements="qname"
to <xsl:output>.
So your new stylesheet should look something like:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:custom="ive.added.this">
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes" cdata-section-elements="custom:description"/>
<xsl:template match="/"> <xsl:copy-of select="/"/> </xsl:template>
</xsl:stylesheet>
cheers andrew
> -----Original Message----- > From: Hess Yvan [mailto:yvan.hess@(protected)] > Sent: 07 April 2003 13:26 > To: 'xalan-j-users@(protected)' > Subject: PLEASE HELP: SAX events and CDATA problem when using > transformation chaining > > > Hi, > > I have an urgent problem to solve with Xalan. I am doing XSLT SAX > Transformation using Chaining. I am try to transform an XML > using CDATA > sections as follow: > > XML INPUT: > > <custom:type> > <rdf:Description> > <custom:id>100</custom:id> > > <custom:description><![CDATA[<<<<TEST>>>>]]></custom:description> > </rdf:Description> > </custom:type> > > CODE: > TransformerHandler transformerHandler; > > this.setContentHandler(transformerHandler); > this.setLexicalHandler(transformerHandler); > > SAXResult result = new SAXResult(xmlConsumer); /* xmlConsumer > implements ContentHandler and LexicalHandler */ > result.setLexicalHandler(xmlConsumer); > > transformerHandler.setResult(result); > > XSL: > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" > indent="yes"/> > <xsl:template match="/"> > <xsl:copy-of select="/"/> > </xsl:template> > </xsl:stylesheet> > > > My XMLConsumer classes plays the role of a content handler and a > lexicalhandler. When I execute my program I get th following > result where my > CDATA has been replaced. I debug my code and I saw that my > lexical hanldler > is never called. It is a bug of Xalan or I am doing something wrong ? > > <custom:type> > <rdf:Description> > <custom:id>100</custom:id> > > <custom:description><<<<TEST>>>></cust > om:description > > > </rdf:Description> > </custom:type> > > Thanks for your answer because, It is urgent!!! > > Regards. Yvan > > > > > > > > > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.467 / Virus Database: 266 - Release Date: 01/04/2003 > >
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.467 / Virus Database: 266 - Release Date: 01/04/2003
|
|
 |