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

Subject: [xsl] Saxon unix script command line in Unix Code calling Saxon now working
From: "Catherine Wilbur cwilbur@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Nov 2014 22:00:58 -0000
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

Current Thread