You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by THUFIR HAWAT <ha...@gmail.com> on 2006/02/18 13:41:45 UTC
invoke xalan from the command line
Here I am, as root, installing xalan via yum. However, there's no man
page for xalan and I'm just not sure how to invoke the program. The
example I use below is straight from the xalan web page. (This is on
Fedora, FC4, if that matters.)
[root@localhost ~]# yum -y install xalan-j2-demo-2.7.0-1jpp
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package xalan-j2-demo.noarch 0:2.7.0-1jpp set to be updated
--> Running transaction check
--> Processing Dependency: xalan-j2 = 0:2.7.0-1jpp for package: xalan-j2-demo
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Package xalan-j2.noarch 0:2.7.0-1jpp set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
xalan-j2-demo noarch 2.7.0-1jpp jpackage-generic 3.6 M
Installing for dependencies:
xalan-j2 noarch 2.7.0-1jpp jpackage-generic 1.7 M
Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 5.3 M
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: xalan-j2 ######################### [1/2]
Installing: xalan-j2-demo ######################### [2/2]
Installed: xalan-j2-demo.noarch 0:2.7.0-1jpp
Dependency Installed: xalan-j2.noarch 0:2.7.0-1jpp
Complete!
[root@localhost ~]# yum -y install xalan-j2-manual-2.7.0-1jpp
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package xalan-j2-manual.noarch 0:2.7.0-1jpp set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
xalan-j2-manual noarch 2.7.0-1jpp jpackage-generic 10 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 10 k
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: xalan-j2-manual ######################### [1/1]
Installed: xalan-j2-manual.noarch 0:2.7.0-1jpp
Complete!
[root@localhost ~]# exit
logout
[thufir@localhost xml]$ pwd
/home/thufir/xml
[thufir@localhost xml]$ ll
total 44
-rw-rw-r-- 1 thufir thufir 6787 Feb 18 06:59 foo.ods
-rw-rw-r-- 1 thufir thufir 3194 Feb 18 07:05 foo.xhtml
-rw-rw-r-- 1 thufir thufir 423 Feb 18 07:07 foo.xsl
drwxrwxr-x 2 thufir thufir 4096 Feb 18 07:06 raw
-rw-rw-r-- 1 thufir thufir 759 Feb 18 07:14 typescript
[thufir@localhost xml]$ java org.apache.xalan.xslt.Process -IN
foo.xhtml -XSL foo.xsl -OUT foo.out
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/xalan/xslt/Process
[thufir@localhost xml]$ java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
[thufir@localhost xml]$ cat foo.xhtml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta
http-equiv="content-type" content="text/html; charset=utf-8" /><title
/><meta name="generator" content="StarOffice/OpenOffice.org XSLT
(http://xml.openoffice.org/sx2ml)" /><meta name="created"
content="2006-02-18T06:45:34" /><meta name="changed"
content="2006-02-18T06:59:44" /><base href="." /><style
type="text/css">
@page { }
table { border-collapse:collapse; border-spacing:0; empty-cells:show }
td, th { vertical-align:top; }
h1, h2, h3, h4, h5, h6 { clear:both }
ol, ul { padding:0; }
* { margin:0; }
*.ta1 { }
*.ce1 { font-family:'Nimbus Roman No9 L'; text-align:right !
important; font-size:10pt; font-style:normal; text-shadow:none;
font-weight:normal; }
*.ce2 { font-family:'Bitstream Vera Sans'; text-align:right !
important; }
*.ce3 { font-family:'Nimbus Roman No9 L'; font-size:10pt;
font-style:normal; text-shadow:none; font-weight:normal; }
*.Default { font-family:'Bitstream Vera Sans'; }
*.Heading { font-family:'Bitstream Vera Sans';
text-align:center ! important; font-size:16pt; font-style:italic;
font-weight:bold; }
*.Heading1 { font-family:'Bitstream Vera Sans';
text-align:center ! important; font-size:16pt; font-style:italic;
font-weight:bold; }
*.Result { font-family:'Bitstream Vera Sans';
font-style:italic; font-weight:bold; text-decoration:underline; }
*.Result2 { font-family:'Bitstream Vera Sans';
font-style:italic; font-weight:bold; text-decoration:underline; }
*.co1 { width:0.8925in; }
*.ro1 { height:0.4146in; }
*.ro2 { height:0.2173in; }
*.ro3 { height:0.1681in; }
</style></head><body dir="ltr"><table border="0"
cellspacing="0" cellpadding="0" class="ta1"><colgroup><col width="99"
/><col width="99" /></colgroup><tr class="ro1"><td
style="text-align:right; width:0.8925in; " class="ce1"><p>1
</p></td><td style="text-align:left;width:0.8925in; "
class="ce3"><p><a href="http://www.yahoo.com/">yahoo</a>
</p></td></tr><tr class="ro2"><td style="text-align:right;
width:0.8925in; " class="ce1"><p>2 </p></td><td
style="text-align:left;width:0.8925in; " class="ce3"><p><a
href="http://www.google.com/">google</a></p></td></tr><tr
class="ro1"><td style="text-align:right; width:0.8925in; "
class="ce1"><p>3 </p></td><td style="text-align:left;width:0.8925in; "
class="ce3"><p><a href="http://www.msn.com/">MSN</a>
</p></td></tr><tr class="ro3"><td
style="text-align:left;width:0.8925in; " class="ce2" /><td
style="text-align:left;width:0.8925in; " class="Default" /></tr><tr
class="ro3"><td style="text-align:left;width:0.8925in; " class="ce2"
/><td style="text-align:left;width:0.8925in; " class="Default"
/></tr></table><table border="0" cellspacing="0" cellpadding="0"
class="ta1"><colgroup><col width="99" /></colgroup><tr class="ro3"><td
style="text-align:left;width:0.8925in; " class="Default"
/></tr></table><table border="0" cellspacing="0" cellpadding="0"
class="ta1"><colgroup><col width="99" /></colgroup><tr class="ro3"><td
style="text-align:left;width:0.8925in; " class="Default"
/></tr></table></body></html>
[thufir@localhost xml]$ cat foo.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" version="1.0" encoding="UTF-8" />
<xsl:template match="/">
<xsl:apply-templates select="//a[@href]"/>
</xsl:template>
<xsl:template match="a[@href]">
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
<xsl:value-of select="@href"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
[thufir@localhost xml]$ date
Sat Feb 18 07:27:35 EST 2006
[thufir@localhost xml]$
thanks,
Thufir
--
It has been said that democracy is the worst form of government except
all the others that have been tried.
Sir Winston Churchill
Re: invoke xalan from the command line
Posted by THUFIR HAWAT <ha...@gmail.com>.
success!
[root@localhost xalon]# whoami
root
[root@localhost xalon]# pwd
/home/thufir/xalon
[root@localhost xalon]# ll
total 68
-rw-rw-r-- 1 thufir thufir 6787 Feb 18 06:59 foo.ods
-rw-rw-r-- 1 thufir thufir 3194 Feb 18 07:05 foo.xhtml
-rw-rw-r-- 1 thufir thufir 423 Feb 18 07:07 foo.xsl
drwxrwxr-x 2 thufir thufir 4096 Feb 18 07:06 raw
-rw-rw-r-- 1 thufir thufir 759 Feb 18 07:14 typescript
-rw-r--r-- 1 thufir thufir 2864 Feb 19 04:03 typescript.2.permissionDenied
-rw-r--r-- 1 thufir thufir 3045 Feb 19 04:06 typescript.3.permissionDenied
-rw-rw-r-- 1 thufir thufir 323 Feb 19 04:01 xalon.txt
[root@localhost xalon]# java -cp
/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar
org.apache.xalan.xslt.Process -IN foo.xhtml -XSL foo.xsl -OUT foo.out
[root@localhost xalon]# ll
total 72
-rw-rw-r-- 1 thufir thufir 6787 Feb 18 06:59 foo.ods
-rw-r--r-- 1 root root 0 Feb 19 07:13 foo.out
-rw-rw-r-- 1 thufir thufir 3194 Feb 18 07:05 foo.xhtml
-rw-rw-r-- 1 thufir thufir 423 Feb 18 07:07 foo.xsl
drwxrwxr-x 2 thufir thufir 4096 Feb 18 07:06 raw
-rw-rw-r-- 1 thufir thufir 759 Feb 18 07:14 typescript
-rw-r--r-- 1 thufir thufir 2864 Feb 19 04:03 typescript.2.permissionDenied
-rw-r--r-- 1 thufir thufir 3045 Feb 19 04:06 typescript.3.permissionDenied
-rw-rw-r-- 1 thufir thufir 323 Feb 19 04:01 xalon.txt
[root@localhost xalon]# cat foo.out -n
[root@localhost xalon]# date
Sun Feb 19 07:14:11 EST 2006
[root@localhost xalon]#
thanks,
Thufir
Re: invoke xalan from the command line
Posted by Stanimir Stamenkov <st...@myrealbox.com>.
/THUFIR HAWAT/:
> On 2/19/06, Stanimir Stamenkov <st...@myrealbox.com> wrote:
>
>> java -cp
>> /usr/share/java/xalan-j2.jar;/usr/share/java/xalan-j2-serializer.jar
>> org.apache.xalan.xslt.Process ...
>
> Pardon, I'm a bit lazy at the moment. Partly for posterity (and so I
> can see where I'm at) here's my latest result (which I need to take
> another look at later, but I can't figure out why there'd be a
> permissions problem):
...
> [root@localhost xalon]# java -cp
> /usr/share/java/xalan-j2.jar;/usr/share/java/xalan-j2-serializer.jar
> org.apache.xalan.xslt.Process -IN foo.xhtml -XSL foo.xsl -OUT foo.out
> Usage: java [-options] class [args...]
> (to execute a class)
> or java [-options] -jar jarfile [args...]
> (to execute a jar file)
>
> where options include:
...
> -cp <class search path of directories and zip/jar files>
> -classpath <class search path of directories and zip/jar files>
> A : separated list of directories, JAR archives,
> and ZIP archives to search for class files.
...
Sorry, I didn't take into account the path separator is different on
Unix/Linux (I'm on Windows) - it has to be : (colon) instead of ;
(semicolon):
java -cp
/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar
org.apache.xalan.xslt.Process ...
--
Stanimir
Re: invoke xalan from the command line
Posted by Stanimir Stamenkov <st...@myrealbox.com>.
/THUFIR HAWAT/:
> [thufir@localhost xml]$ java -cp /usr/share/java/xalan-j2.jar
> org.apache.xalan.Version Xalan Java 2.7.0
> [thufir@localhost xml]$ java -cp /usr/share/java/xalan-j2.jar
> org.apache.xalan.xslt.Process -IN foo.xhtml -XSL foo.xsl -OUT foo.out
>
> (Location of error unknown)XSLT Error
> (java.lang.NoClassDefFoundError):
> org/apache/xml/serializer/SerializerTrace
> Exception in thread "main" java.lang.RuntimeException:
> org/apache/xml/serializer/SerializerTrace
> at org.apache.xalan.xslt.Process.doExit(Process.java:1153)
> at org.apache.xalan.xslt.Process.main(Process.java:1126)
...
> In any event, Xalan seems to be installed and thanks for the help with
> the classpath.
Just, it seems you have to add the Serializer library in addtion:
java -cp
/usr/share/java/xalan-j2.jar;/usr/share/java/xalan-j2-serializer.jar
org.apache.xalan.xslt.Process ...
You might consider setting up the CLASSPATH environment variable
instead of specifying -cp command-line option with every command, or
just create a script with a much shorter name.
--
Stanimir
Re: invoke xalan from the command line
Posted by Stanimir Stamenkov <st...@myrealbox.com>.
/THUFIR HAWAT/:
> On 2/18/06, Stanimir Stamenkov <st...@myrealbox.com> wrote:
>
>> You have to put the Xalan library on the classpath. Either add it to
>> the CLASSPATH environment variable or specify it on the command line:
>>
>> java -cp <path_to>/xalan.jar org.apache.xalan.xslt.Process ...
>
> Pardon, I'm reading up on this but find it arcane. I have many JVM's,
> but would like to use the jpackage one.
I don't know what "jpackage" stands for (I'm not running FC4) but
here are some details:
Sun's Java 1.4 comes packaged with a much older Xalan version where
you could start |org.apache.xalan.xslt.Process| without bothering
with the classpath. Unfortunately this conflicts with newer Xalan
versions (when specified on the classpath), for which case one have
to use the "Endorsed Standards Override Mechanism"
<http://java.sun.com/j2se/1.4.2/docs/guide/standards/>.
Since you're using (Sun's?) Java 1.5, it comes with a newer (but not
the latest) Xalan version for the needs of the JAXP implementation,
but has the original packages renamed (other than |org.apache.*|) so
they don't conflict with other official Apache releases. (see below)
> I think that I found xalan
> itself (or a symbolic link), as shown by the following terminal output
> on FC4:
>
> [root@localhost ~]# java org.apache.xalan.Version
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/xalan/Version
> [root@localhost ~]# java -version
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
> [root@localhost ~]# cat /etc/profile -n
...
No trace of CLASSPATH environment variable setting.
...
> [root@localhost ~]# ll /usr/share/java
...
> -rw-r--r-- 1 root root 1701111 Oct 10 08:21 xalan-j2-2.7.0.jar
> lrwxrwxrwx 1 root root 18 Feb 18 07:25 xalan-j2.jar -> xalan-j2-2.7.0.jar
...
So, have you tried:
java -cp /usr/share/java/xalan-j2.jar org.apache.xalan.Version
java -cp /usr/share/java/xalan-j2.jar org.apache.xalan.xslt.Process ...
as I've previously suggested?
--
Stanimir
Re: invoke xalan from the command line
Posted by Stanimir Stamenkov <st...@myrealbox.com>.
/THUFIR HAWAT/:
> [thufir@localhost xml]$ java org.apache.xalan.xslt.Process -IN
> foo.xhtml -XSL foo.xsl -OUT foo.out
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/xalan/xslt/Process
> [thufir@localhost xml]$ java -version
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
You have to put the Xalan library on the classpath. Either add it to
the CLASSPATH environment variable or specify it on the command line:
java -cp <path_to>/xalan.jar org.apache.xalan.xslt.Process ...
--
Stanimir