[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Can input xml and stylesheet be passed as strings to Xalan?

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)
loadxml stylesheet
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.