From f526cc17f0c921fc60ccf6b6cddbd3a139319386 Mon Sep 17 00:00:00 2001 From: Joerg Pietschmann Date: Mon, 3 Feb 2003 23:45:20 +0000 Subject: [PATCH] Added convenience command files xalan.bat and xalan.sh to run a standalone XSLT (use standard Xalan commands, to be documented) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195927 13f79535-47bb-0310-9956-ffa450edef68 --- xalan.bat | 8 +++++ xalan.sh | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100755 xalan.bat create mode 100755 xalan.sh diff --git a/xalan.bat b/xalan.bat new file mode 100755 index 000000000..535563209 --- /dev/null +++ b/xalan.bat @@ -0,0 +1,8 @@ +@ECHO OFF + +set LIBDIR=lib +set LOCALCLASSPATH=build/fop.jar +set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis.jar +set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xercesImpl-2.2.1.jar +set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xalan-2.4.1.jar +java -cp %LOCALCLASSPATH% org.apache.xalan.xslt.Process %1 %2 %3 %4 %5 %6 %7 %8 \ No newline at end of file diff --git a/xalan.sh b/xalan.sh new file mode 100755 index 000000000..472f8d0ce --- /dev/null +++ b/xalan.sh @@ -0,0 +1,104 @@ +#! /bin/sh +# +# Shell script to run FOP, adapted from the Jakarta-Ant project. + +if [ -f $HOME/.foprc ] ; then + . $HOME/.foprc +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +case "`uname`" in + CYGWIN*) cygwin=true ;; + Darwin*) darwin=true ;; +esac + +if [ -z "$FOP_HOME" ] ; then + # try to find FOP + if [ -d /opt/fop ] ; then + FOP_HOME=/opt/fop + fi + + if [ -d ${HOME}/opt/fop ] ; then + FOP_HOME=${HOME}/opt/fop + fi + + ## resolve links - $0 may be a link to fop's home + PRG=$0 + progname=`basename $0` + + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '.*/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname $PRG`/$link" + fi + done + + FOP_HOME=`dirname "$PRG"` + +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$FOP_HOME" ] && + FOP_HOME=`cygpath --unix "$FOP_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + else + JAVACMD=java + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." + echo " We cannot execute $JAVACMD" + exit +fi + +if [ -n "$CLASSPATH" ] ; then + LOCALCLASSPATH=$CLASSPATH +fi + +# add fop.jar, which resides in $FOP_HOME/build +LOCALCLASSPATH=${FOP_HOME}/build/fop.jar:$LOCALCLASSPATH + +# add in the dependency .jar files, which reside in $FOP_HOME/lib +DIRLIBS=${FOP_HOME}/lib/*.jar +for i in ${DIRLIBS} +do + # if the directory is empty, then it will return the input string + # this is stupid, so case for it + if [ "$i" != "${DIRLIBS}" ] ; then + if [ -z "$LOCALCLASSPATH" ] ; then + LOCALCLASSPATH=$i + else + LOCALCLASSPATH="$i":$LOCALCLASSPATH + fi + fi +done + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + FOP_HOME=`cygpath --path --windows "$FOP_HOME"` + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"` +fi + +$JAVACMD -classpath "$LOCALCLASSPATH" $FOP_OPTS org.apache.xalan.xslt.Process "$@" + -- 2.39.5