xslt-examples/__relpipe-out-xml_xslt.sh
branchv_0
changeset 29 509cac0cf411
parent 25 8e2d9b67b51c
equal deleted inserted replaced
28:a93583fdc8e4 29:509cac0cf411
    17 
    17 
    18 DIR="$(dirname $0)"
    18 DIR="$(dirname $0)"
    19 BASE="$(basename $0)"
    19 BASE="$(basename $0)"
    20 XSL="$DIR/$BASE.xsl"
    20 XSL="$DIR/$BASE.xsl"
    21 
    21 
       
    22 xsltParams=();
       
    23 
       
    24 while [[ $# -gt 0 ]]; do
       
    25 	argument="$1";
       
    26 	case "$argument" in
       
    27 		"--title")                       xsltParams+=("--stringparam" "title" "$2"); shift; shift; ;;
       
    28 		"--css-appendix")                xsltParams+=("--stringparam" "cssAppendix" "$2"); shift; shift; ;;
       
    29 		"--description")                 xsltParams+=("--stringparam" "description" "$2"); shift; shift; ;;
       
    30 		"--record-count-prefix")         xsltParams+=("--stringparam" "recordCountPrefix" "$2"); shift; shift; ;;
       
    31 		"--record-count-suffix")         xsltParams+=("--stringparam" "recordCountSuffix" "$2"); shift; shift; ;;
       
    32 		"--relation-name-prefix")        xsltParams+=("--stringparam" "relationNamePrefix" "$2"); shift; shift; ;;
       
    33 		"--relation-name-suffix")        xsltParams+=("--stringparam" "relationNameSuffix" "$2"); shift; shift; ;;
       
    34 		*) echo "Unknown option: $argument" >&2; exit 1;
       
    35 	esac
       
    36 done
       
    37 
    22 if [[ -f "$XSL" ]]; then
    38 if [[ -f "$XSL" ]]; then
    23 	relpipe-out-xml | xsltproc "$XSL" -
    39 	relpipe-out-xml | xsltproc "${xsltParams[@]}" "$XSL" -
    24 else
    40 else
    25 	echo "unable to find XSLT template: $XSL" 1>&2
    41 	echo "unable to find XSLT template: $XSL" 1>&2
    26 	exit 1;
    42 	exit 1;
    27 fi
    43 fi