You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Hess Yvan <yv...@imtf.ch> on 2003/04/09 17:44:18 UTC

RE: cdata-section-elements doesn't work in xalan 2.4 (and previou s)

Hi Tom
 
I also get many troubles with this feature. I posted a mail to the
xalan-dev@xml.apache.org mailing list (subject:HELP!! Xalan trouble using
XSLT transformation, SAX content-lexical handler and CDATA section). If you
set output properties by yourself, it works for elements that have no
namespace, but not for element having namespaces, as for example :
 
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
   <custom:metadata
xmlns:custom="http://www.imtf.com/edoc/metadata/custom/">
   <custom:section1><![CDATA[<<<Yvan Hess>>>]]></custom:section1>
   <section2>SECTION 2 WITHOUT CDATA</section2>
</custom:metadata>
 
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:custom="http://www.imtf.com/edoc/metadata/custom/">
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes"
cdata-section-elements="custom:section1 section2"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
 
and I get the following result:
 
<?xml version="1.0" encoding="ISO-8859-1"?>
  <custom:metadata xmlns:custom="http://www.imtf.com/edoc/metadata/custom/">
  <custom:section1>&lt;&lt;&lt;Yvan Hess&gt;</custom:section1>
   <section2><![CDATA[SECTION 2 WITHOUT C]]><![CDATA[DATA]]></section2>
</custom:metadata>
 
As you can seen CDATA section has been wrapped with 2 CDATA section, I would
like to have only one !!!. Moreover the custom:section1 has not been
wrapped. This example works with XML spy an MSXML parser !
 
If you get an answer or the solution please inform me, because of this
problem I am in big troubles. I will do the same for you !
 
Regards. Yvan. 
 
 
 
 
 
 
 
 From: Lambrechts tom [mailto:tom.lambrechts@axelera.net]
Sent: mardi, 8. avril 2003 17:49
To: xalan-j-users@xml.apache.org
Subject: cdata-section-elements doesn't work in xalan 2.4 (and previous)


The attribute cdata-section-elements  has no effect in xalan using 2.4.0 in
java running on sun jdk1.4.2.
 
Xslt:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" >
<xsl:output cdata-section-elements="output"/>
<xsl:template match="/msg">
     <output>
          <xsl:value-of select="foo"/>
     </output>
</xsl:template>
</xsl:stylesheet>
 
xml:
<msg>
     <foo>blabla</foo>
</msg>
 
output xmlspy:
<?xml version="1.0" encoding="UTF-8"?><output><![CDATA[blabla]]></output>
 
output xalan 2.4.0:
<?xml version="1.0"?><output> blabla </output>