[jdom-interest] Fwd: Fwd: JDOM to Xalan?

Rabinovich, Igor irabinov at mdsi.bc.ca
Thu Dec 7 15:35:52 PST 2000

Just by convertion to String and back.

public static void printContents(org.jdom.Document xmlDoc, String
xslFilename, PrintStream out)
throws SAXException, IOException {
	// processor
      XSLTProcessor processor = XSLTProcessorFactory.getProcessor(new

      String docStr = document2string(xmlDoc);
      if (docStr == null)

	// XML source
      XSLTInputSource xml = new

	// XSL source
      StylesheetRoot stylesheet = processor.processStylesheet(xslFilename);

	// target
      DocumentHandler dh = stylesheet.getSAXSerializer(out);
	XSLTResultTarget html = new XSLTResultTarget(dh);

	processor.process(xml, null, html);

private static InputSource getInputSourceFromString(String xmlBuffer) {
	return new InputSource(new StringReader(xmlBuffer));

public static String document2string(org.jdom.Document doc) {
	ByteArrayOutputStream baos = new ByteArrayOutputStream();

      XMLOutputter out = new XMLOutputter("     ", true);
      try {
      	out.output(doc, baos);
      } catch (IOException e) {
	      return null;

      return baos.toString();

Igor Rabinovich.

-----Original Message-----
From: Al Yurov [mailto:alml at incap.ru]
Sent: Thursday, November 23, 2000 5:55 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Fwd: Fwd: JDOM to Xalan?


How can I use Xalan with JDOM? Convert JDOM to DOM and give to Xalan?


how can I use org.w3c.dom.* and org.jdom.* in one class (they both
have Document class), only with full package name?

Best regards,
              Al                            mailto:alml at incap.ru

P.S. Sorry if this is duplicated message

To control your jdom-interest membership:

More information about the jdom-interest mailing list