You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Elisa Bruschi <e....@cpr.it> on 2001/02/22 11:22:56 UTC

Problems while converting Node to Document

Hello.
I have a little problem with Xalan and hope you can help me in solving it.
I wrote this piece of (working) code

Document in = ...;
String xslPath = .....................;// stylesheet path
String htmlPath = ...................; // in this case a html file path, 
the result of the application
// of the stylesheet to the xml document, but
// usually a HTTP stream (to send the result directly to the browser)
XSLTInputSource xmlID = new XSLTInputSource(in);
XSLTProcessor processor = XSLTProcessorFactory.getProcessor(new 
org.apache.xalan.xpath.xdom.XercesLiaison());
XSLTInputSource xslID = new XSLTInputSource(xslPath);
XSLTResultTarget htmlID = new XSLTResultTarget(htmlPath);
try {
processor.process(xmlID, xslID, htmlID);
         ...........

Now I'm trying to use the same piece of code with an instance of class 
Node (instead of Document) and it does not work.
I even tried with a brutal cast but unsuccessfully.
Do you have any suggestion?
Thanks in advance.
   Elisa

-- 
*********************************************************
Elisa Bruschi - IT Research and Development 
MultimEdia & TelemaAtic Centre - Consorzio Pisa Ricerche 
Corso Italia, 116 - 56125 Pisa - Italy
Tel. +39 050 915811 - Fax: +39 050 915823 
e-mail: e.bruschi@cpr.it - http://meta.cpr.it
*********************************************************


Re: Problems while converting Node to Document

Posted by Gary L Peskin <ga...@firstech.com>.
Elisa Bruschi wrote:
> 
> Hello.
> I have a little problem with Xalan and hope you can help me in solving it.
> I wrote this piece of (working) code
> 
> Document in = ...;
> String xslPath = .....................;// stylesheet path
> String htmlPath = ...................; // in this case a html file path,
> the result of the application
> // of the stylesheet to the xml document, but
> // usually a HTTP stream (to send the result directly to the browser)
> XSLTInputSource xmlID = new XSLTInputSource(in);
> XSLTProcessor processor = XSLTProcessorFactory.getProcessor(new
> org.apache.xalan.xpath.xdom.XercesLiaison());
> XSLTInputSource xslID = new XSLTInputSource(xslPath);
> XSLTResultTarget htmlID = new XSLTResultTarget(htmlPath);
> try {
> processor.process(xmlID, xslID, htmlID);
>          ...........
> 
> Now I'm trying to use the same piece of code with an instance of class
> Node (instead of Document) and it does not work.
> I even tried with a brutal cast but unsuccessfully.
> Do you have any suggestion?
> Thanks in advance.

Elisa --

I'm not sure if anyone answered you on this already but you'll need to
provide a little more information.  XSLT is designed to convert an
incoming Document (http://www.w3.org/TR/xpath#data-model) to a result
Document.  Is your Node actually a Document?  What errors are you
getting which lead you to believe "it does not work".

Gary