laurent.bihanic at atosorigin.com
Fri May 27 06:39:04 PDT 2005
Fabrizio Lippolis wrote:
> I have an XML in which a tag contains some HTML code protected by a
> CDATA in this way:
> <VBDESCRIPTION><![CDATA[aaa <font color="#009900">bbb</font> <font
> style="BACKGROUND-COLOR: #0000ff">ccc</font>]]></VBDESCRIPTION>
> This is processed by a XSL which should output the HTML code somewhere.
> To perform this task I have found I have to write this way:
> <xsl:value-of select="//*/VBDESCRIPTION" disable-output-escaping="true" />
> The problem is the resulting HTML doesn't contain the expected result
> and shows a processing instruction like
This is the behaviour JAXP mandates when the XSLT processor does not directly
output the XML text. So, when you direct the output of the XSL transformation
to JDOM, the XSLT processor surrounds your HTML text with the
<?javax.xml.transform.enable-output-escaping?> processing instructions (see
> I am using JDOM b8 and I haven't upgraded because until now it was good
> for all my purposes, trying to upgrage to version 1.0 to see if this
> solves the problem lead me to compilation errors. I have also read in
> another mail (rather old anyway) that JDOM doesn't support
> disable-output-escaping, is it still true with version 1.0? If not I can
> consider an upgrade. In this case what is the correct way to let the
> transformer interpret disable-output-escaping? Does it work out of the
> box or is it necessary to use some special classes/parameters? A little
> example would be greatly appreciated. Thank you very much in advance.
JDOM 1.0 supports disabling output escaping and recognizes the above
processing instructions in XMLOutputter.
For more information, see org.jdom.output.Format.setIgnoreTrAXEscapingPIs().
As this feature was introduced late in the 1.0 development, it is not
available in beta8, 9, etc.
More information about the jdom-interest