| 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Fetches schema and schematron files from remote locations. |
| 4 | # Currently supports only Schematron for XCCDF. |
| 5 | # |
| 6 | # Author: Simon Lukasik |
| 7 | |
| 8 | set -e -o pipefail |
| 9 | |
| 10 | |
| 11 | function fetch_schematron(){ |
| 12 | local skeleton=build/iso_schematron_skeleton_for_xslt1.xsl |
| 13 | if [ ! -f $skeleton ]; then |
| 14 | [ -d build ] || mkdir build/ |
| 15 | pushd build |
| 16 | wget http://www.schematron.com/tmp/iso-schematron-xslt1.zip |
| 17 | unzip iso-schematron-xslt1.zip |
| 18 | popd |
| 19 | fi |
| 20 | local target=$1 |
| 21 | local url=$2 |
| 22 | wget -O ${target}.xsd $url |
| 23 | xsltproc $skeleton ${target}.xsd > $target |
| 24 | rm ${target}.xsd |
| 25 | } |
| 26 | |
| 27 | fetch_schematron xccdf/1.2/xccdf_1.2-schematron.xsl http://scap.nist.gov/schema/xccdf/1.2/xccdf_1.2.sch |