Project

Profile

Help

Bug #2345 ยป test.sh

shell script - Jeff Holt, 2015-04-01 00:23

 
java -version

xslsrc="test.xsl"
cat <<-EOF >$xslsrc
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
hi
</xsl:template>
</xsl:stylesheet>
EOF
xslpkg="/tmp/t est.zip"

ls -l "$xslpkg"

xmlsrc="test.xml"
cat <<-EOF >$xmlsrc
<?xml version="1.0" encoding="UTF-8"?>
<test/>
EOF

for ver in 9-5-1-8J 9-6-0-1J; do
dir="/Users/jholt/Downloads/Saxon$ver"
pe="$dir/saxon9pe.jar"
he="$dir/saxon9he.jar"
un="$dir/saxon9-unpack.jar"

ls -l "$dir"

java -cp "$pe" net.sf.saxon.Version
java -cp "$he" net.sf.saxon.Version

echo "Compiling"
java -cp "$pe" com.saxonica.ptree.StylesheetPackager "$xslsrc" "$xslpkg"

echo "Transforming"
java -cp "$he:$un" net.sf.saxon.Transform "-xsl:$xslpkg" -r:com.saxonica.ptree.PackageURIResolver -u:on "-s:$xmlsrc"
if [ $? -ne 0 ]; then
xslpkguri="file:///tmp/t%20est.zip"
echo "Transforming again"
java -cp "$he:$un" net.sf.saxon.Transform "-xsl:$xslpkguri" -r:com.saxonica.ptree.PackageURIResolver -u:on "-s:$xmlsrc"
fi
done
    (1-1/1)