Subject: RE: PLEASE HELP: SAX events and CDATA problem when using transformation chaining
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Mon, 7 Apr 2003 14:45:33 +0100
|
This is the result I get, which I what I think you are after:
<?xml version="1.0" encoding="ISO-8859-1"?>
<RDF>
<description><![CDATA[<<<<MY TEST>>>>]]></description>
</RDF>
I have tested this with msxml3,4, saxon 6.5.2 and 7.2 and Xalan 2.4.1. and they all produce the same result. The only thing I can suggest is that you may be using an older version of Xalan, or somehow you are overriding the serializer. What version are you using?
cheers
andrew
> -----Original Message-----
> From: Hess Yvan [mailto:yvan.hess@xxxxxxx]
> Sent: 07 April 2003 14:27
> To: Andrew Welch
> Subject: RE: PLEASE HELP: SAX events and CDATA problem when using
> transformation chaining
>
>
> Hi Andrew,
>
> I already tried to use , but it doesn't change the situation.
> I still have
> the same problem. I did a simple example
>
> XML INPUT:
> ***********
>
> <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
> <RDF>
> <description><![CDATA[<<<<MY TEST>>>>]]></description>
> </RDF>
>
> XSL INPUT:
> ***********
>
> <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"
> cdata-section-elements="description"/>
> <xsl:template match="/">
> <xsl:copy-of select="."/>
> </xsl:template>
> </xsl:stylesheet>
>
>
>
> ----> HERE IS MY RESULT:
> ***************************
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <RDF>
> <description><<<<MY TEST>>>></description>
> </RDF>
>
> Any Idea ? What is wrong.
>
> Thanks for your answer. Yvan
>
> -----Original Message-----
> From: Andrew Welch [mailto:AWelch@xxxxxxxxxxxxxxx]
> Sent: lundi, 7. avril 2003 14:51
> To: Hess Yvan; xalan-j-users@xxxxxxxxxxxxxx
> Subject: RE: PLEASE HELP: SAX events and CDATA problem when using
> transformation chaining
>
>
>
> 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@xxxxxxx]
> > Sent: 07 April 2003 13:26
> > To: 'xalan-j-users@xxxxxxxxxxxxxx'
> > 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
>
>
>
>
>
> ---
> 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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|