[jdom-interest] Include a PI when building a JDOM doc?

Rob Mitchell rjmitchell at attbi.com
Thu Mar 13 05:17:01 PST 2003



 ProcessingInstruction pi = new ProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"/ssi/TestExp.xsl\"");
 jdomDoc.addContent(pi);

But it still doesn't appear in the output


 XMLOutputter xmlOut = new XMLOutputter("  ", true);
 xmlOut.setTextNormalize(true);
 // if I uncomment next line, it appears fine
 //xmlOut.output(pi, response.getOutputStream());
 xmlOut.output(jdomDoc, response.getOutputStream());


Basically, my server is receiving an HTTP request, servicing the request via a DB query and using those results to filter a static XML doc (a periodic data extract) then using JDOM to produce an XML document via a custom ContentHandler and SAX.

I then created an XSL stylesheet for the new JDOM doc

I then forward the HTTP request to a JSP that's declared to produce XML output.

I want the response then handled by IE to render the XML/XSL into HTML

Everything works, except for putting the PI into the JDOM when the doc is first created.  Any ideas?

Thanks!


_______________________________________
Rob Mitchell
Base Class Technologies, Inc.
Java, WebSphere, Domino, Oracle, Web development
rjmitchell at attbi.com

  ----- Original Message ----- 
  From: Rob Mitchell 
  To: jdom-interest at jdom.org 
  Sent: Wednesday, March 12, 2003 4:23 PM
  Subject: [jdom-interest] Include a PI when building a JDOM doc?


  Hi,

  Can anyone answer this please?



  Element elemRoot = new Element("ExpenseReports");

  jdomDoc = new Document(elemRoot);

  //<xsl:stylesheet version="1.0" xmlns:xsl="MyExpenseReport.xsl">

  jdomDoc.addContent(new ProcessingInstruction("",""));



  How do I put the processing instruction for the XSL stylesheet into the JDOM doc? We want the user's browser to render the XML/XSL into HTML. 

  TIA!



  _______________________________________
  Rob Mitchell
  Base Class Technologies, Inc.
  Java, WebSphere, Domino, Oracle, Web development
  rjmitchell at attbi.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20030313/71e1f1d1/attachment.htm


More information about the jdom-interest mailing list