wood burning stoves*
The moose likes XML and Related Technologies and the fly likes Is The XSLT Transformation Platform Independent? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Is The XSLT Transformation Platform Independent?" Watch "Is The XSLT Transformation Platform Independent?" New topic
Author

Is The XSLT Transformation Platform Independent?

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
can we use XSLT to transform XML into HTML on any platform? I mean if it works if we have MS/Solaris or Linux equipment?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
XSLT is a standard language whose specification has been standardised by the W3C. You can find the specification at the following URL:
http://www.w3.org/TR/xslt
This specification has been implemented by different vendors and you can also find open-source implementations. Implementations of XSLT processors exists for all major languages (C++, Java, Perl, etc) and for all platforms.
As soon as you stylesheet is written according to the specification, it can be run with any XSLT processor on any OS.
One of the feature of XSLT is to allow output in many different formats. The 3 output formats that are part of the spec are xml, html and text, but you may also use XSL Formating Objects along with a Formatting Objects Processor. For instance Apache FOP is an open-source implementation of XSL-FO). Formatting objects allow you to prepare a document including graphics. You can then output this document in various document formats(PDF, PS, SVG).
XSLT processors written in Java will run (and behave) exactly the same on all OSes, assuming you are using the same version of the JDK.
If you want to use a Java based XLST processor, I would recommend Xalan as it's one of the most widely used. Additionaly, a version of this processor has been included in the lastest JDK 1.4 which runs on all plaforms.
Best luck
[ December 16, 2002: Message edited by: Beno�t d'Oncieu ]
Christopher Farnham
Greenhorn

Joined: Sep 18, 2002
Posts: 12
I have written XSLT which has worked in both VB and Java. I didn't use advanced features but it worked just fine.
It's rare that you can write something that works in both those worlds so I was quite pleased.


Christopher Farnham<br />Boston, MA<p>"Perfect is the Enemy of Good"
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Thanks for your detailed reply. Therefore, XSLT runs on MS/Solaris as well as on Linux. Is it true?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
TRUE !
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Thanks a lot, Beno�t.
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I am new to XML and its related technologies. I am simply following what I have read on the subject and online instructions to transform XML to HTML using XSLT. And I try to make the transformation work on both the client side and server side.
Someone told me to write a Java program that takes XML as input and produce HTML as output.
I personally would not do it this way unless there are Java packages/classes available to do the transformation (Are there?). According to my limited knowledge in the field, it takes worthless effort to write a Java program to do it.
I post this message to welcome feedbacks to my personal opinion.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
There are Java APIs to do this transform.
Which version of the JDK are you using?
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I am using JDK1.4.0_01 and how this kind of transformation is done?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The JDK 1.4 includes APIs for parsing XML and transforming XML (via XSL stylesheets), so you shoudn't need anything else, unless performance is important.
Here is a simple utility class to do your XSL transformations from your code.

You would use it like that:

Hope this helps
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Thank you very much, Beno�t. I used your code and got the expected output. Now, I have learned to transform XML to HTML on the client side, on the server using a servlet, and using a Java program.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is The XSLT Transformation Platform Independent?