This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes XML and Related Technologies and the fly likes XSL file in memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSL file in memory " Watch "XSL file in memory " New topic
Author

XSL file in memory

James Sivakumar
Greenhorn

Joined: Nov 16, 2000
Posts: 21
Hi All,
Is there any way to create a XSL file in memory ,
like similar to , what we do in creation of xml file in memory using DOM.
Example :
Document doc = new DocumentImpl();
Element cd = doc.createElement("CD");
doc.appendChild(table);
Element author = doc.createElement("author");
author.appendChild(doc.createTextNode("Charles"));
author.appendChild(author);
...
Is it possible to create a XSL file in memory(It should not in Hard Disk)
Bye,
Shiva.
David Peterson
author
Ranch Hand

Joined: Oct 14, 2001
Posts: 154
Yes, an XSL file is an XML file!
David
James Sivakumar
Greenhorn

Joined: Nov 16, 2000
Posts: 21
Thanks David ,
But Can u say how to create or can u post any sample code.
I'm using xalan parser
Shiva.
David Peterson
author
Ranch Hand

Joined: Oct 14, 2001
Posts: 154
Here you go.
This is longer than I intended but there appears to be a bug in Xalan that won't let you use XSL from a DOMSource (at least not directly). It works fine with a StreamSource though, so I'm converting to a StreamSource via its String representation and a Writer/Reader.

David
[This message has been edited by David Peterson (edited November 30, 2001).]
James Sivakumar
Greenhorn

Joined: Nov 16, 2000
Posts: 21
Hi David,
Thankz for sending that sample code , Lemme try this here and will get back to you.
Bye,
Shiva.
James Sivakumar
Greenhorn

Joined: Nov 16, 2000
Posts: 21
Hi David,
Thanks for ur code man , its working here.
One more question would like to know ...
Is there a way that you can load the DTD into memory and use some code to validate whether the XML document created follows the DTD structure?
Can you give me your email address, will keep in touch with you.
You can reach me at shivgs@rediffmail.com
Bye,
Shiva.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: XSL file in memory