xsl-list
[Top] [All Lists]

RE: PLEASE HELP: SAX events and CDATA problem when using transformation chaining

2003-04-07 06:45:33

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(_dot_)hess(_at_)imtf(_dot_)ch]
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>&lt;&lt;&lt;&lt;MY TEST&gt;&gt;&gt;&gt;</description>
</RDF>

Any Idea ? What is wrong. 

Thanks for your answer. Yvan

-----Original Message-----
From: Andrew Welch [mailto:AWelch(_at_)piper-group(_dot_)com]
Sent: lundi, 7. avril 2003 14:51
To: Hess Yvan; xalan-j-users(_at_)xml(_dot_)apache(_dot_)org
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(_dot_)hess(_at_)imtf(_dot_)ch]
Sent: 07 April 2003 13:26
To: 'xalan-j-users(_at_)xml(_dot_)apache(_dot_)org'
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>&lt;&lt;&lt;&lt;TEST&gt;&gt;&gt;&gt;</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



<Prev in Thread] Current Thread [Next in Thread>