[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Saxon unix script command line in Unix Code calling Saxon now working


Subject: Re: [xsl] Saxon unix script command line in Unix Code calling Saxon now working
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Nov 2014 22:16:11 -0000

Basically, you're telling Linux to run the program called "java", and you're
telling Java to run the program called "net.sf.saxon.Transform", which is the
entry point of the Saxon XSLT processor. The options to the left of
"net.sf.saxon.Transform" are options for Java, those to the right are options
for Saxon

Michael Kay
Saxonica
mike@xxxxxxxxxxxx
+44 (0) 118 946 5893




On 14 Nov 2014, at 22:01, Catherine Wilbur cwilbur@xxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Got the call to Saxon-he working in Unix so here is the code.  (took time to
resolve class path and properly set up Saxon java call syntax thru Unix shell
script)
>
> Was wondering what following means in following line of code?
>         net.sf.saxon.Transform
>     java -cp $SAXON_JAR net.sf.saxon.Transform
-s:$FinesrvDataDir/Library_Invoice_Interface.xml
-xsl:$FinesrvCronDir/LibrXML2CSV_stylesheet.xsl
-o:$FinesrvDataDir/Library_Invoice_Interface.csv
>
> Unix ClassPath Code
> Class paths set properly.  Now have Java directory, and Jar directory as
part of the class path.
> See changes in blue below.  Your path commands may be slightly different but
you get the idea.
>
> FinesrvCronDir=/usr/local/finesrv/erp/jdedwardsoneworld/cron
> FinesrvDataDir=/usr/local/finesrv/erp/jdedwardsoneworld/FABS/DATA/LibrVouch
> JAVA_HOME=/usr/java5
> export JAVA_HOME
> SAXON_JAR=/usr/local/finesrv/erp/jdedwardsoneworld/cron/Saxon/saxon9he.jar
>
> export PATH=$PATH:$SYSTEM/bin32:$JAVA_HOME/bin
> export ICU_DATA=$SYSTEM/locale/xml/
> #export CLASS_PATH=$SAXON_JAR:$CLASS_PATH:.
>
> Unix Code to do conversion (now working)
> You will notice that one java call has $CLASS_PATH and the other has
$SAXON_JAR but both calls work fine.  (one I commented out)
> Reason I put $SAXON_JAR so that the programmer can easily determine from
java call what jar file I am executing.
>
> Problem I had with the call is that
>         1)  Class path was not set properly
>         2)  Had a \ in middle of line which did not belong there
>
> #
> # 5) Convert Library A/P Interface file from XML to CSV
> # If the file exists then convert XML file to a CSV file
> # ==================================================================
> if [ -s $FinesrvDataDir/Library_Invoice_Interface.xml ]
> then
>     #
>     # Initialize Java Environment
>     # Change the directory to execute the Java SAXON-HE XSL Processor to
convert XML file to CSV
>     # ==================================================================
>     cd $FinesrvJavaDir
>     #. /usr/java5/bin/xxxx???
>
>     # Saxon-HE (home edition) is an open source version of processor written
in Java.
>     # Saxon XSL processor will execute the  stylesheet
>     # The stylesheet specifies the specific rules as to how the XML file is
to be converted.
>     # This command below is used to call the Saxon processor
>     #
>     # java -jar:/classpath/saxon9he.jar -s:/classpath/InputFile.xml
-xsl:/classpath/stylesheet.xsl -o:/classpath/OutputFile.csv
>     # ==================================================================
>    echo $SAXON_JAR net.sf.saxon.Transform \
-s:$FinesrvDataDir/Library_Invoice_Interface.xml
-xsl:$FinesrvCronDir/LibrXML2CSV_stylesheet.xsl
-o:$FinesrvDataDir/Library_Invoice_Interface.csv
>    #java -cp $CLASS_PATH net.sf.saxon.Transform
-s:$FinesrvDataDir/Library_Invoice_Interface.xml
-xsl:$FinesrvCronDir/LibrXML2CSV_stylesheet.xsl
-o:$FinesrvDataDir/Library_Invoice_Interface.csv
>     java -cp $SAXON_JAR net.sf.saxon.Transform
-s:$FinesrvDataDir/Library_Invoice_Interface.xml
-xsl:$FinesrvCronDir/LibrXML2CSV_stylesheet.xsl
-o:$FinesrvDataDir/Library_Invoice_Interface.csv
>     #
>     # 6) Remove XML Library A/P Interface file
>     # Remove XML file once it is converted
>     # =====================================
>     #rm $FinesrvDataDir/Library_Invoice_Interface.xml
> fi
>
> _____________________________________________________________________
> Catherine Wilbur  |  Senior Application Programmer  |  IT Services
> 401 Sunset Avenue, Windsor ON Canada  N9B 3P4
> (T) 519.253.3000 Ext. 2745  |  (F) 519.973.7083  |  (E) cwilbur@xxxxxxxxxxx
> www.uwindsor.ca/its
> XSL-List info and archive
> EasyUnsubscribe (by email)


Current Thread
Keywords