xsl-list
[Top] [All Lists]

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

2003-04-07 07:28:02

Yeah sorry about this one - it was a private email that I tried to take back 
on-list but sent to the xsl-list instead of the Xalan list!

Anyway, the crux of the matter was that the user had a cdata section on the 
source xml:

<RDF>
  <description><![CDATA[<<<<MY TEST>>>>]]></description>
</RDF>

And wanted to get identical output from an identity transform.  To achieve 
this, you need to set the cdata-section-elements attribute on <xsl:output> 
which they did, but still ended up with:  

<RDF>
  <description>&lt;&lt;&lt;&lt;MY TEST&gt;&gt;&gt;&gt;</description>
</RDF>

...as if the cdata-section-elements had been ignored.  I think they were using 
XML Spy, so I suggested that they may be using a custom processor instead of 
Xalan, but I have no experience of XML Spy so Im just guessing.  

cheers
andrew


<RDF>
  <description>&lt;&lt;&lt;&lt;MY TEST&gt;&gt;&gt;&gt;</description>
</RDF>


That is exactly equivalent to the version using CDATA marked section.
So why is this output a problem? It should be the same kind 
of thing as
if attribute quotes change from a="b" to a='b' it is just a difference
at the surface syntax, not in the underlying result tree.

Like all features of xsl:output,  cdata-section-elements="description"
is only a hint to the serialiser, which may be ignored, and in
particular if you pass the result tree directly as a tree to another
process, then this XSLt process will not serialise the tree 
at all, and
so all these hints will not be used.

David

 

---
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