[jdom-interest] comments & XSL

Dmitri Pichugin dpichugin at ptc.com
Thu Aug 2 13:34:05 PDT 2001


I cannot get my comments after XSL transformation with JDOMResult.

          try {
            Transformer transformer = TransformerFactory.newInstance()
                                  .newTransformer(new
StreamSource(stylesheet));
            JDOMResult out = new JDOMResult();
            transformer.transform(new JDOMSource(in), out);
            return out.getDocument();
          }

But  direct transformation by XALAN (command line) with the same XSL
stylesheet works fine.

The problem is SAXOutputter:

  public void output(Document document) throws JDOMException {

..........................
     Iterator i = document.getContent().iterator();
        while (i.hasNext()) {
            Object obj = i.next();
            if (obj instanceof Element) {
                // process root element and its content
                element(document.getRootElement(), new
NamespaceStack());
            }
            else if (obj instanceof ProcessingInstruction) {
                // contentHandler.processingInstruction()
                processingInstruction((ProcessingInstruction) obj);
            }
            else if (obj instanceof CDATA) {
                // contentHandler.characters()
                characters(((CDATA) obj).getText());
            }
        }
 ........................
   }

Here no comment handling AT ALL!

??  Do you have any idea about it ??

Dmitriy Pichugin






More information about the jdom-interest mailing list