This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread 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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
Don't get me started about those stupid light bulbs.
 
subject: XSL file in memory
 
Similar Threads
Adding a comment to an XML tag
Style sheet using Transform
Xml result is not coming.
xsl for adding a tag
Result is not appropriate