You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Voytenko, Dimitry" <DV...@SECTORBASE.COM> on 2000/09/08 01:35:01 UTC
CDATA problem with Xalan J
I sent this question about three times, but didn't get any replies. If
anyone knows answer please answer
I have next XSL fragment:
-----
<test>
<xsl:text disable-output-escaping="yes"><![CDATA[& - this is
ampersand]]></xsl:text>
</test>
-----
I run XSLT processor with this string with output method = "xml" it returns
-----
<test>& - this is ampersand</test>
-----
That is OK.
But I don't use any of standard Xalan outputters. I want it to be output to
SAX interfaces. So I define class that implements org.sax.DocumentHandler
and org.sax.ext.LexicalHandler.
LexicalHandler contains method startCDATA and endCDATA
I pass instance of this class to Xalan processor in next way:
-----
XSLTResultTarget output = new XSLTResultTarget (new MyClass());
xslt.process (xml_source, xsl_source, output);
-----
But startCDATA and endCDATA methods in my class are never invoked. So there
is no way I can determine that CDATA section is gonna be output. So I get
analog of
-----
<test>& - this is ampersand</test>
-----
I looked into the Xalan code and found out that it checks output class for
instance of FormatterToXML and works through method charactersRaw. Also I
found places that works through LexicalHandler methods. I don't know which
methods are finally executed.
If anyone knows way I can use except overriden FormatterToXML class please
help me. Or if you think I do it wrong way.
Thank you
Dmitry E. Voytenko
Sectorbase.com