[jdom-interest] comments lost for xslt

Laurent Bihanic laurent.bihanic at atosorigin.com
Mon Aug 19 06:36:11 PDT 2002


XML comments are reported through the SAX LexicalHandler interface. Support 
for this interface in JDOM was introduced with JDOM beta 8.
If you are using an earlier version of JDOM, comments are not made available 
to the XSLT processor; you should upgrade. If you are using JDOM beta 8... 
there's a bug!


Sonja Löhr wrote:
> Hi, all,
> I have a problem matching comments while transforming a jdom.document with
> xslt:
> When I do the transformation from a jdom.Document (=jdomDoc) I built
> before, using JAXP as follows
>    Transformer transformer = tFactory.newTransformer(new
> StreamSource(xslfile));
>    StreamResult result = new StreamResult(new FileOutputStream(outfile));
>     transformer.transform(new JDOMSource(jdomDoc), result);
> the templates matching the comment() nodes give no result.
> However, if I output jdomDoc with the XMLOutputter, the comments are there,
> and if I do an
> XSLT-transformation with the output file as source, using
>    transformer.transform(new StreamSource(xmlfile), result);
> everything is ok with the comment()-templates.
> Is there any solution for the mismatch between comment() and the jdom
> internal representation of comments?
> Thanks,
> Sonja

More information about the jdom-interest mailing list