Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #12 from 18F/tasks/issue-2-allow-xsl-foreign-impor…
Browse files Browse the repository at this point in the history
…ts-for-reporting

Allow italics and other markup in SVRL results
  • Loading branch information
mike-stern authored Oct 29, 2020
2 parents 63096e3 + 4414c7b commit 642feca
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions resources/validations/bin/validate_with_schematron.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -o pipefail

if [ ! -e "$1" ]; then
echo "no file input for report, exiting"
exit 1
Expand All @@ -9,8 +11,10 @@ echo "doc requested to be validated: ${DOC_TO_VALIDATE}"

# Delete pre-existing XSLT report
rm -rf target/*.xsl;

SAXON_VERSION=$2
SAXON_VERSION=${SAXON_VERSION:-10.2}
SAXON_OPTS="${SAXON_OPTS:-allow-foreign=true}"

echo "using saxon version ${SAXON_VERSION}"

Expand All @@ -32,15 +36,31 @@ for qualifiedSchematronName in src/*.sch; do

# Use Saxon XSL transform to convert our Schematron to pure XSL 2.0 stylesheet
saxon_jar=~/.m2/repository/net/sf/saxon/Saxon-HE/"${SAXON_VERSION}"/Saxon-HE-"${SAXON_VERSION}".jar
java -cp "${saxon_jar}" net.sf.saxon.Transform -o:target/"${schematronRoot}".xsl -s:"${qualifiedSchematronName}" lib/schematron/trunk/schematron/code/iso_svrl_for_xslt2.xsl

java -cp "${saxon_jar}" net.sf.saxon.Transform \
-o:target/"${schematronRoot}".xsl \
-s:"${qualifiedSchematronName}" \
lib/schematron/trunk/schematron/code/iso_svrl_for_xslt2.xsl \
$SAXON_OPTS

echo "compiling: ${qualifiedSchematronName} to: target/${schematronRoot}.xsl"

# Use Saxon XSL transform to use XSL-ified Schematron rules to analyze full FedRAMP-SSP-OSCAL template
# and dump the result into reports.
reportName="report/schematron/${DOC_TO_VALIDATE}__${schematronRoot}.results.xml"
htmlReportName="report/html/${DOC_TO_VALIDATE}__${schematronRoot}.results.html"

echo "validating doc: ${DOC_TO_VALIDATE} with ${qualifiedSchematronName} output found in ${reportName}"
java -cp "${saxon_jar}" net.sf.saxon.Transform -o:"${reportName}" -s:"${DOC_TO_VALIDATE}" target/"${schematronRoot}".xsl
java -cp "${saxon_jar}" net.sf.saxon.Transform -o:"${htmlReportName}" -s:"${reportName}" lib/svrl2html.xsl

java -cp "${saxon_jar}" net.sf.saxon.Transform \
-o:"${reportName}" -s:"${DOC_TO_VALIDATE}" \
target/"${schematronRoot}".xsl \
$SAXON_OPTS

java -cp "${saxon_jar}" net.sf.saxon.Transform \
-o:"${htmlReportName}" \
-s:"${reportName}" \
lib/svrl2html.xsl \
$SAXON_OPTS

done

0 comments on commit 642feca

Please sign in to comment.