Blob Blame History Raw
#!/bin/sh
# 
# saxon script
# JPackage Project <http://www.jpackage.org/>

. /usr/share/java-utils/java-functions

MAIN_CLASS=net.sf.saxon.Query

BASE_JARS="saxon.jar xml-commons-apis.jar jaxp_parser_impl.jar bea-stax-api.jar bea-stax-ri.jar"

# Optional jars
CLASSPATH="$CLASSPATH:"$(build-classpath docbook-xsl-saxon \
  avalon-logkit xml-commons-resolver 2>/dev/null) || :

# If we have resolver, add the CatalogManager.properties dir to CLASSPATH,
# and tweak command line options so that it's used.
args=
if echo "$CLASSPATH" | grep xml-commons-resolver >/dev/null 2>&1 ; then
  CLASSPATH="$CLASSPATH:/etc/java/resolver"
  # Tune options to use resolver.
  r=org.apache.xml.resolver.tools.ResolvingXMLReader
  for opt in -x -y ; do
    if ! echo $@ | grep "\\$opt " >/dev/null 2>&1 ; then
      args="$args $opt:$r"
    fi
  done
  r=org.apache.xml.resolver.tools.CatalogResolver
  if ! echo $@ | grep "\\-r " >/dev/null 2>&1 ; then
    args="$args -r:$r"
  fi
fi

# Set parameters
set_jvm
set_classpath $BASE_JARS
set_flags $BASE_FLAGS
set_options $BASE_OPTIONS

# Let's start
run $args "$@"