diff --git a/scripts/local_stylesheet.sh b/scripts/local_stylesheet.sh index 095003c..92f1db9 100755 --- a/scripts/local_stylesheet.sh +++ b/scripts/local_stylesheet.sh @@ -14,6 +14,8 @@ STYLESHEET= STYLESHEET_DIR="$BASE_DIR/stylesheets" NAME_PATTERN='*' SUFFIX='.xml' +CACHE= +SAXON_ARGS= OUTPUT_DIR= @@ -33,6 +35,8 @@ function print_help { echo " -i|--input-dir INPUT_DIR (multiple options add multiple directories). default: '$INPUT_DIR_DEFAULT'" echo " -o|--output-dir OUTPUT_DIR. default: '$OUTPUT_DIR_DEFAULT/STYLESHEET'" echo " -x | --suffix SUFFIX: output files suffix. default: '$SUFFIX'" + echo " -c | --cache: only write output if not yet existing" + echo " -o | --options OPTS append these options for saxon" echo echo "ARGUMENTS:" echo " STYLESHEET: a stylesheet in $STYLESHEET_DIR" @@ -70,6 +74,15 @@ while [[ $# > 0 ]]; do SUFFIX="$1" shift ;; + -o | --options) + shift + SAXON_ARGS="$SAXON_ARGS $1" + shift + ;; + -c | --cache) + shift + CACHE=1 + ;; -* ) echo "wrong syntax!" print_help @@ -118,13 +131,13 @@ java -jar "$TEI_DIR/Stylesheets/lib/saxon9he.jar" "$BASE_DIR/stylesheets/$STYLESHEET" -s:"$file" -o:"$OUTPUT_DIR/$output" + $SAXON_ARGS EOF - # cmd="xsltproc -o \"$OUTPUT_DIR/$output\" \"$BASE_DIR/stylesheets/$STYLESHEET\" \"$file\"" - if [[ ! -e $OUTPUT_DIR/$output ]]; then + if [[ $CACHE ]] && [[ -e $OUTPUT_DIR/$output ]]; then + echo "'$OUTPUT_DIR/$output' already exists, skipping..." + else echo "execute $cmd" eval $cmd - else - echo "'$OUTPUT_DIR/$output' already exists, skipping..." fi done < <( find "${INPUT_DIRS[@]}" \ diff --git a/scripts/updateOutput.sh b/scripts/updateOutput.sh index 525b686..0e6426c 100755 --- a/scripts/updateOutput.sh +++ b/scripts/updateOutput.sh @@ -19,6 +19,7 @@ function stage0 () { --input-dir "$output_dir/generated/odd_compiled" \ --output-dir "$output_dir/generated/odd_cleaned" \ --suffix '.xml' \ + --cache \ clean_odd.xsl echo "statistics.xsl..." @@ -26,6 +27,7 @@ function stage0 () { --input-dir "$output_dir/generated/odd_cleaned" \ --output-dir "$output_dir/generated/statistics" \ --suffix '.xml' \ + --cache \ statistics.xsl echo "htmlstatistics.xsl..."