This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

XSL file in memory  RSS feed

 
James Sivakumar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, an XSL file is an XML file!
David
 
James Sivakumar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,
Thankz for sending that sample code , Lemme try this here and will get back to you.
Bye,
Shiva.
 
James Sivakumar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!