aspose file tools*
The moose likes Java in General and the fly likes Convert XSLT Template to XSLT String object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Convert XSLT Template to XSLT String object" Watch "Convert XSLT Template to XSLT String object" New topic
Author

Convert XSLT Template to XSLT String object

V Senthil
Greenhorn

Joined: Jun 21, 2005
Posts: 8
Hello all,

1. I am working in enhancement project. Our project extensively used XSLT transformation. The XSLT is stored in oracle database & then using it. TO avoid querying DB everything, we implemented Cache mechanism. When the server starts up, a thread will keep on fetching the XSLT from database and converting them into Templates then added in the HashMap defined in Singleton class. Whenever we require, we will take the Template from hashmap and convert one XML to another....
2. Now, we have one more enhancement that we need to give the XSLT as String object to one URL. As already we implemented caching machanism, we would like to use the same template converting back to String object(contains text of XSLT). Will it possible to get the XSLT from the Template object?

Thanks,
Senthil
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

Can you elaborate more about Template? How your template stores XML.
In java terminology a template means a object which stores XML.
V Senthil
Greenhorn

Joined: Jun 21, 2005
Posts: 8
Hi,
We are storing XML. Using XSLT we have created javax.xml.tranform.Template object. Using this Template object u will get the Transformer java Object. Again by using Transformer object, we will convert one XMl to another.
Thanks,
senthil
V Senthil
Greenhorn

Joined: Jun 21, 2005
Posts: 8
Sorry, We r not storing XML in java Template object.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"V",
please UseRealWords

thanks,
Dave
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
As far as I can tell from the JavaDocs, there is no way to regenerate the original form of a XSLT from an object that implements the javax.xml.transform.Templates interface. Why don't you just cache the original String in addition to the Templates object?
Bill
Amru Reddy
Greenhorn

Joined: Feb 17, 2006
Posts: 3
Hello all,

1. I am working in enhancement project. Our project extensively used XSLT transformation. The XSLT is stored in oracle database & then using it. TO avoid querying DB everything, we implemented Cache mechanism. When the server starts up, a thread will keep on fetching the XSLT from database and converting them into Templates then added in the HashMap defined in Singleton class. Whenever we require, we will take the Template from hashmap and convert one XML to another....
Thanks,
Senthil[/QB]

Senthil,

I am working on a similar project where in xsl performance improvement is major concern.The current implementaion uses xalan xslt processor. Original plan is to replace xalan interpretive processor with xsltc ( compile style sheet once and use translets for transform thereon..). It dit not work because current implementaion makes extensive use of xalan:evalaute() library function which is not supported bt xsltc. ANY HELP ..ANY WORK AROUND TO THIS WOULD BE HIGHLY APPRECIATED..
alternately looking at caching Templates objects and use them for transformations. can any one throw some light on Template caching mechanism.

I have around 250 xsl files, will it be wise to cache 250 Templates in JVM memory? Any inputs on this.
If some one has sample Template Cache code, please send me for my use.

senthil, can you share your experiences ? Since you have already worked in similar lines , your help would be of great relief for me.

waiting to hear from you,
Amru
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert XSLT Template to XSLT String object