Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

XSLT/XML Transformation using Java Translets

Thread view: 
SG - 15 Aug 2007 13:43 GMT
Translets "are precompiled XSL documents that are optimized and
converted into simple Java classes. When you compile your application
Java files, you compile your XSL files into Java class files. During
runtime, you can load translets like any regular Java class and
perform XSL transformations over and over again.

The syntax checking and parsing of XSL documents are done when the XSL
files are compiled. The transformation therefore takes only as long as
the compiled code takes to execute, which improves performance
multiple folds.

The downside to using XSL is that "it can take a considerable amount
of time and reduce performance. The time needed to parse XML and XSL
documents is directly proportional to the size of the documents. Each
transformation requires the XML and XSL documents to be loaded, syntax
checked, and parsed." I recommends using translets for the following
reasons.

I had written an application (<a href="http://www.simplygites.com"
title="www.simplygites.com">SimplyGites</a>) using standard XSL / XML
transformation and experienced some very slow server-side
transformation on the very complex screens with large amounts of xml.
Timings showed these problem screens took 2-3 seconds to transform,
which was totally unacceptable non-functional requirements.

I considered rewriting these screens as JSP or PHP, then I discovered
Translets. And wow what a discovery the timings for these pages now
compiled as Translets(java classes) are amazing in comparison to the
original timings ? I now have them transforming in 500ms (all now
under 1 second).

I would recommend anyone using XSL/XML transformation to use
Translets, these have now been running tried and tested on the <a
href="http://www.simplygites.com"
title="www.simplygites.com">SimplyGites</a> for the past 6months.

Technolgies used:
IBM WebShpere
Java
JAXP 1.3

Required Jars
xsltc.jar
runtime.jar
BCEL.jar
JLex.jar
java_cup.jar
regexp.jar
xml-dtm.jar

For more information see http://xml.apache.org/xalan-j/xsltc_usage.html

I hope this helps anyone that has XML/XSLT performance issues.

Mark
MB Computer Ltd
www.simplygites.com
Thomas Hawtin - 15 Aug 2007 16:52 GMT
> I had written an application (<a href="http://www.simplygites.com"
> title="www.simplygites.com">SimplyGites</a>) using standard XSL / XML
> transformation and experienced some very slow server-side
> transformation on the very complex screens with large amounts of xml.
> Timings showed these problem screens took 2-3 seconds to transform,
> which was totally unacceptable non-functional requirements.

What typically happens when you use XSLT is that the stylesheet is
compiled to byte code and then executed. Compiling to byte code and
loading is expensive. However, if you keep
javax.xml.transform.Transformer objects across all uses of the same
stylesheet, then it only needs to be compiled once. The advantage of
translets is a reduced start up time (and a XSLT implementation known at
compile time).

Tom Hawtin
Mike Schilling - 15 Aug 2007 18:38 GMT
>> I had written an application (<a href="http://www.simplygites.com"
>> title="www.simplygites.com">SimplyGites</a>) using standard XSL / XML
[quoted text clipped - 5 lines]
> What typically happens when you use XSLT is that the stylesheet is
> compiled to byte code and then executed.

That's true in the default XSLT implementation in Sun's JRE, starting with
1.5.  (I hadn't realized that before; thanks, Thomas, for pointing it out.)
It may not be true in other JREs, so another advantage of using translets
explicitly is ensuring that compiled transformations are used in all
environments.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.