Subject: Can input xml and stylesheet be passed as strings to Xalan? From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Sat, 29 Jul 2000 06:13:45 -0700 (PDT) |
I am trying to call the methods of some key Xalan's classes in such a way as to be able to pass the xml input and the xsl stylesheet as strings. This is exactly what users of MSXML can do with the DOMDocument.loadXML() method. Below is a fragment of my source: StylesheetRoot stylesheet = null; stylesheet = m_processor.processStylesheet(xslSource); if(null != stylesheet) { Node sourceTree = m_processor.getSourceTreeFromInput(xmlSource); stylesheet.process(m_processor, sourceTree, new XSLTResultTarget(pw)); } Here xmlSource and xslSource are XSLTInputSource objects, created from the string that contains (respectively) the xml input and the stylesheet. The second line of this code fragment throws an exception and the printed message is: "Input XSL; Line 1; Column 1 org.apache.xalan.xslt.XSLProcessorException: The root element is required in a well-formed document. at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1630) at org.apache.xalan.xslt.XSLTEngineImpl.processStyleshee(XSLTEngineImpl .java:722)" I studied for some time the code for the XSLTEngineImpl, StylesheetRoot, and Stylesheet classes. It seems that the key methods always interpret a XSLTInputSource argument as a string containing a URL. Therefore, any attempt to achieve a loadXML() - like functionality in Xalan will require a significant modification of its basic underlying objects. I hope that I'm wrong and if this is the case I would greatly appreciate if someone could post the simplest possible working example demonstrating how to do this. Thanking in advance, Dimitre Novatchev. __________________________________________________ Do You Yahoo!? Kick off your party with Yahoo! Invites. http://invites.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Generate CSS to display FO on a, Sebastian Rahtz | Thread | Re: Can input xml and stylesheet be, David_Marston |
MSXML3 Namespace confusing, Serg Stone | Date | RE: MSXML3 Namespace confusing, Julian Reschke |
Month |