xsl-list
[Top] [All Lists]

Fwd: Re: XSLT in JDK1.5 from the command line

2005-03-25 08:21:54
Mukul,

This is awesome: you appear to have nailed it. Thanks for finding this. Now it's more findable. Nice score.

So from here on out we'll ship a .jar and not make assumptions about the Java installation. Maybe it's better that way.

Cheers,
Wendell

Date: Fri, 25 Mar 2005 05:44:14 -0800 (PST)
From: Mukul Gandhi <mukul_gandhi(_at_)yahoo(_dot_)com>
Subject: Re: [xsl] XSLT in JDK1.5 from the command line
To: wapiez(_at_)mulberrytech(_dot_)com

Hi Wendell,
  I installed J2SE 1.5 and did some fact finding about
"using XSLT from command line in JDK1.5". I
uninstalled J2SE 1.4 completely before trying J2SE
1.5.

Here are my findings..
----------------------
This is a bug!

Its listed at Sun's site:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5099865

As written at the URL you provided, old package names
(org.apache.xalan.xslt etc) are *now not shipped* with
JDK1.5 . As stated at the URL, its done because newer
versions of Xalan are continuously coming, so users
should be able to install the new builds with ease.
Earlier this was possible with endorsed standard
mechanism. But since that was inconvenient, now with
JDK1.5 the package names are being changed (to
com.sun.org.apache.xalan.internal.xslt , instead of
org.apache.xalan.xslt) . So if we need to run latest
Xalan from command line, we need to download Xalan-J
from Apache's site and put xalan.jar in CLASSPATH.

*But JDK1.5 does provide XSLT processor to be run from
command line.* The class is -
com.sun.org.apache.xalan.internal.xslt.Process
(earlier this was called
org.apache.xalan.xslt.Process)
But class
com.sun.org.apache.xalan.internal.xslt.Process *has a
bug* (this is also reported on Sun's site at URL
above). It does not have a main method. Instead it has
_main method . This you can verify with JDK utility
javap (to be run as: javap
com.sun.org.apache.xalan.internal.xslt.Process )

Other commands like
com.sun.org.apache.xalan.internal.Version also have
bug. It has no main method.

As written at the bug URL above, Sun will not fix this
bug.

As suggested by you, I wrote these wrapper classes to
invoke _main method..
Program 1
---------
public class xalanProcess {
  public static void main(String[] args)
  {
     com.sun.org.apache.xalan.internal.xslt.Process
process = new
com.sun.org.apache.xalan.internal.xslt.Process();
     process._main(args);
  }
}

Please invoke as:
java xalanProcess -in file.xml -xsl file.xsl
(it works as expected)

Program 2
---------
public class xalanVersion {
  public static void main(String[] args)
  {
     com.sun.org.apache.xalan.internal.Version version
= new com.sun.org.apache.xalan.internal.Version();
     version._main(args);
  }
}

Please invoke as:
java xalanVersion
(produces output - Xalan Java 2.6.0)

I hope you would agree with my findings..

Regards,
Mukul

___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
    "Thus I make my own use of the telegraph, without consulting
     the directors, like the sparrows, which I perceive use it
extensively for a perch." -- Thoreau

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--