Find file
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (37 sloc) 1.41 KB
# CSL schema validation
# Always run from the directory in which the script is located.
cd $(dirname $0)
# Die upon error.
set -e
# Create temporary directory, and provide for its deletion
# on exit.
TMP_DIR=$(mktemp -d -t './')
function finish () {
rm -rf ${TMP_DIR}/*
rmdir ${TMP_DIR}
#echo Hello
trap finish EXIT
# Paths
echo "# Input from: ${pathCSLStyles}"
echo -n " processing ... "
# Jing currently ignores embedded Schematron rules.
# For this reason, the schema is first converted to
# RELAX NG XML, after which the Schematron code is
# extracted and tested separately.
java -jar ${pathTrang} ${pathCSLSchema} ${TMP_DIR}/csl.rng
java -jar ${pathSaxon} -o ${TMP_DIR}/csl.sch ${TMP_DIR}/csl.rng RNG2Schtrn.xsl
java -jar ${pathJing} ${TMP_DIR}/csl.sch ${pathCSLStyles}/*.csl || true
# RELAX NG Compact validation
# Run dependent styles in batches to prevent argument overloading, as suggested by
# Carles Pina:
java -jar ${pathJing} -c ${pathCSLSchema} ${pathCSLStyles}/*.csl || true
find ${pathCSLStyles}/dependent -maxdepth 1 -name '*.csl' -print0 | xargs -0 -n 2000 java -jar ${pathJing} -c ${pathCSLSchema}
echo "styles validated"